Chart rendering errors if "axis.incrs" return-value too small
See original GitHub issueDemo showing error: https://codepen.io/Venryx/pen/eYzLjLx
The chart fails to render when the line setting a custom (small) axis.incrs
value is not commented.
If dev-tools is open when the chart is rendering, the error hits on this line: https://github.com/leeoniya/uPlot/blob/848324500fa49da0f87bce75344c39c7a996cad1/src/uPlot.js#L1338
It errors there, because the return value of getIncrSpace
is null. It is null because the subsequent call to findIncr
returns null.
Here is the code for fincIncr
: https://github.com/leeoniya/uPlot/blob/848324500fa49da0f87bce75344c39c7a996cad1/src/uPlot.js#L194-L207
The problem is that the user-specified axis.incrs
might be too small – there might not be any values that allow the if (space >= minSpace && minDec + incrDec < 17)
check to pass, meaning no return value is specified.
How to fix?
I’m not sure. But in any case, there should be a more informative error message. I’ve been hitting this issue since starting use of the library (using some workarounds to avoid), but only now discovered the cause.
The library should either be made to avoid errors for small incrs
values, or it should give a clear error message saying what the issue is (and how to determine the minimum valid incrs
value).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
Since I’ve confirmed this fixes it for the demo, I will close this issue. When I reproduce the other issue I hit (in my actual app), I’ll make a new bug report.
yep. take a look at the attached patch.