How to clear a chart from a canvas so that hover events cannot be triggered?

后端 未结 21 1815
不思量自难忘°
不思量自难忘° 2020-11-28 20:07

I\'m using Chartjs to display a Line Chart and this works fine:

// get line chart canvas
var targetCanvas = document.getElementById(\'chartCanvas\').getConte         


        
21条回答
  •  忘掉有多难
    2020-11-28 21:03

    var myPieChart=null;
    
    function drawChart(objChart,data){
        if(myPieChart!=null){
            myPieChart.destroy();
        }
        // Get the context of the canvas element we want to select
        var ctx = objChart.getContext("2d");
        myPieChart = new Chart(ctx).Pie(data, {animateScale: true});
    }
    

提交回复
热议问题