Line charts that automatically updates with time

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 XaroRSA on 7th July 2013
Hi RGraph.

I want to make a chart that reads information from a sql database, updates automatically.
I have done this with Google Charts successfully, but google charts X-axis refuses to draw properly on new values.
Can i make a dynamic line chart using the Rgraph library, or should i stuggle on with google?

Regards


 
Posted by XaroRSA on 7th July 2013
Note: With the Line chart, there isn't an option to have a scale on the X axis. For this you'll need a Scatter chart with chart.line set to true. You can either use labels across the X axis or an X scale. Or now (February 2013 you could also use X axis drawing object.

Somehow, I believe google line chart has the same issue
RAGe!
Posted by RGraph support on 7th July 2013
Hi there,

One way is to use the setTimeout() function to set a function to happen at a future point (eg every 250ms) - and have that function then make an AJAX request to get the data from the server and then re-plot the chart with the updated data.

This chart updates dynamically with random data:

www.rgraph.net/demos/line-effects-scrolling.html

But you should be able to replace the random function with an AJAX function (eg RGraph.AJAX.getNumber() ) so that the data comes from the server instead of being random.



Richard, RGraph support

Add a reply




« Back to message list