LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I Update a XY Graph without erasing previous data?

Solved!
Go to solution

Hi,

 

I'm trying to make two XY plots in one graph but the data is not generated simultaneously, how can I add a new plot in the same XY graph without loosing the previous one.

 

I'm attaching my code to show you my problem...

0 Kudos
Message 1 of 4
(5,063 Views)
Solution
Accepted by topic author wilderi

see attached file which can demonstrate that.

when your plots dont have the same number of points then default values(0) will be added to plot which is having less number of points. you could write a code which adds NaN values to shorter array.

 

Secondly I will strongly recommend you to read some good programming practices, especially about Queued State machine. they can make your life much simpler. the current coding style you are having is bound to give you some problems in future.

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 2 of 4
(5,044 Views)

Wilderi,

 

The easiest solution is to first read back the data that is already plotted on the XY graph using one of a variety of mechanisms such as local variable, property node, or shift register on the main loop.  Second, build the proper structure with the read back old data and the new data.  Finally, update the plot with all of the data.

 

Dave

0 Kudos
Message 3 of 4
(5,036 Views)

Thank you both!

0 Kudos
Message 4 of 4
(5,000 Views)