Hey Everyone,
I am looking at creating a simple 2D Line Chart.
The data shall be connected from a sensor through a serial port, after every few seconds, 10 times and updated into a ListBox.
I would like to plot the data onto Line Chart. The first column is the X-Axis and the 2nd Column the Y-Axis.
Also I would need the graph to be updated on the go, that is after every reading, the data should be updated in the Graph ( FYI - its currently updated in the ListBox on the go).
Can anyone please help me proceed.
Thanks,
Gaurav
ChartDirector makes charting incredibly easy. To update the interface you will need to use a thread. Checkout the Xojo thread example project,
We have over 200 sample projects and a couple of blog posts, e.g. here: A special chart with our MBS REALbasic ChartDirector Plugin
First you would define an array with e.g. 1000 values, which you initialize to CDBaseChartMBS.kNoValue. When values is added, you append it to the end and remove first one. So you always have last 1000 values in an array.
Every few milliseconds you have a timer to render new chart with those points and show it.
See “simpleline realtime” example project.