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
Clear canvas after drawing a chart (AJAX Request) #559
Comments
You can destroy the whole chart instance by calling Should sort your issues there? |
Awesome. 👍 |
how and where can i call the destroy instance? |
As per the example above, you'd call |
Awesome. 👍 +1 |
How would one access any chart instances, say from outside of the invocation scope of the chart? I can target any canvas elements, but I can't see any reference to the chart instance |
Hi Waniel, create a global variable and use that variable while creating chart. e-g var mychart; Now you can use mychart.clear() or mychart.destroy() Regards, |
What if I have multiple bar charts, I cannot use a single global variable for all. |
i am using chart.js with ionic, when i show and hide the graph the graph shows for the first time but when i hide it and shows again the graph disappears.... |
Thanks ! Chart flickered when I update with ajax call. Now its fine ! |
I have the same problem. I can't access myLineChart variable because it is created inside separate method. But I just want to clear canvas and for me it doesn't matter what kind of chart was drawn. |
create a global variable and use that variable while creating chart. e-g var mychart; I've done that but I get an error: I can do ?. Thank you |
declare a global hash and save each chart object in that hash by the div identifier. Much simpler and scalable. |
made the example above work for me. |
Adding the if condition will remove all previous data in graph and will plot the graph with new values |
Currently I am trying to draw a new chart after a POST request, which transfers the JSON to the "canvas" element. Unfortunately the graph starts jumping around and gets "fuzzy" between the grid lines.
This happens every time when the JSON data has changing datasets - which means, that there are different amounts of grid lines zu draw.
So far I have tried
and
Both without success. Do you have any tipps/hints to destroy the canvas before redrawing on it?
The text was updated successfully, but these errors were encountered: