-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Description
Expected Behavior
Charts should plot successfully, even when ticks are small
Current Behavior
Currently, under certain circumstances, the tick array generated by Chart.js can include very small numbers instead of zero, due to rounding error. For example, the tick array generated could be [-0.00002, -0.00001, -3.4e-21, 0.000009999].
In this case, the linear formatter will crash, because the argument it passes to toExponential is less than zero.
Possible Solution
A min/max clamp between 0 and 20 is needed for the argument to toExponential, similar to the approach used for toFixed a few lines below.
Steps to Reproduce (for bugs)
Can't seen to coerce the ticks to misbehave in a specific codepen, but it is affecting our software here: carta-frontend/#433
Context
Environment
- Chart.js version: 2.80
- Browser name and version: Chrome 75