Skip to content

Commit

Permalink
add custom tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheG committed Feb 7, 2024
1 parent 79f6f7c commit b3108af
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pages/compensation/drawer/graphLoader/DotsScatterPlot.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createSymlogScale } from "@nivo/scales";

import {
ResponsiveScatterPlot,
ScatterPlotNode,
//ScatterPlotNodeData,
ScatterPlotNodeProps,
} from "@nivo/scatterplot";

Expand Down Expand Up @@ -39,12 +41,13 @@ interface DataListTypes {
data: Array<NodeType>;
}

type Category = "High" | "Medium" | "Low";

const getNode = (selectedBiome: string) => {
const Node: ScatterPlotNode<NodeType> = ({
node,
onClick,
onMouseEnter,
onMouseLeave,
onMouseMove,
}: ScatterPlotNodeProps<NodeType>) => {
return (
<circle
Expand All @@ -54,7 +57,10 @@ const getNode = (selectedBiome: string) => {
fill={node.data.color}
stroke={selectedBiome === node.data.biome ? "#2a363b" : undefined}
strokeWidth={2}
onClick={(event) => (onClick ? onClick(node, event) : null)}
onClick={(event) => onClick?.(node, event)}
onMouseEnter={(event) => onMouseEnter?.(node, event)}
onMouseMove={(event) => onMouseMove?.(node, event)}
onMouseLeave={(event) => onMouseLeave?.(node, event)}
/>
);
};
Expand Down Expand Up @@ -171,7 +177,7 @@ export const DotsScatterPlot: React.FC<ScatterProps> = ({
return (
<div
style={{
color: node.color,
color: node.data.color,
backgroundColor: "rgba(0,0,0,0.9)",
position: "relative",
padding: "12px",
Expand Down

0 comments on commit b3108af

Please sign in to comment.