0👍
I suggest you to have different name for canvas and your doughnut-chart. If you keep your doughnut-chart name as “myChart”,try:
function piechart(){
myChart.destroy();
// Pie chart or doughnut chart with chart.js
-1👍
You can use the following code:
$('#myChart').replaceWith('<canvas id="myChart" width="600" height="400"></canvas>');
Source:stackexchange.com