9👍
✅
You can fix the issue by making var chart;
global (put it right before your myFunction()
call). Then your destroy should be if(chart) chart.destroy();
Source:stackexchange.com