how to erase old graph before new dra
hi guys, anyone knows how i can clear the canvas bejore y draw new graph? this is how i create new graphs
var lineChartData = { labels : mname, datasets : [ { label: "Ventas año "+ year, fillColor : "rgba(220,220,220,0.2)", strokeColor : "rgba(220,220,220,1)", pointColor : "rgba(220,220,220,1)", pointStrokeColor : "#fff", pointHighlightFill : "#fff", pointHighlightStroke : "rgba(220,220,220,1)", data : array }, ] }
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = new Chart(ctx).Line(lineChartData, {
responsive: true,
//bezierCurve : false,
bezierCurveTension : 0.1,
});
and how can i add another curve to the existing canvas?
As mentioned in #559, you'd call myLineChart.destroy().
Not sure I understand what you mean by adding another curve? Do you mean point?
sorry, i didnt explain myself well, but alredy solve it, i just erase the canvas and make new one before each draw