How do I get the dynamic loading of charts?

« 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 Goldy on 17th April 2013
I am new and I learned to implement Line Graphs.
I want to implement dynamic graphs and I referred the example here
But I want a better one or a more simple one to understand.
Please can you one.
Posted by RGraph support on 17th April 2013
Hi there,

There's a new basic example of dynamic updates in the demos.

Which also links to a few other demos. But AJAX updating is not a simple affair - you may find it easier to at least start with refreshing the page via a meta refresh tag.

Posted by Goldy on 18th April 2013
Thanks that example helps.
But in my case I am getting continuous response from server using AJAX.
Server is just sending me random numbers that need to be plotted on the graph.
So I will add those values in the arrayList but there isnt a limit to it.
How do we handle that ?
Its like monitoring a network performance
Posted by RGraph support on 18th April 2013
Hi there,

There is something called WebSockets - where you can open a permanent connection to the server - but that's beyond the scope of this forum. If you limit the updates to one per second - or even a few per second - you might be OK.

Richard, RGraph Support
Posted by Goldy on 18th April 2013
Thanks for your help. I like this API and the quick response on the support forum to
Posted by Enter your name... on 23rd April 2013
While loading graphs dynamically is it mandatory to push it in an array and then send that array as a parameter to RGraph.Line ??
Im asking this because, Im getting one value from the server and I want to plot it on the Graph with a ymin value to be 50 less than the actual and ymax to be 50+.
This will continue with next value returning from the server and so on
Posted by RGraph support on 23rd April 2013
Hi there,

You don't have to create a new object every time - you can set the new data by setting the data in the first Line object that you create:

myLine.original_data[0] = [4,5,6,8,4,5,6,9];

That sets the first lines data. Based on that array you can set the ymax and ymin values. Then call:


All of the data properties here:

Richard, RGraph Support
Posted by Goldy on 26th April 2013
Ok understood. Thanks.
Another question. I want to display my chart as the size of the canvas.
How do I do that.
Right now my chart appears very stretched. I tried to set the chart.image.background.stretched property to false but didnt fix it.
Also the titles and the numberings on the axes appear as stretched.
How do I avoid that ?
Posted by RGraph support on 29th April 2013
Hi there,

It sounds like you might be sizing the canvas using CSS - use the width/height HTML attributes.

Richard, RGraph Support

Add a reply

« Back to message list