Jump to content
Software FX Community

Real-time scatter plots

User (Legacy)

Recommended Posts


I'm attempting to create a scatter plot which updates in real-time as data

arrives. I've prototype the following code to update the chart once per


Dim bufferSize As Integer = 5

Chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, bufferSize)

Chart1.OpenData(SoftwareFX.ChartFX.COD.XValues, 1, bufferSize)

'Chart1.RealTimeSettings.BufferSize = 100

Dim i As Integer

Dim ran As New Random()

For i = 0 To bufferSize - 1

Chart1.Value(0, i) = ran.Next(-20, 20)

Chart1.XValue(0, i) = ran.Next(-20, 20)

Chart1.Update( )






This sample does not update the chart until the CloseData functions are


If I uncomment the line which specifies RealTimeSettings then I get the

following run time exception:

OpenData call with COD.XValues required

Any suggestions?


Jason Davis


Link to comment
Share on other sites

Your code is right but the timing in which it is executing is not real-time.

The chart will redraw when you yield control, while you are in a loop

setting values you have the CPU for yourself and the Chart window won't be

painted until you yield control of the CPU.

You could add a DoEvents() call inside your loop to force a refresh but I

don't think this is what you want to do.

Normally, you use a real-time chart when you DON'T have all the data at

once, if you have all the data at once, as you have in your example then it

is not really a real-time chart.

Check out the real-time samples for more details, in the example, a timer is

used to indicate a new value is available, in a real-case scenario, this

timer could poll some data source or device, or instead of a timer you cod

add data as a response from an event sent by the entity in charge of

collecting the real-time data.



Software FX, Inc.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...