Skip to content
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

[BUG] Logarithmic Charts infinite tick marks #4785

Closed
dak opened this issue Sep 21, 2017 · 1 comment
Closed

[BUG] Logarithmic Charts infinite tick marks #4785

dak opened this issue Sep 21, 2017 · 1 comment

Comments

@dak
Copy link

dak commented Sep 21, 2017

Expected Behavior

Browser shouldn't crash when loading logarithmic chart.

Current Behavior

Browser crashes when attempting to load a logarithmic chart (probably due to a 0 data point).

Possible Solution

The error appears to occur in core.ticks.js in the do-while loop on line 125. exp is being set to -Infinity because helpers.log10(0) (correctly) returns -Infinity. The loop then becomes infinite because of the check exp < endExp (line 135) — -Infinity + 1 is still -Infinity, and so -Infinity is always less than some integer.

Therefore, modifying line 135 to add a isFinite(exp) check would fix the issue:

while (isFinite(exp) && (exp < endExp || (exp === endExp && significand < endSignificand))));

Environment

  • Chart.js version: 2.7.0
  • Browser name and version: All browsers (Chrome 61, Safari 11, Firefox 52 ESR used for testing)

image

@dak dak changed the title [BUG] Logarithmic Charts can crash browser [BUG] Logarithmic Charts infinite tick marks Sep 28, 2017
@etimberg
Copy link
Member

Closing as duplicate of #4572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants