How do I remove the old chart or reset the data? - Official support forum | RGraph.net

How do I remove the old chart or reset the data?


Posted by Roshni at 10:09 on Tuesday 5th October 2021 [link]
Hello,

I have dropdown of city and onchange I need to reload new chart based on values but the old chart is remain as it is and new values has been ovelapping so can you please let me know what should I do or is there any code to remove or reset chart data.

Posted by Richard at 10:26 on Tuesday 5th October 2021 [link]
What you need to do is remove the old chart from the ObjectRegistry - which is where RGraph keeps track of what objects there on the canvas.

The easiest way to do this is to use the reset() function instead of the clear() function:

var myCanvas = document.getElementById('cvs');

RGraph.reset(myCanvas);

[Replies are now closed]