06-23-2017 09:49 PM
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!
Solved! Go to Solution.
06-24-2017 12:08 AM - edited 06-24-2017 12:15 AM
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):
06-24-2017 12:51 AM
If you use the "build xy graph" express VI, wire a latch action button to the "reset" input.
06-24-2017 01:24 AM
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'.
06-24-2017 02:33 AM
@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.
06-24-2017 03:53 PM
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.
06-25-2017 01:08 AM
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.
06-25-2017 01:09 AM
That's just what I did after posting the thread! Thanks! 🙂
06-25-2017
01:11 AM
- last edited on
05-13-2025
03:44 PM
by
Content Cleaner
@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.