I have some questions about updating a Gauge chart with new data

« 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 Bernard Brault on 31st October 2013
I am new to RGraph and I have a few newby questions:

I am using Websockets to push new data to the page.
I want to update a gauge with the new data without using special effects.

Question #1:
Does this involves completely erasing the entire canvas and re-drawing the canvas, including the gauge that need updating?
Can RGraph selectively erase/re-draw (update)?
What is the recommended way to do this?

Question #2:
It relates to question #1 above.

In one example, I am using 2 gauges in one canvas: gauge1 and gauge2

                 gauge1.value = new_value_from_websocket;

The above line of code re-draws both gauge1 and gauge2 so not exactly what I am looking for but it works!

Thank you for your help.
Posted by RGraph Support on 31st October 2013
Hi there,

1. Clearing the canvas and doing a redraw is the best way - though if you can then using the RGraph.Redraw() function is quicker to type!

2. Yes the RedrawCanvas function will redraw all charts that are registered for that canvas. You could use separate canvas tags for the two Gauges and then the RedrawCanvas function will just redraw the canvas tag that you specify.

Richard, RGraph Support
Posted by RGraph Support on 31st October 2013
Hi there,

If you're limited for space here's something you could use - there's a similar example on the RGraph website already using one canvas - but this uses two:



Add a reply

« Back to message list