Skip to content
Snippets Groups Projects
Commit bb02a1fa authored by Marcos Pieras's avatar Marcos Pieras Committed by Marcos Pieras
Browse files

feat: more infromation custom tooltip

parent 48c3ea79
No related branches found
No related tags found
1 merge request!326Feat(vis1 d)/add tooltip
...@@ -113,7 +113,7 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({ ...@@ -113,7 +113,7 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({
}) => { }) => {
const internalRef = useRef<HTMLDivElement>(null); const internalRef = useRef<HTMLDivElement>(null);
const [divSize, setDivSize] = useState({ width: 0, height: 0 }); const [divSize, setDivSize] = useState({ width: 0, height: 0 });
const [hoveredPoint, setHoveredPoint] = useState<{ left: number; top: number; value: number } | null>(null); const [hoveredPoint, setHoveredPoint] = useState<{ left: number; top: number; xValue: number; yValue: number } | null>(null);
useEffect(() => { useEffect(() => {
const handleResize = () => { const handleResize = () => {
...@@ -147,7 +147,8 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({ ...@@ -147,7 +147,8 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({
setHoveredPoint({ setHoveredPoint({
left: plotRect.left + xIndex, left: plotRect.left + xIndex,
top: plotRect.top + yIndex, top: plotRect.top + yIndex,
value: point.y, xValue: point.x,
yValue: point.y,
}); });
} }
} }
...@@ -218,7 +219,7 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({ ...@@ -218,7 +219,7 @@ export const CustomChartPlotly: React.FC<CustomChartPlotlyProps> = ({
}} }}
> >
<div> <div>
<strong>Value:</strong> {hoveredPoint.value} <br /> <strong>{hoveredPoint.xValue}</strong>: {hoveredPoint.yValue}
</div> </div>
</TooltipContent> </TooltipContent>
</Tooltip> </Tooltip>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment