1๐
โ
You can destroy it first like so:
<canvas id="graph"></canvas>
<script>
let myChart;
$("#button").click(function() {
if(Chart.getChart(myChart)) {
myChart.destroy();
}
let ctx = $("#graph");
myChart = new Chart(ctx, {/* My nice graph. */});
});
</script>
Source:stackexchange.com