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

"Maximum call stack size exceeded" in getMinMax #117

Closed
Rafnuss opened this issue Nov 29, 2021 · 1 comment
Closed

"Maximum call stack size exceeded" in getMinMax #117

Rafnuss opened this issue Nov 29, 2021 · 1 comment

Comments

@Rafnuss
Copy link
Contributor

Rafnuss commented Nov 29, 2021

With large files, I get the following error
Uncaught RangeError: Maximum call stack size exceeded

for

minMax = [Math.min.apply(Math, y_vals), Math.max.apply(Math, y_vals)];

It seems to work if you replace this line with

    minMax = y_vals.reduce(([min, max], val) => [Math.min(min, val), Math.max(max, val)], [
      Number.POSITIVE_INFINITY,
      Number.NEGATIVE_INFINITY,
    ]);
@Rafnuss
Copy link
Contributor Author

Rafnuss commented Nov 29, 2021

Actually, this might be a duplicate of #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant