LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Clearing XY Graph and plot

I have a designed a program to plot the frequency and the amplitude from the signal generator. The thing is when I re-run the program the plotted lines in the XY graph and plot are still remains in it. It's not clearing out. When I re-run the program, the new values are overlapping with the previous data. So, it's every time I need to close the window and open it again. Is there any solution for this issue?

0 Kudos
Message 1 of 5
(778 Views)

Hi jrengg,

 


@jrengg wrote:
Is there any solution for this issue?

Yes!

As a graph has no own data buffer you need to clear the buffer holding your plot data!

 

(In case you use a chart instead of a graph: clear the chart history using a property node. And next time please use the correct wording…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(767 Views)

Hi GerdW,

 

Thanks for you comment. I will check on it.

0 Kudos
Message 3 of 5
(749 Views)

A Graph shows what you write to it.  Try doing the following:

  • Program your VI and run it, putting data on the graph;
  • Stop the program.  Open the Block Diagram, find the wire going to the Graph object.
  • (Temporarily) delete this wire.  Right-click the terminal where it used to go into the Graph and select "Create Constant".  This is your "Eraser".
  • Detach the Eraser, and reconnect the wire you deleted in the previous step.
  • Now right-click the Graph, and choose "Create Property Node".  Choose the "Value" property.
  • Wire the Eraser to the Graph Property Node.  Find where you want to clear the Graph (if you've got a main While Loop that dominates your code, simply put the Graph + Eraser on the "input" side of the While Loop and wire the Error Out of the Property Node to the input side of the While Loop.  This forces (because of Data Flow) the Erasure to run before the main While Loop.

Bob Schor

0 Kudos
Message 4 of 5
(700 Views)

If you are building the graph data in a shift register, make sure it is initialized.

(An uninitialized shift register will retain data between runs.)

 

We can give significantly more specific advice if you show us your code. There are dozens of ways to chart xy data, and they all have different solutions.

0 Kudos
Message 5 of 5
(696 Views)