visx icon indicating copy to clipboard operation
visx copied to clipboard

Accessor called with undefined on hover

Open Janpot opened this issue 3 years ago • 1 comments

When you have series in an xy-chart with missing data at the end, visx will try to execute xAccessor with undefined when hovering over the part where data is missing.

See https://codesandbox.io/s/serene-worker-7plx1?file=/src/Example.tsx

When you hover over the rightmost 1/3 of the graph, you'll get a

Cannot read property 'x' of undefined

Janpot avatar Jun 23 '21 06:06 Janpot

Thanks for raising this to our attention 🙏 Hmm, I think currently there is an assumption that each series has the same number of data points but we could likely fix that.

A simple work around for this is to handle undefined in the accessors e.g., d => d?.x/y

williaster avatar Jun 25 '21 21:06 williaster