-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
make sure _labelOffsetY doesn't become Infinity #1024
Conversation
Thanks @nordfjord! Much appreciated. |
Hmm, started to write a test case for this, but I can't figure out: if there are no rows, then how is |
Sorry for the late reply (it's hard to sift through all the emails I receive from github to find the relevant ones). This bug is not really a bug in the sense that it doesn't break anything, the only thing that happens is it fills my console up with an annoying amount of errors, which I tend to try to avoid. To be honest I don't actually remember what my test case was. I think I was using a rowchart whose group filtered out 0 values, and when I applied filters so that no values were left in the group my console started spewing tons of errors. I then added this check and like magic my console was clean again. |
My fix was this one:
(Wish it had been merged. I've just spent 2 hours on this same issue :-/) |
@Fil, I still don't see how Infinity can be applied to any bars if there aren't any bars. What am I missing? Do you have a test case? |
Aha! I think I found it. This also would explain why it spews errors but draws correctly. So I think the correct fix is to remove the first, redundant call from Sorry for being obstinate about not taking fixes without tests or explanations. I feel that it only makes the code harder to read. |
I can confirm that "to remove the first, redundant call from createElements" fixes it too for me. |
(And I totally agree with your being obstinate about getting to the real cause of any bugs rather than just routing around.) |
Thanks @Fil! I'll put that in the next release. |
Shouldn't we close this PR since it's not the real cause of the error? |
Thanks, I was looking for this issue to include the fix in the last release, but I didn't find it in time. I'm going to reopen - the description is rarely the root cause! |
Ref: #1008 |
Fixed in 2.0 beta 32. Thanks @nordfjord and @Fil! |
make sure _labelOffsetY doesn't become Infinity and spew a ton of errors to the console.
height becomes Infinity when
n == 0
, meaning any time the chart is rendered with no data.