0๐
I found my answer by this way.
Thanks!
var ctx = document.getElementById("chart-area").getContext("2d");
if(myPie!=null){
myPie.destroy();
}
myPie = new Chart(ctx, config);
0๐
To destroy chart, you need to call โdestroyโ method on variable, which contains an instance of the chart.
Simple example for your case:
var ctx = document.getElementById("chart-area").getContext("2d");
var myPie = new Chart(ctx, config);
...some additional code...
// Destroy myPie instance
myPie.destroy();
Source:stackexchange.com