[Chartjs]-How to destroy a canvas using Id and add new canvas to the same id

1👍

This is a very common issue when it comes to updating charts. Please add the following code at the start of your updateCharts(buttonClick: string) method.

Chart.helpers.each(Chart.instances, function (instance) {
        instance.destroy();
      }); 

It will destroy all the previous chart instances before updating. I hope this is what you’re expecting.

Leave a comment