My PCs memory runs out when a dynamic updating chart is displayed


« 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 Timo on 19th January 2018
I have created a Website with a line and a bar graph within.
Dynamically update is done by filling new values in the used data Array.

I tried to build it up like in the example below.
But I have the Problem, that RAM usage of the browser increases as Long as the Website is running.
And the same Problem exists, if I just open your example in the Web browser (IE or Firefox).

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

Then I tried not to create the 2 objects every time new but with the following code:
In this case only the bar graph is updated and not the line graph.

bar.original_data = parent.Graph_data1;
line.original_data = parent.Graph_data2;
RGraph.reset(document.getElementById('cvs1'));
RGraph.reset(document.getElementById('cvs2'));
bar.Draw();
line.Draw();
Posted by Richard on 19th January 2018
Hi there,

Well, that particular chart creates a new object on every iteration. Not something that's terribly efficient.

This demo on the other hand:

www.rgraph.net/demos/line-dynamic-updates.html

Updates the data that's held inside the Line chart without creating a new Line chart object. There's a bit more code to it - but i'm sure that it could be reduced if it were given some attention.

I think the main difference is to create a single RGraph Line chart object and then, on every iteration, update the data held by it instead of creating a whole new object each time.

Richard
Posted by Timo on 24th January 2018
Thanks for your help,

now it works.

What is the corresponding command for

obj.original_data[0] = data;

in a HBar, as there is no "original_data" field?

I actually use

obj.data[0] = data;




Timo
Posted by Richard on 24th January 2018
Hi there,

Yes that's the correct property to use IIRC. It's slightly different for the Line chart because for stacked Line charts the data is modified - hence the need to maintain the original data.

So yes - use obj.data for the Horizontal Bar chart.

Richard

Add a reply




« Back to message list