File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
assets/js/dashboard/stats/graph Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -223,20 +223,16 @@ export const MainGraph = ({
223223 } , [ ] )
224224
225225 const showZoomToPeriod = [ 'month' , 'day' ] . includes ( interval )
226+ const selectedDatum = selectedIndex !== null && remappedData [ selectedIndex ]
227+
226228 const zoomDate =
227- selectedIndex !== null && remappedData [ selectedIndex ] . mainSeriesDefined
228- ? remappedData [ selectedIndex ] . timeLabel
229+ selectedDatum && selectedDatum . mainSeriesDefined
230+ ? selectedDatum . timeLabel
229231 : null
230232
231233 return (
232234 < Graph < Readonly < [ number | null , number | null ] > >
233- className = {
234- showZoomToPeriod &&
235- selectedIndex !== null &&
236- remappedData [ selectedIndex ]
237- ? 'cursor-pointer'
238- : ''
239- }
235+ className = { showZoomToPeriod && selectedDatum ? 'cursor-pointer' : '' }
240236 width = { width }
241237 height = { height }
242238 hoverBuffer = { hoverBuffer }
@@ -269,7 +265,7 @@ export const MainGraph = ({
269265 yFormat = { yFormat }
270266 gradients = { gradients }
271267 >
272- { selectedIndex !== null && remappedData [ selectedIndex ] && (
268+ { selectedDatum && (
273269 < MainGraphTooltip
274270 getFormattedValue = { getFormattedValue }
275271 maxX = { width }
@@ -281,7 +277,7 @@ export const MainGraph = ({
281277 metric = { metric }
282278 x = { tooltip . x }
283279 y = { tooltip . y }
284- datum = { remappedData [ selectedIndex ] }
280+ datum = { selectedDatum }
285281 bucketIndex = { selectedIndex }
286282 totalBuckets = { remappedData . length }
287283 isTouchDevice = { isTouchDevice }
You can’t perform that action at this time.
0 commit comments