LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear XY Graph & Delete Old Data

Solved!
Go to solution

Hi there -

 

I have an XY graph that receives the time since start (x) and the temperature (y) at user-defined intervals (let's say 5 seconds). The graph starts plotting when the user presses a "Start" button and stops when the user presses the "Stop" button. [I know, how creative!] There is one loop that monitors the status of the buttons and then another loop in parallel that adds the current reading to the XY graph using Build XY Graph Express ("reset" is set to FALSE), and it uses "Elapsed Time" to space out the data points.

 

When the VI is running, I'd like the user to be able to start and stop multiple times. This means that the XY graph needs to be reset. I've tried a few methods, but they only clear the graph temporarily, and then when the next point is plotted, the old points reappear.

 

I've been searching all over for a solution to this, but have not been able to find one. I've tried reinitializing to default, writing an empty array to the graph, sending NaN to both x and y while setting "reset" to TRUE, and a few other variants. [An idea I had: is there a way to wipe all memory associated with a graph?]

 

My code would be much too confusing to post, so I hope you can help me with my description alone.

0 Kudos
Message 1 of 9
(11,632 Views)

Hi Quevvy,

 

a "Graph" only plots the data that are wired to it, it has no buffer ("memory") on it's own. All you have to do is to empty the array, that contains the plot data!

 

In case you're using an ExpressVI (aka "BuildGraph"): it has some inputs like "reset"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(11,624 Views)

To clear the accumulated data in the express VI, all you need is send a true to the reset terminal (See attached example). If this is not working for you, you need to show us some code.

 

 

Message 3 of 9
(11,620 Views)

@GerdW wrote:

Hi Quevvy,

 

a "Graph" only plots the data that are wired to it, it has no buffer ("memory") on it's own. All you have to do is to empty the array, that contains the plot data!

 

In case you're using an ExpressVI (aka "BuildGraph"): it has some inputs like "reset"...


Hi GerdW,

 

I don't know if you actually read my post at all, but I've tried emptying the array, but I still get the old data the next time I press start.

 

I am using the Express VI "Build XY Graph", and am using the "reset" input. But I want it to reset before adding the first data point, and then go back to no reset so that all points can be plotted.

 

I'm uploading a picture of how I emptied the graph and how the graph turned out after starting and stopping it twice.

0 Kudos
Message 4 of 9
(11,618 Views)
Solution
Accepted by topic author Quevvy

@Quevvy wrote:
I am using the Express VI "Build XY Graph", and am using the "reset" input. But I want it to reset before adding the first data point, and then go back to no reset so that all points can be plotted.

I'm uploading a picture of how I emptied the graph and how the graph turned out after starting and stopping it twice.

 


You picture makes no sense. The data is stored in the express VI, so sending a blank array directly to a property node of the graph will not do anything useful.

To make sure that the reset button goes back to FALSE after it has been read by the code, you should make it latch action.

 

Did you try my example above?

 

Your data seems to go back in time. That's interesting 😄

Message 5 of 9
(11,612 Views)

altenbach -

 

I did try your example. I thought I could not do that, due to the timing in my VI, so I just made a boolean variable and changed the value back to FALSE (via local variables) for the reset input on the Build XY Graph. After doing that, I think it did work. I still have to reinitialize the graph to default to clear the data right away.

 

As I understood it, I thought the "reset" input was to reset the points after it had built the graph, thinking I'd lose 1 data point (at least). Now, I don't think that's actually how it works, but I decided that losing 1 point would not be the end of the world (in this case). So, I guess I was wrong in my understanding, but now it's all figured out!

 

Thanks!

0 Kudos
Message 6 of 9
(11,592 Views)

@Quevvy wrote:
I am using the Express VI "Build XY Graph", and am using the "reset" input. But I want it to reset before adding the first data point, and then go back to no reset so that all points can be plotted.

Try something like this....

Message 7 of 9
(11,591 Views)

 


 

Your data seems to go back in time. That's interesting 😄


Haha, that was essentially my problem!

 

[Also, the "Time" is driven through a calculation, which "Start" would start over, hence the "back in time".]

0 Kudos
Message 8 of 9
(11,590 Views)
altenbach wrote:

Try something like this....


This is an interesting way to do it; what, with the feedback node and greater than. However, I think that what I've done is simple enough. It actually doesn't look like I'm losing any data points, so this isn't really an issue any more. But thanks though!

 

Thanks,

Quevvy

0 Kudos
Message 9 of 9
(11,584 Views)