LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fixed number of datapoints on graph/chart

My VI reads data from temperature sensor ( RS232 connection). Time between 2 data points can be from 1s to 5min (user selects period). On X axis is date/time ( 2005.01.25 10:11:12 ). I would like to have fixed number of datapoints on graph (independant of time between datapoints)
0 Kudos
Message 1 of 7
(2,745 Views)
Since a graph is built from an array, if you keep the array at a constant size, the number of points will not grow. To do this, use a FIFO queue. Once your array gets to the proper size, remove the first element and insert a new element at the end for every data point.

___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(2,740 Views)
Attached simple VI. Could you please modify it so that I could have fixed number of datapints on chart, independant on time between datapoints.
0 Kudos
Message 3 of 7
(2,719 Views)
I'm not aware of any way to do so programitically - the property X-Scale>>Range>>Maximum seems to determine this, but it also seems to have some strange relationship with the chart history length setting. I don't have time to test this further at the moment, so I suggest you either experiment yourself, use a graph instead of a chart like I suggested eralier or wait for someone else to answer this. I would like to know how these properties work for charts.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(2,706 Views)
But with graph I dont have history and x scrollbar ? I absolutely need them.
0 Kudos
Message 5 of 7
(2,702 Views)
The history and scroll functions can easily be implemented in a graph by keeping your data in a bigger array and only showing some of it in the graph and by using a slide control to choose which part of the array you want to display. I will try to play with this over the next few days and see if I can come up with something. I suggest you do the same. Hopefully one of us (or someone else) will come up with an answer.
Until now, every chart I remember using showed a constant length of time. If I needed to change this, I would change the format to floating, put 0 at the start, the number of seconds I want at the end and then change the format back to time. This is inconvenient, but at least it works during development.

___________________
Try to take over the world!
0 Kudos
Message 6 of 7
(2,701 Views)
There is an example in the tutorial ”Managing Large Data Sets in LabVIEW“ that does almost exactly what you need. Download the code and look at GLV_GigaLabVIEWMemoryStoreAndBrowse.vi. You will need to modify the functional database to hold both X and Y values or an array of XY clusters. Replace the generation with your data acquisition code. You may also want to add some other data to the functional database, such as current valid points. Good luck.
Message 7 of 7
(2,688 Views)