in assets/ml.js [18:33]
function clearChart(ctx) {
if (charts[ctx.id]) {
charts[ctx.id].destroy(); // Destroy the existing chart
delete charts[ctx.id]; // Remove reference
// Fully reset the canvas to prevent Chart.js from reusing old bindings
const parent = ctx.parentNode;
const newCanvas = document.createElement("canvas");
newCanvas.id = ctx.id;
parent.replaceChild(newCanvas, ctx);
return newCanvas; // Return the new canvas element
}
return ctx; // If no chart existed, return the original canvas
}