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

Message ListMessage List     Post MessagePost Message

  Realtime plot serial port data in multiple charts.
Posted by Oliver Smith on Mar-30-2023 07:58
Attachments:
Hi Peter

At first, I would like to thank the team that created this wonderful software.

I want to create an application in Qt that plot data of a vehicle such as position, velocity, vibration and etc. The scheme of this app is similar to qtdemo, so that each branch of treewidget plot one group of data.
All of these data have read from serial port each 250msec and storing in a structure.
I am using realtimeviewport code sample to plot data, but I have some problem.
1) How can I run all charts in each tree item and when I click on an item the real time chart of that item will be displayed? (the chart should be update real-time on background)
2) How can I use randomwalk class to set data of each chart? (randomwalk dataHandler get all data)

my sample code has been attached.
I would appreciate if you help me to solve these problems.
Thanks
Oliver
qtdemo_test.rar
qtdemo_test.rar

82.97 Kb

  Re: Realtime plot serial port data in multiple charts.
Posted by Peter Kwan on Mar-30-2023 23:30
Hi Oliver,

1) You do not need to plot any chart that is invisible. You only need to read all the data and store them in data arrays. When the user clicks on the tree branch, you can plot and update the chart with the selected data.

The following is a simple example using checkboxes to select the data to plot. For your case, you can use a tree widget to select the data to plot.

https://www.advsofteng.com/doc/cdcpp.htm#zoomscrolltrack2.htm

2) In the sample code, the randomwalk generates random data for 2 data series. You can modify the randomwalk to generate more data series. The dataHandler always reads all the data series and store them in arrays, regardless of which data series are visible. The charting code will plot the data that are selected by the user using the tree widget.

Best Regards
Peter Kwan

  Re: Realtime plot serial port data in multiple charts.
Posted by Oliver Smith on Apr-01-2023 22:14
Hi Peter
It was good solution.
Thanks.