LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How make one graph delayed in XY graph?

Solved!
Go to solution
I am using a XY graph, in which I bundle 2 arrays and then I'm building array and providing it to XY graph. So the values changes for each second. My requirement is to plot the graph as below. Consider there are 2 graphs in XY graph, at t=2sec, Graph 1 should be visible and Graph 1 of t=1sec should be visible too at t=3sec, Graph 1 should be visible and Graph 1 @ t=sec should be visible and t=1sec should go off, so on. Thanks. Posting the Picture of Block diagram, I'm not able to post the Vi cause I'm using sql server to fetch the data.
0 Kudos
Message 1 of 12
(3,457 Views)

If you want to have two visible datasets, in which the most recent, and the previous dataset are visible, you can use a shift register and drag the shift register down on the left side of the loop, to add an additional handle. Then, they give you the most recent and 2nd most recent datasets.

 

On the right hand side, as output, wire your most recent dataset. Note that this doesn't look that impressive if your dataset is just incrementally building on previous data - then the points will overlap. Below is a snippet that shows what I mean, for different random datasets each second. Each plot is visible 3 times (in white, red then green by default)

 

overlap.png

 

 


GCentral
0 Kudos
Message 2 of 12
(3,445 Views)

But it overlaps the data everytime, But i dont need that. The data shouldn't be visible when next data arrives.

 

0 Kudos
Message 3 of 12
(3,430 Views)

Can you try explaining what you want again, in terms of which plots at which times? The opening post wasn't very clear to me.

 

If you just want a moving scale, you can use a chart rather than a graph and set the x-scale width to 2 seconds with the appropriate update mode.


GCentral
0 Kudos
Message 4 of 12
(3,424 Views)

Is this related to your recent "blink" question?

 

You really need to first build a more solid foundation in LabVIEW programming in general. Try a few more tutorials, for example.

 

What's the purpose of he FOR loop? All that matters is the single result of the last iteration. If you would just delete the FOR loop completely, nothing would change.

What is the purpose of the flat sequence structure?

I assume you wrote the subVIs on the right. Wouldn't it make more sense if they would return the bundles directly?

 

It really makes little sense to attach a truncated picture. We cannot guess what else is there. Please either show the entire code or attach the VI.

It is confusing if you say "... 2 graphs in XY graph" You are probably talking about one graph with two plots. The wording is quite consistent in LabVIEW.

 

 

Message 5 of 12
(3,421 Views)

Sure,

In the above picture I have bundled the values as pH, Ts,Th etc.. so the bundled output I will be giving to Build array and giving it to XY graph. So I get the graph at every sec. What my need is to show the previous value and current value in the graph. Each second I need to display current value and previous value in the graph. But when I use Shift register the value keeps on accumulating in the graph. I dont need all those data to accumulate. I just need current data and previous data. Thanks.

0 Kudos
Message 6 of 12
(3,420 Views)

@dhanushmh wrote:

But when I use Shift register the value keeps on accumulating in the graph. I dont need all those data to accumulate. I just need current data and previous data. Thanks.


Have you tried? The posted code will show the current plot and the two previous plots. If you only want to see the current and previous, resize the built array to two inputs and shrink the shift register on the left to only one. Nothing "keeps accumulating". Try once more!

Message 7 of 12
(3,416 Views)

Neglect the first picture which I posted. I'm just checking with small program. 

There are 5 graphs shown below. In which I have altered some of them to color change and all. Now One in Brown is a constant curve and I dont want to alter those. The line which is in red in color (graph 4 and 5), So these lines should leave the previous data and should produce current data too. Btw, I have found the better method to blink the datapoints. and in Graph 2, you can see the overlapping cause of shift register.

Download All
0 Kudos
Message 8 of 12
(3,399 Views)

@dhanushmh wrote:

and in Graph 2, you can see the overlapping cause of shift register.


Because you are building the array forever. You are feeding all old and new graphs back into the shift register. Not only that, but you are also not initializing the shift register for some reason. Compare with the suggestion. This is different to the code shown you.

 

You need to build the current graph, feed only the new graph into the shift register. and then combine the old and new data for the graph.

(I would show you if you would attach your code. Why do you only paste images?)

 

... and your inner FOR loop still serves no purpose.

0 Kudos
Message 9 of 12
(3,390 Views)

Hi dhanushmh,

 

for your "pT graph" you are collecting plots using BuildArray in a shift register. This array of plots is growing unlimited with each iteration. Even more this shift register is not initialized…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,388 Views)