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();
Source:stackexchange.com