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.

Uncaught RangeError: Maximum call stack size exceeded

See original GitHub issue

Expected Behavior

The chart shows data when using 45000 datapoints to create the chart.

Current Behavior

When creating the chart with 45000 datapoints, the following error is thrown and the canvas stays empty:

RangeError: Maximum call stack size exceeded
    at computeLabelSizes (Chart.js:11242)
    at ChartElement._getLabelSizes (Chart.js:11911)
    at ChartElement.calculateTickRotation (Chart.js:11689)
    at ChartElement.update (Chart.js:11547)
    at fitBoxes (Chart.js:7127)
    at Object.update (Chart.js:7341)
    at Chart.updateLayout (Chart.js:9680)
    at Chart.update (Chart.js:9633)
    at Chart.construct (Chart.js:9357)
    at new Chart (Chart.js:9294)

Possible Solution

Modify the lines (Chart.js:11242-11243):

widest = widths.indexOf(Math.max.apply(null, widths));
highest = heights.indexOf(Math.max.apply(null, heights));

So that they call an alternative implementation of Math.max.apply() that is non-recursive.

For an example implementation, please see the change from numbers/numbers.js#110 in file lib/numbers/basic.js, lines 240-255, function basic.max(), which introduces a non-recursive implementation of Math.max.apply().

Using the code from numbers.js, the issue was resolved.

Steps to Reproduce (for bugs)

Create a line chart with a single dataset which contains around 45000 datapoints (x|y). Use linear axes type.

Context

Chart.js is only working with small datasets.

Environment

  • Chart.js version: Chart.js v2.9.3
  • Browser name and version: Chrome 79.0.3945.130 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
cailen-fishercommented, Jun 23, 2020

Update: in my case, it was because of having a low stepsize when the data contained large numbers. Removing the stepsize setting altogether solved the issue.

7reactions
kurklecommented, Feb 23, 2020

2.9.3: https://codepen.io/kurkle/pen/VwLmobz master: https://codepen.io/kurkle/pen/ExjNqWK

Closing due to missing test case and not able to reproduce.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript...
Read more >
How to fix: "RangeError: Maximum call stack size exceeded"
A "RangeError: Maximum call stack size exceeded" is an error that occurs when a function or operation tries to execute too many nested...
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
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