LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to produce an XY Graph within a While Loop that adds a new XY point to the graph after each while loop iteration

Solved!
Go to solution

I would like to plot data using the XY Graph as a visual display. I have a While Loop that creates a new X and Y point during each iteration. I need the XY graph to be in the While Loop, since once the stop command has been pressed the While Loop sis finished and the final graph must be displayed. The problem is that following each iteration, the visual display of the XY Graph clears and shows the new point, versus adding the new point to the previous one with a line connecting the two points. This works perfectly if I move the XY graph out of the While Loop except it only shows the XY Graph following the completion of the While Loop. I would like to visually see the updated XY Graph while the While Loop is running. Any help would be very appreciated.

 

Thanks 

0 Kudos
Message 1 of 6
(11,829 Views)

You could use the iteration terminal to index an array that could then update the graph inside the while loop.

 

Bill

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 6
(11,825 Views)

billko wrote:

You could use the iteration terminal to index an array that could then update the graph inside the while loop.

 

Bill


Did I really say "index?"  I meant to say create/update.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 3 of 6
(11,815 Views)
Solution
Accepted by topic author TravisW
You can add data one point at a time to a Chart, for a Graph you need to pass the entire dataset.  I'd use a couple of shift registers in your while loop.
Message 4 of 6
(11,813 Views)

I'm facing the same problem and I find this solution extremely interesting.

The only problem I have with this one is that the x-axis (time scale) depends on the loop speed.

The numbers displayed on the x-axis are iteration numbers and this is not the actual running time.

 

Is there a way to put the actual time, independent of loop speed (in this case 250ms) on the x-axis?

 

Thanks in advance,

Bart

0 Kudos
Message 5 of 6
(8,600 Views)

@BartVM wrote:

Is there a way to put the actual time, independent of loop speed (in this case 250ms) on the x-axis?


Just do a little math before adding the value to the first array...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 6
(8,596 Views)