How to stop dynamic chart


« 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 Jack on 10th June 2013
I am using a Line Graph to display dynamic data.
I want to stop the graph onClick of a Button.
How do I do it.

FYI- I am sending form data via AJAX and getting response back as JSON.
The JSON response shows me numbers which I plot on the graph continuously.

While that is displaying data, I want to stop the graph on click of a button ?
Should I just stop making server calls. Will that be a solution or is there a way to pause and restart the graph ?

Thanks
Posted by RGraph support on 11th June 2013
Hi there,

You can cancel the timer with clearTimeout() or clearInterval() depending on which one you're using.




Richard, RGraph Support

5 developer license with Priority support for £299:
   www.rgraph.net/license#five-developer
Posted by Jack on 11th June 2013
Sorry I may not understand it right
I am updating the graph by
   setTimeout(loadDynamicGraph, 3000);

How do I use the above mentioned functions to pause my timer and stop sending data to the backened so that the Graph is paused.
Posted by RGraph support on 11th June 2013
Hi there,

The SetTimeout() and setInterval() functions both return a reference which you can then give to either clearTimeout() or clearInterval(). Eg:

var myTimer = setTimeout(function () {...}, 1000);

And you can then clear that timer with:

clearTimeout(myTimer);

More information on timers here:

www.w3schools.com/js/js_timing.asp




Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
Posted by Jack on 12th June 2013
Perfect Thanks

Add a reply

 




« Back to message list
RGraph on social media