Chartjs-How can I delete an instance of a chart using chart.js

0👍

call the destroy method of the chart object

.destroy()
Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js. This must be called before the canvas is reused for a new chart.

// Destroys a specific chart instance
myLineChart.destroy();

https://www.chartjs.org/docs/latest/developers/api.html?h=destroy

Leave a comment