Chartjs-How to avoid detached HTMLCanvasElements when updating canvas with JavaScript?

0👍

You should keep track (in an array, for example) of your charts previously created, then when the new data is fetched from the server, you need to retrieve the chart to update, update its data and/or options, and then call

chart.update();

to refresh the chart. In this case you won’t create new charts at each update.
You may find more details in the Chart.js docs.

Leave a comment