LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiplot xy graph

Solved!
Go to solution

I have a question about multiplotting a XY graph.

 

I deleted some of my vi to have more view in it. The XY graph I want to generate are P1 and P2 as X and Y and each plot is a flow. I can't get it right.

 

To work quickly I put 2 Slides in to represent those 2 pressures P1 and P2. Could someone please help me out.

 

 

0 Kudos
Message 1 of 11
(5,705 Views)

This is what I want to generate.

 

Untitled.png

0 Kudos
Message 2 of 11
(5,699 Views)

Hello Michel,

 

If I understand you well and given the above image, you want to plot your pressures P1 and P2 with respect to time, both curves on the same figure, right?

 

If that's correct, you don't have to use the XY Graph, which will generate a single curve, with P1 values as X coordinate and P2 values as Y coordinate.

 

Instead, you can use the Waveform Chart to plot your data. To have both pressures on the same figure, you can simply bundle P1 and P2 in a cluster and feed the chart with that cluster.

 

Please, let me know if that helps in achieving your goal.

Cédric | NI Belgium
0 Kudos
Message 3 of 11
(5,671 Views)

Thank you for your sesponse.

 

It's not in respect of time. P1 is for instance the X coordinate and P2 the Y coordinate. And that I need per flow.

 

So if you see the figure. P1 is intake pressure coordinate and P2 Crankcase pressure coordinate. The program will first generate the blue 60l/min curve and afterwards he will generate the red 120 l/min curve and ... .

 

Hope the problem is clear now and you have a solution.

 

 

 

0 Kudos
Message 4 of 11
(5,646 Views)

Hello Michel,

 

Sorry for my misunderstanding, I get the point now.

 

To have multi-plot in a XY Graph, you can feed the XY Graph with an array of clusters of plots, where each plot is an array of points and each point is a cluster that contains an X value and a Y value.

 

In your case, in your second For Loop (the internal one), you can bundle P1 and P2 values and concatenate this cluster in an array containing the previous points of the current plot (by using shift register). Then, in your first For Loop (the external one), you can bundle the array of the current plot in a cluster and concatenate that cluster in an array containing the previous plots (also with the help of a shift register). In that way, you will get at the output of that For Loop the array to feed the XY Graph.

 

If you want to refresh the graph with each new point, you then have to place your XY Graph inside the second For Loop (which is already the case in your VI) and feed it with a temporary array containing the previous plots plus a cluster of the array of the points already acquired in the current plot.

 

Is that clearer for you now?

Cédric | NI Belgium
Message 5 of 11
(5,639 Views)

 

Thank you for your reply.

 

In words it is clear to me but when I'm trying to implement your suggestions, I'm loosing control of what I'm doing.

 

The internal loop is ready I think but concatenate the cluster and array and etc is to much for me I think.

 

In attachment you'll find my try. Any suggestions and further help are more than welcome.

 

(I deleted some of the previous to get a better view on the changes to make)

 

Kind regards

0 Kudos
Message 6 of 11
(5,633 Views)
Solution
Accepted by topic author michel0101

Hello Michel,

 

To be complete, it is actually even simpler than what I explained in the previous post if you want the graph to be refreshed for each new point. Indeed, as the temporary array is equal to the final one, you have nothing to do in the external For Loop.

 

To make it clear for you, see the simple example in the image below:

 

sr_flow.png

Disclaimer: The example Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

 

Cédric | NI Belgium
Message 7 of 11
(5,626 Views)

Another thank you for your fast reply and help

 

I've done suggested solutions but it isn't working.

 

In attachment you'll find 'Flow' which is based on first solution and 'Flow2' on the second solution.

 

What am I doing wrong??

 

kind regards

 

 

Download All
0 Kudos
Message 8 of 11
(5,622 Views)

Hello Michel,

 

Flow2 is correct, except that you have to disable the indexing feature to the array in the internal For Loop. Indeed, here we don't want to browse the array element by element but we need instead the full array content at once. Look at the image above, the plain pink square (without brackets in it) indicates that we have a tunnel without indexing feature. Once this change is done, don't forget to update the constant outside the external For Loop otherwise you'll have wiring problems.

Cédric | NI Belgium
Message 9 of 11
(5,615 Views)

Thank you very much!!!!

 

kudos for you!! 🙂

 

Just for getting the picture. With the indexing tunnel he writes 1 value over and over and when it a full tunnel he writes a full array??

Am I getting it right?

 

Kind Regards

0 Kudos
Message 10 of 11
(5,608 Views)