@@ -74,8 +74,8 @@ export const MainGraph = ({
7474 const [ tooltip , setTooltip ] = useState < {
7575 x : number
7676 y : number
77- datum : GraphDatum | null
78- } > ( { x : 0 , y : 0 , datum : null } )
77+ selectedIndex : number | null
78+ } > ( { x : 0 , y : 0 , selectedIndex : null } )
7979
8080 const interval = data . query . dimensions [ 0 ] . split ( 'time:' ) [ 1 ]
8181 const metric = data . query . metrics [ 0 ] as FormattableMetric
@@ -253,7 +253,7 @@ export const MainGraph = ({
253253 comparisonDot . attr ( 'display' , 'none' )
254254 }
255255 setTooltip ( {
256- datum : remappedData [ closestIndexToPointer ] ,
256+ selectedIndex : closestIndexToPointer ,
257257 x : xPointer ,
258258 y : yPointer
259259 } )
@@ -262,7 +262,7 @@ export const MainGraph = ({
262262 dot . attr ( 'display' , 'none' )
263263 comparisonDot . attr ( 'display' , 'none' )
264264 setTooltip ( {
265- datum : null ,
265+ selectedIndex : null ,
266266 x : 0 ,
267267 y : 0
268268 } )
@@ -292,9 +292,9 @@ export const MainGraph = ({
292292 < svg
293293 ref = { svgRef }
294294 viewBox = { `0 0 ${ width } ${ height } ` }
295- className = "w-full h-auto"
295+ className = "w-full h-auto cursor-pointer "
296296 />
297- { tooltip . datum !== null && (
297+ { tooltip . selectedIndex !== null && (
298298 < GraphTooltip
299299 width = { width }
300300 showZoomToPeriod = { showZoomToPeriod }
@@ -304,7 +304,7 @@ export const MainGraph = ({
304304 metric = { metric }
305305 x = { tooltip . x }
306306 y = { tooltip . y }
307- datum = { tooltip . datum }
307+ datum = { remappedData [ tooltip . selectedIndex ] }
308308 />
309309 ) }
310310 </ div >
0 commit comments