How to increase the delay between the points

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 hardeep on 28th September 2015
i want to increase the delay between the points and decrease the number of points at a time on the canvas should be 20 points only in the following graph and how to apply tooltips on this graph

www.rgraph.net/demos/line-dynamic-scrolling-dual-canvas.html
Posted by Richard on 28th September 2015
Hi,

1. Tooltips won't work because the chart is constantly being redrawn - and redrawing clears any tooltip that is displayed.

2. To be able to set the delay you'll need to NOT use the updateCanvas() function - which uses requestAnimationFrame(). So you'll need to replace this line:

RG.Effects.updateCanvas(draw);

with this:

// Four updates per second
setTimeout(draw, 250);

To ensure there's only 20 points on the chart at once, in the draw function check the size of the data array and if it's over 20 take one out.

Richard
If RGraph has helped you - please share the website and give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post
Posted by Richard on 28th September 2015
Hi,

To get rid of data items from the end of the array you could do this:

while (obj.original_data[0].length > 20) {
     obj.original_data[0].pop();
}

Richard
If RGraph has helped you - please share the website and give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post

Add a reply




« Back to message list