Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to erase old graph before new dra #561

Closed
kiga01 opened this issue Aug 20, 2014 · 2 comments
Closed

how to erase old graph before new dra #561

kiga01 opened this issue Aug 20, 2014 · 2 comments

Comments

@kiga01
Copy link

kiga01 commented Aug 20, 2014

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?

@nnnick
Copy link
Member

nnnick commented Aug 20, 2014

As mentioned in #559, you'd call myLineChart.destroy().

Not sure I understand what you mean by adding another curve? Do you mean point?

@kiga01
Copy link
Author

kiga01 commented Aug 21, 2014

sorry, i didnt explain myself well, but alredy solve it, i just erase the canvas and make new one before each draw

@nnnick nnnick closed this as completed Aug 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants