10-08-2012 04:17 PM
To clear an XY graph . . .
First I clear the graph by right clicking on the graph on the front panel > Data Operations > Clear Graph.
Once the graph is cleared, I right click on the graph on the front panel > Create > Property Node > Value and place the property node on the block diagram where you want to clear the graph.
On the block diagram, I change the property node to write by right clicking on property node > Change All to Write.
I then right click on the bubble that feeds the property node (Value) and Create > Constant.
It should have a couple of arrays of values with grayed out 0's. This will clear the graph.
Hope this helps. I keep forgetting this and have to re-figure out how to do this each time, so I thought I'd post this for my own notes.
LabVIEW really should make a property node that clears the graph!
Enjoy!
10-08-2012 04:29 PM
You probably noticed that you replied to a thread that is over 6 years old.
Your solution does not apply to the situation discussed here. The data of the xy graph is built inside a shift register, so clearing the graph with a value property node will not do anything permanent. The data in the shift register must be cleared like I show in the example above.
If you would use the "build xy graph" express VI and have it configured to retain data, you would simply wire a TRIE to the reset input.
Your procedure is overly complicated. Why clear the graph manually first if you later clear it anyway with a property node? Unlike charts, xy graph don't retain data, so why would you need a value property node (a local variable would work the same, but would be more efficient).
Simply wire an empty array to the graph terminal directly if you don't want to show any data. Your code seems to fight for the graph from two different locations (terminal and value property node), leading to race conditions and unpredictable results.
10-09-2012 11:28 AM
It's true that you need to clear out any shift registers.
I don't use the Build XY Graph express VI. I'm giving a general case as to how to clear the graph. If you don't want to use it, then you don't have to. My XY graphs retain data from the last time the program was run. My code sometimes runs for an hour with the old XY chart data that should be cleared, so I have to manually clear it at the beginning of my program. The XY graph doesn't plot until the end of my program. The problem with reinitializing to the default case is that I often use under the Edit menu, Make Current Values default and the old graph would keep reappearing.
I cleared the graph first so that when I run a constant into the XY graph, it gives me an array of empty values. I have multiple graphs feeding into my XY graph (clustered then arrayed), so the format to this array of empty values was a multiple dimension format that is difficult to reproduce in LV. This method works great and is not overly complicated and you don't have to use the express VI's blackbox.
It's true that once my program gets around to graphing, that the old data is replaced by the new data. But like I mentioned before, this may be a long time at looking at old data that doesn't pertain to the current data, so I like to clear it when the program first runs. Since I'm not using shift registers, I can't simply clear the shift register.
10-09-2012 12:01 PM
If you are not using shift registers, and if you are not using waveform charts, and if you are not using the Build XY graph Express VI, then there is no way that your graph can be maintaining old data.
So if you think are are maintaining old data, please post your VI so we can see how you are doing it.
10-09-2012 12:10 PM
@BradJ17 wrote:
If you don't want to use it, then you don't have to.
Ah, thanks for allowing me that option, I was worried for a second. 😄
If you think you have a good idea, I don't see the point of tacking it to the end of an ancient, marginally related thread. I recommend you write it up as a nugget or micro-nugget in the breakpoint. Add a few pictures or even an example.
As I already said, I think there are better ways if the code is correctly architected, but that's just me. 🙂
10-09-2012 12:17 PM
@OriolesFan wrote:
So if you think are are maintaining old data, please post your VI so we can see how you are doing it.
Any control or indicator retains data in the control itself as well as in the transfer buffer. That's why the graph remains, even if you stop writing to it or even stop the vi. I think that's what he was talking about.
10-09-2012 01:29 PM
@altenbach wrote:
@OriolesFan wrote:So if you think are are maintaining old data, please post your VI so we can see how you are doing it.
Any control or indicator retains data in the control itself as well as in the transfer buffer. That's why the graph remains, even if you stop writing to it or even stop the vi. I think that's what he was talking about.
If that is what he is talking about, it wasn't clear. It sounded like he is trying to clear the control while the VI is running, and that writing empty data to the graph wasn't permanently "clearing" the graph. That old data would reappear in his graph while it was running.
10-09-2012 01:35 PM - edited 10-09-2012 01:39 PM
Form the description in the last paragraph, he is starting the VI (still containing old data from the previous run), but it will take a long time before the graph actually receives data and the stale data is displayed, potentially confusing the user. Thus he's clearing it when the program starts....
A much simpler solution to this would be to go to "VI properties...execution" and enable "clear indicators when called". Now all indicators, including the graph, will be cleared automatically with every new run. 😄
Nugget worthy? Maybe!
05-14-2014 06:57 PM
Just want to say thanks. I am stuck on this problem for amost 1 month. I even tried to call NI phone service but with little results.
02-22-2015 06:25 AM
Thanks..it helps me alot