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 error #149

Open
roma177 opened this issue Oct 12, 2021 · 3 comments
Open

maximum call stack size exceeded error #149

roma177 opened this issue Oct 12, 2021 · 3 comments

Comments

@roma177
Copy link

roma177 commented Oct 12, 2021

Hello.
I have a chart which works fine, but after I added plugin it gives me maximum call stack size exceeded error. The sole goal of the plugin is to pause the realtime chart moving and to update the chart accordingly. It works, except after chart moving is paused I begin to get numerous maximum call stack size exceeded errors.
Part of the chart code with that plugin is below:
this.myChart = new Chart(ctx, { type: "line", plugins: [{ afterDatasetsDraw: () => { if (this.myChart.getDatasetMeta(0).data[0].x <= 55.5) { this.myChart.options.scales.x.realtime.pause = true; this.myChart.update("none"); } }}],

How to solve that maximum call stack size error saving pause functionality?
I also tried this but it does not stop chart moving immediately
plugins: [{ afterDatasetsDraw: () => { if (this.myChart.options.scales.x.realtime.pause !== true && this.myChart.getDatasetMeta(0).data[0].x <= 55.5) { this.myChart.options.scales.x.realtime.pause = true; this.myChart.update("none"); } }}],

@scotow
Copy link

scotow commented Jul 7, 2022

Hello, same problem here, calling chart.update("none") or chart.update("quiet") (as specified in the doc), will eventually create a "maximum call stack size exceeded error". I managed to partially fix the problem by setting pause to true and removing chat.update(...), but as @roma177 said, it doesn't stop the chart immediately.

@scotow
Copy link

scotow commented Jul 19, 2022

I tried to use the exact same versions of chart.js, the streaming plugin and the time libraries that are used in the documentation (which never crash btw, even when using the pause / unpause button) and it still crashes. So maybe the problem comes from somewhere else?
@roma177 Do you use any framework in your app? Like VueJS, React, Svelte, or something similar? I do.

@scotow
Copy link

scotow commented Jul 20, 2022

After further investigation, I found out that this bug only happens when using both chartjs-plugin-streaming and chartjs-plugin-annotation at the same time. As a temporary workaround, I removed the annotation plugin and added a "static" dataset that looks exactly like the line annotation I was using (except, it was a dashed line, so now the line is scrolling too, but that's ok I guess).

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

2 participants