LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can't clear xy graph

Hi, I'm using a xy graph. Can 'clear' the graph by writing empty arrays to it. After writing empty arrays to the array locals of the xy graph; the data is still plotted (together with next plot) with a line from the last old data point to zero and from here the new data starts to plot. I can only get the graph truely cleared by restarting the app. Please help! I've now spent hours and many ideas and still can't get the desired effect. Any help will be great, Madri
0 Kudos
Message 1 of 10
(5,018 Views)
can you use the Reinit To Dflt method ??
Message 2 of 10
(5,018 Views)
You can 'clear' a graph by writing empty arrays to a local variable, but it sounds like you aren't reinitializing/emptying the data arrays that you normally feed to the graph. Somewhere in your VI(s), you just need to replace the arrays of old data with empty arrays. Ask if you need a demo.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 3 of 10
(5,018 Views)
Madri,

Interesting!

The Express xy Graph works as you describe. Writing a True to the Reset input will clear the graph. (LV 7.1)

The standard xy Graph can be cleared by writing empty arrays.

The retained data is explained if you convert the Build XY Graph.vi from an Express VI to a standard VI and open its diagram. When resetting, it writes an empty array to the graph. When writing data to it it appends the data to the previously written data.

If you want to modify this behavior, be sure to save your converted copy of the Build XY Graph (modified).vi with a different name. If you change it and save it with the same name, the next time you get a LabVIEW update, you could lose the changes and any other NI VIs which call this VI may not work as inte
nded.

Lynn
Message 4 of 10
(5,018 Views)
I have tried it from an example I found here in forum, but it also clears the graph and then starts to draw new data together with the old. Maybe I do something wrong - could you give me an example? That would be great! Madri
0 Kudos
Message 5 of 10
(5,018 Views)
Hi, Donald.
Yes, that is what I think is the problem, but to fix it - 0' the shame! I'm using local variables of arrays to draw the xy graph (in one part of the program) and at the moment I clear these arrays by writing empty arrays to their locals in an event structure. This does not seem to be working, but I could be doing something wrong. A demo would be great, for I'm probably not experienced enough to follow instructions only. Thanks for the help, Madri
0 Kudos
Message 6 of 10
(5,018 Views)
Hi Madri,
Forget about any shame.
"I'm using local variables of arrays to draw the xy graph (in one part of the program) and ... I clear these arrays by writing empty arrays to their locals in an event structure. This does not seem to be working"
The demo I did yesterday is trivial and probably won't be much help ... sorry. I think it would be best if you could post your VI or a cut down version of it (or a screenshot). Obviously, something in your use of an event and local variables is not working. A lot depends on your program structure ... maybe it's just race conditions.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 7 of 10
(5,018 Views)
Hi Donald,

Thank you for the example - you are right it's not much like my program, but it did show me were my mistake could be. Took me a while to correct, but all is well that ends well. The graph was clearing, but only for one instant like in your example - I had 'a bad line'. I'm still very new to LabVIEW and some of the basics are still not quite there - thaught you could clear the graph by writing to its local. Now I know.

Thanks again for the help AND quick responce,
Madri
Message 8 of 10
(5,019 Views)
the sample is good.thank you.it just  solve my problem.thanks again
0 Kudos
Message 9 of 10
(4,611 Views)

DO remember to see the date of this thread, it is 3 yrs old... !

But, if this is your problem, then the Reinint to Default method of the XY Graph works correctly.

- Partha ( CLD until Oct 2027 🙂 )
Message 10 of 10
(4,556 Views)