ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  display real-time waveform data
Posted by Khoa Nguyen on Sep-17-2016 07:09
Hello
I have array of 2000 elements, updated at 60 Hz.
Can chartdirector display/update a chart, plotting 2000 elements, in real time?

I'm using AddXY simple example.

THank you!

  Re: display real-time waveform data
Posted by Peter Kwan on Sep-19-2016 23:22
Hi Khoa,

Yes, ChartDirector can update 2000 points in realtime.

In a test we done a few years ago, we gather data at 8000 points per second and plot at 60 frames per second, and it still works smoothly.

Note that the chart refresh rate and the data update rate can be different. Many of our customers update the data very fast, but the chart can be refresh at a low rate. (For your information, the frame rate of a standard DVD movie is 24 frames per second, and it already displays very smoothly, so it is normally not necessary to refresh the chart at a higher rate.)

Hope this can help.

Regards
Peter Kwan

  Re: display real-time waveform data
Posted by Khoa Nguyen on Sep-20-2016 07:45
Is there any example code?
The real-time example you have is not clear. Pardon my non-software engineering background.

  Re: display real-time waveform data
Posted by System Administrator on Sep-20-2016 14:44
Hi Khoa,

There are many programming language editions of ChartDirector for both desktop and web applications. Would you mind to clarify which programming language edition of ChartDirector you are using? Are you developing a desktop application (as opposed to a web application)? If you are using C++, please also inform me the GUI framework you are using (MFC or Qt?).

For desktop applications, the various realtime chart sample code can be considered as having 3 parts:

(a) Generate realtime data

(b) Drawing the chart periodically

(c) Handling user interactions (such as the "Run" and "Freeze" button, track cursors, zooming and scrolling, etc..

In the sample code, the data are stored in arrays. The "(a) Generate realtime data" is just some code to generate random numbers periodically to update the arrays. In your real code, you need to change the code to use your own method to update the arrays.

If you are using C++, consider the "Simple Realtime Chart" example:

http://www.advsofteng.com/doc/cdcpp.htm#realtimedemo.htm

The main code in "(a) Generate realtime data" is just the method CRealtimedemoDlg::getData, which is called by a timer every 250ms.

In the example I mentioned in my last email, we are getting data from a hardware data acquisition device, and due to the high speed and the nature of the device, the code involves multi-threading and interrupt handlers. This part of the code probably is not useful to other applications. Also, those code basically just demonstrates how to obtain data from the hardware device, not how to use ChartDirector.

Different applications can get data using different methods. Some of our customers obtain data using hardware data capture device, some from realtime data feed over the Internet, some by periodic polling, etc..

For your case, you would need to have some code that obtain the 2000 data values from your data source periodically, using code that is suitable for your source. Once you get the data, you can store then into the arrays. The "(b)" and "(c)" part above may only need minor changes (such as to change the number of lines plotted, etc), and you can have a working system. You can then modify (b) and (c) (change the chart type, colors, size, label format, etc) to get the chart you want.

Regards
Peter Kwan

  Re: display real-time waveform data
Posted by Khoa Nguyen on Sep-23-2016 06:17
Thank you for detailed explanation!

Is there any limit how many points can be graphed?
My array is 500k point.

  Re: display real-time waveform data
Posted by Peter Kwan on Sep-23-2016 16:30
Hi Khoa,

500K is not a large number of points to ChartDirector. We have tested 10 millions points and it still works. One thing to note is to remember to use "Fast Line Mode". See:

http://www.advsofteng.com/doc/cdcpp.htm#LineLayer.setFastLineMode.htm

Typically, for a line chart layer, you just need to add one extra method call:

layer->setFastLineMode();

Regards
Peter Kwan

  Re: display real-time waveform data
Posted by Khoa on Sep-24-2016 01:35
Understood!
I was able to chunk in 500k!
Thanks!