question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chart rendering errors if "axis.incrs" return-value too small

See original GitHub issue

Demo 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Venryxcommented, Nov 7, 2020

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.

1reaction
leeoniyacommented, Nov 7, 2020

Oh, perhaps I misinterpreted.

yep. take a look at the attached patch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do in case of warning and error messages?
Error message. The chart area is too small to render the chart. Adjust the margins or increase the chart area size to render...
Read more >
react-charts axes not rendering properly (Hook problem?)
The following code generates a chart but fails to render the axes as the items.map for xp renders an empty array before it...
Read more >
Problem with Chart Axis in Excel - Microsoft Community Hub
My chart axis shows only every other date, rather than every consecutive date that ... reflected in axis, you should try to increase...
Read more >
API Documentation - Chartist.js
Detailed documentation of the Chartist.js code and API.
Read more >
ios-charts/CHANGELOG.md at master · danielr/ios-charts · GitHub
Programatically passed renderer is corrupting animations #3349 ... how to change the color of text that displayed below the chart ios swift 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found