LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do a real time plot with all data points

Solved!
Go to solution

I am a beginner in LabVIEW programming and in one of my VI's I need to plot measurement values in real time while keeping all values since the beginning, something like an infinite buffer. I have done that by appending each new measurement to an array and using a waveform graph, but I can't help but think that this is a highly inefficient method, so I would like to know if there is a better way to do that. I didn't have much success in my research so any help is welcome.

Thanks in advance.

0 Kudos
Message 1 of 7
(9,783 Views)

Be careful how you use the term "Real-Time", as it has a precise meaning that is (I think) different from what you want.

 

You talk about an "infinite buffer".  How big is "infinite"?  Bigger than the memory on your PC (say, 16GB)?  Bigger than a large disk on your PC (> 1TB)?

 

How much data is coming in, and how fast?  [This has a bearing on "infinite", since it takes an infinite time to collect data being acquired at a finite rate].

 

What do you really need?  Do you need access to all of the data while you are acquiring it?  Do you need to view all of the data "all the time", or is it enough to see, say, the last 1000 points as they arrive, making sure that all of the data are being saved so you can go back and look at everything?

 

Assuming you can look at the last 1000 points and want to "save everything" to enable you, after the fact, to see the first 15 minutes of a 2-week recording session, I'd suggest the following:

  • Use a Chart to plot the data as it appears.  Configure the Chart so it shows the last 1000 points you give it.  Note that to see the chart in full fidelity, you need a monitor with at least 1000 pixels width (maybe more like 2000 to give you a little "wiggle room").
  • As the data come in, stream it to a disk file.  Open the file before you start acquiring data, write to the file as you acquire, and close the file when you stop acquiring.  This will have a minimal impact on your code (as far as time is concerned).

Bob Schor

0 Kudos
Message 2 of 7
(9,755 Views)
Solution
Accepted by topic author mah.diou95

You can just use a waveform chart. This type of display keeps a history of its data. Delete all the array stuff and just wire your data (single point of data) into the chart indicator.

Other things:

1) Set the chart history length (right click option) to a number higher than you want to keep.

2) Turn on the X scrollbar in visible items, to scroll back

3) Clear the chart using a property node at the start of your program. 

 

See attached where I have done all this, with chart length 10^6

 

If you need to do other things with the data, then the answer could be different.

Ian
LabVIEW since 2012
0 Kudos
Message 3 of 7
(9,753 Views)
Hi Bob, Thank you for your answer. To clarify, what I need is to view all of the data all the time. It does not need to be accessed during the program. The measurements are done every second and the duration is not determined. I think I misused the term 'infinite'. The tests will not run long enough to fill the ram of the computer.
0 Kudos
Message 4 of 7
(9,749 Views)

thank you IanSh,

I used your solution with some little modification: now the x-axis is auto-scaled. that's what I wanted to get from the beginning.

0 Kudos
Message 5 of 7
(9,744 Views)

Hey Bob, How to configure the Chart so it shows the last 1000 points you give it then overwrite on the previous data? 

0 Kudos
Message 6 of 7
(4,458 Views)

Hi Shinawee,

 


@SHINAWEE wrote:

How to configure the Chart so it shows the last 1000 points you give it then overwrite on the previous data? 


Set its history length to 1000 samples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(4,411 Views)