LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Plot while the program is running

Hello,

 

For a project I am working on during my studies I am trying to plot the date from two sensors in an xy-plot.

My problem is that the programm only shows me the complete graph after I stopped it.

Previoulsy I had the xy-plot inside the while-loop but then it always overwrote the plot point with the new one and it didn't save the old one.

My goal is that the xy plot shows all the data I am gathering while the program runs.

This is my first time working with LabView so any help would be great.

 

I am on Version 20.0.1f1 of LabView

 

- FloJ

0 Kudos
Message 1 of 5
(885 Views)

Please review the LabVIEW Help (press Ctrl-H and hover over the control then click the link) to see the difference between a Graph and a Chart. Charts keep their own history, while Graphs need all the data given to them each time. You have to buffer the data yourself (by building an array inside the loop and writing that to the XY Graph) in order to see the entire history. (edit: fixed a typo)

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 2 of 5
(881 Views)

Hey,

thank you for the response.

At the moment this is what I am doing.

I´m building two arrays within the loop and sending them to the xy-graph.

As soon as I press the stop button the graph shows.

I want to know if it is possible for the graph to show the new data points whenever a new one is aquired.

 

-FloJ

0 Kudos
Message 3 of 5
(835 Views)

It works now,

found a simple solution.

As I tried before, I put the xy plot inside the while loop.

But I forgot to connect the shift registers.

 

0 Kudos
Message 4 of 5
(854 Views)

@FloJ wrote:

found a simple solution..

 


Dataflow of course dictates that the while loop only outputs data when the loop has complete, so to have live updates, the graph terminal needs to be inside the loop, of course.

 

Your solution is not "simple", but contains a totally bewildering array of unnecessary array operations (see also).

 

To append to an existing array, you use built array. If you use a complex array (X=RE, Y=IM), all you need is one shift register and a built array node. (Not sure why you made your graph a type definition. You need to disconnect it to accept a complex array instead)

 

altenbach_0-1663865277673.png

 

 

There are plenty of other questionable code constructs.

  • Wouldn't it make more sense to append the xy data to one file instead of two files, one for x and one for y? Open a file once before the loop, append one formatted line per iteration, and close the file after the loop.
  • You can get rid of all express VIs. There is a wait primitive.
0 Kudos
Message 5 of 5
(830 Views)