SVG Semicrcular meter chart - cannot replace chart when rerunning the draw function

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Jean-Paul on 26th January 2017
Hi

I am using a semicircular svg chart to display a metric of a user-selected activity. (User selects from a dropdown, javascript calculates the new value from a database call, javascript calls a function to draw the semicircular svg chart).

All good on the first select. Semicircular svg chart displays perfectly.

When the user selects another activity, I would like to replace the semicircular svg chart.

However, when I rerun the draw (or grow) function, the new graph overlays the previous graph.

Is there a way to clear / reset / remove / drop the old graph before I draw the new one?

I have spent hours going over the routines for "canvas" items and the object repository, with no luck for SVG.

Please can you point me in the right direction?

Posted by Richard on 26th January 2017
Hi,

Before drawing the second chart you could clear the SVG tag:

RGraph.SVG.clear(svg);

So if you have an object called scp then you could do this:

RGraph.SVG.clear(scp.svg);




Richard

Add a reply




« Back to message list