Chartjs-.destroy() generating error 'window.myChart.destroy()' is not a function

0👍

declared a function after the chart has been created;

function destroyChart() {
  myChart.destroy();
}

As this is called after the chart is declared, it works correctly

so in your case, call destroyChart(); before the chart function.

  destroyChart();
  displayGraphs();

Leave a comment