Implementing a dynamic Line chart and dynamic Bar chart

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Schultz on 18th July 2013
Hey,

I was wondering the best approach to implementing a dynamic line graph and dynamic bar graph. The data is being called from a server using AJAX. I also need these to be in two different canvases.

Thank you!
Posted by RGraph support on 18th July 2013
Hi there,

You simply set the new data in the chart object using the appropriate data property and then call RGraph.Redraw(). You can see a list of the relevant data properties here:

www.rgraph.net/docs/api.html#data

And the basic AJAX examples:

www.rgraph.net/docs/basic-index.html

And the Line chart demos:

www.rgraph.net/demos

eg For the Line chart you could do this:

newdata = [get new data via AJAX]
myLine.original_data[0] = newdata; // Updates the first dataset
RGraph.Redraw();


Similarly with the Bar chart:


newdata = [get new data via AJAX]
myBar.data = newdata;
RGraph.Redraw();




Richard, RGraph Support

Help support RGraph - single site license only £99!
   www.rgraph.net/license#single-site

Add a reply




« Back to message list