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

Check for isNaN before building number formatter options #11238

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

defunctzombie
Copy link
Contributor

When datasets have values approaching Number.MAX_VALUE, the tick calculations might result in infinity and eventually NaN. Passing NaN for minimumFractionDigits or maximumFractionDigits will make the number formatter throw. Instead we check for isNaN and use a fallback value so the formatter does not throw.

When datasets have values approaching Number.MAX_VALUE, the tick calculations might result in infinity and eventually NaN. Passing NaN for minimumFractionDigits or maximumFractionDigits will make the number formatter throw. Instead we check for isNaN and use a fallback value so the formatter does not throw.
@defunctzombie
Copy link
Contributor Author

Originally discovered in our visualization tool which uses chart.js. We had users with datasets containing Number.MAX_VALUE and it was crashing our plot panels.

https://github.com/foxglove/studio/pull/5786

src/core/core.ticks.js Outdated Show resolved Hide resolved
Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
@LeeLenaleee LeeLenaleee added this to the Version 4.3.0 milestone Apr 19, 2023
@etimberg etimberg merged commit b16f32a into chartjs:master Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants