RGraph is a JavaScript charts library based on
HTML5 SVG and canvas. RGraph is mature (over 16 years
old) and has a wealth of features making it an ideal
choice to use for showing charts on your website.
Get the latest version of RGraph (version 6.20, 1st December 2024) from
the download page. You can read the changelog here. There's also older versions available,
minified files and links to cdnjs.com hosted libraries.
Drawing the chart a second time doesn't clear the previous chart
Posted by Roberto at 12:20 on Thursday 22nd April 2021[link]
Hello,
I should draw the graph and based on the input data updating the graph with the new data, and this works but draw the new bars on top of the old ones without gradually removing the bars of the previous graph, without updating the graph. How can I solve?
Thanks
Posted by Richard at 16:24 on Thursday 22nd April 2021[link]
You can use the RGraph.clear() function to clear the canvas before drawing a second time. For example:
var canvas = myObject.canvas;
RGraph.clear(canvas);
PS. If you want an animated change then the Bar chart supports this by supplying the new data to the grow() function. There's an example here: