I am using the Chart.js library to draw a bar graph, it is working fine, but now I want to destroy the bar graph and make
I got the same problem, I have removed the canvas element and recreated canvas element and then again rendered with some delay.
var element = document.getElementById("canvasId");
element.parentNode.removeChild(element);
var canv = document.createElement("canvas");
canv.setAttribute("id","canvasId");
canv.style.height = "20vw"; // give height and width as per the requirement
canv.style.width = "20vw";
setTimeout(()=>{
var grapharea = document.getElementById("canvasId").getContext("2d");
},500)