Implementing a dynamic Line chart and dynamic Bar 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 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

 


Warning: file_get_contents(http://api.textcaptcha.com/c5v0c8vo7c0gsk88osgcw8k0w98j9qvb): failed to open stream: Connection timed out in /homepages/46/d548322256/htdocs/www/includes/captcha.php on line 15



« Back to message list
RGraph on social media