LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to use XY chart buffer to chart several times

I am trying to have a chart dynamically update through three seperate "for" loops. However I'm having a problem where I can use the XY chart item only once (within the first loop). I've tried to use a local variable at the second loop to continue updating the chart but the chart clears when this occurs. I'd like any ideas how to do this please!

Notes: I'm using "XY Chart Buffer.vi" within the loops to capture the plots. The three loops need to plot to the same plot line. Each loop sets a different part of the plot along the X-axis.

Thanks! Nick
0 Kudos
Message 1 of 5
(2,602 Views)
Hi,
actually it would be much better if you send the example of your VI here.
But it looks like you refresh graph data after each of your loops. In other words if you have created local variables of graph and wire new data to it after all the loops then each update of variable will delete previous data.
What you need is to add new data to the previous ones. To do it you must use "Build array" function to add XY arrays from loops to arrays received from all the previous loops. And only after this you can organize this arrays into clusters an wire them to XYGraph.

The example is attached.

Good luck.

Oleg Chutko.
Message 2 of 5
(2,602 Views)
Hello Oleg,

Thanks very much for answering and providing an example! Unfortunately I need a more dynamic update to the chart... the plot points take about 15 seconds each to gather from external devices (there's about 2000 of them), and the user needs to see that the test is working as it runs. What I'm trying to do is update the graph on a point-by-point basis, ie within the "for loops" in your example rather than after each loop. Do you think this is possible?

Thanks again, Nick
0 Kudos
Message 3 of 5
(2,602 Views)
Nick,

You can use Oleg's advice, and just add a single point to the array each time rather than appending another entire array. You could acquire the point and add it to the array each time the loop iterates, and display the updated graph each time. A great way to do this easily is by using shift registers. I modified the previous example slightly and configured it so that you can see the updates in real-time. I hope this helps!

Liz Fausak
National Instruments
0 Kudos
Message 4 of 5
(2,602 Views)
Thanks Liz, you're a star... this is just what I need. I owe you a beer!
0 Kudos
Message 5 of 5
(2,602 Views)