Destroy chart.js bar graph to redraw other graph in same

前端 未结 12 1560
名媛妹妹
名媛妹妹 2020-11-30 06:41

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

12条回答
  •  忘掉有多难
    2020-11-30 06:47

    Remove the canvas after every chart call, this worked for me

    $("canvas#chartreport").remove();
    $("div.chartreport").append('');
    var ctx = document.getElementById("chartreport").getContext("2d");
    chartreport= new Chart(ctx, { .... });
    

提交回复
热议问题