LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph Reset (clearing the graph using a button while the program is running)

Solved!
Go to solution

Hi all,

 

Could anyone please tell me how I could insert a button under my graph in such a way that when the button is pressed (while the program is running) clears the plot In the graph area?

 

Thank you!

0 Kudos
Message 1 of 9
(8,620 Views)

What sort of architecture do you have? Can you upload your VI?

 

The most immediate suggestion I have would be an Event Structure in a loop (maybe you already have this) with a Value Change event for the Clear button, and then wiring an empty array/array of waveforms/whatever datatype you're plotting to the graph. Below is a very rudimentary example (it is a snippet - you can drag and drop it onto a block diagram):

Example_VI_BD.png


GCentral
Message 2 of 9
(8,591 Views)
Solution
Accepted by topic author Datta108

If you use the "build xy graph" express VI, wire a latch action button to the "reset" input.

Message 3 of 9
(8,584 Views)

You can also use the invoke method 'Reinitialize to Default'. But that will only work if the Default value of the graph is a cleared graph. So - if you changed that default value in the past - you would first need to right click the graph in the front panel -> 'Data Operations' -> 'Clear Graph'. Then right click it again -> 'Data Operations' -> 'Make current Value Default'. Finally right click the graph a third time and select 'create' -> 'invoke node' -> 'Reinitialize to Default'.

 

Message 4 of 9
(8,577 Views)

@User002 wrote:

You can also use the invoke method 'Reinitialize to Default'. 


That would only work if you never write to the graph again. If you save the graph data in a shift register or in the express VI mentioned, all old data would come back on the next write to the terminal. Less useful. This needs to be solved from the data side.

 

 

Message 5 of 9
(8,568 Views)

Thank you for the cue, I thought that would work. I use the 'Reinitialize to Default' at program start to set all FP elements back to default at once. That works pretty good for me. I have to admit, I have never put that method in the middle of a program. But I´ve also never used the mentioned express VI or a shift register to save the graph data.

Message 6 of 9
(8,525 Views)

Thank you so much for the snippet. I found a much simpler way to do it. But I am anyway going to try this method out too! Just for practice.

 

0 Kudos
Message 7 of 9
(8,484 Views)

That's just what I did after posting the thread! Thanks! 🙂

0 Kudos
Message 8 of 9
(8,482 Views)

@Datta108 wrote:

Thank you so much for the snippet. I found a much simpler way to do it. But I am anyway going to try this method out too! Just for practice.

 


You're very welcome. Shift registers can be used very easily to hold data, especially when you want to do something with it in multiple cases of a case structure, like in a State Machine.

 


GCentral
0 Kudos
Message 9 of 9
(8,478 Views)