-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line Chart : crash when hovering an empty chart that is interactive #2597
Comments
hey @akassaei! Did you find a quick workaround for this one? I am also struggling ;) |
Any update here? |
@gercog1 @robiscoding Sorry didn't see your messages @plouc is that something you can look at please ? |
@akassaei, a PR would be nice :) |
Fixed by #2669 |
Is this already part of any release?, I'm still having the issue |
Describe/explain the bug
When hovering a Line Chart with empty data, the chart crashes.
To Reproduce
Here is the link to a Codesandbox showing the issue : https://codesandbox.io/p/sandbox/charming-mendel-3wsx4v?file=%2Fsrc%2Fcomponents%2FLineChart.js%3A110%2C25
Steps to reproduce the behavior:
Expected behavior
No crash 😅
Additional context
I spotted where the issue is coming from : basically the
findNode
method in Mesh hooks relies ond3-delaunay
and specifically ondelaunay.find
method. With no data points given, the.find
returns NaN and it isn't a case checked in the code so we try to access thenode
related to theindex
and it crashes because it'sundefined
.nivo/packages/voronoi/src/hooks.ts
Lines 172 to 179 in da6d6b7
I've already opened an issue on
d3-delaunay
side because I don't thinkNaN
is really an expected behavior 😅 You can find the issue opened here : d3/d3-delaunay#144On our side, I've patched Nivo to return
null
whennodes.length === 0
. So I have a fix ready if you want me to handle it, but I'm not sure that's how you want to handle it 😄The text was updated successfully, but these errors were encountered: