LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with multiple plots on XY Graphs depending on certain conditions

Solved!
Go to solution

Hi, I have a question about manipulating an XY Graph.

 

1) Everytime the plot crosses the x-axis for y-value going upwards, I want the plot to change color, until it crosses the 0 again going upwards, and I want that specific portion to have a different color. It is really hard to explain this so I'm going to post a picture: 

 

[URL=http://img691.imageshack.us/i/xygraphexample.jpg/][IMG]http://img691.imageshack.us/img691/4540/xygraphexample.jpg[/IMG][/URL]

 

As you can see, if the graph crosses the x-axis while decreasing, it shouldn't change colour. Only increasing.

 

I cannot figure out how to do this. I know it will require multiple plots, but how would I randomly change the color as well as detect if its crossing it going upwards or not.

 

Any help would be appreciated.

 

Thanks

0 Kudos
Message 1 of 10
(4,208 Views)

Hi Bilal,

 

you can attach pictures here in the forum directly, even embed them in the text. No need for 3rd party servers as they might even be blocked for other users...

 

How to check for positive crossing x axis?

Simply check for "x(t-1)<0 AND x(t)>=0" to detect such an event.

 

How to add plots?

You need an array of plots. So you have to split your data into several subarrays, arrange the subarrays to plots, then build an array of plots. It's much easier when you first collect all data, then search the interesting crossing points to analyze the data Smiley Wink

Best regards,
GerdW


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

You can use the trigger and gate express VI to quickly find all rising zero crossings.

 

Initialize an array of NaN that is the same size as your original data.

 

Then drop in the triggered sections

 

here is a quick example I cobbled together - you should get the basic idea

 

fp.jpg

 

 

bd.JPG

0 Kudos
Message 3 of 10
(4,184 Views)

Hi.

 

Do you think you could post that VI file.

 

Also, what if my x-axis is not at 0, and is user configurable?

0 Kudos
Message 4 of 10
(4,166 Views)

sorry - I didn't save the VI that I made - you should be able to duplicate what's shown in the jpg.

 

For the false case, when no more triggers are detected, just take the remaining portion of the original array.

 

And yes, the trigger level can be user configurable - just make a control and pass it into the trigger and gate function for the "Threshold"

0 Kudos
Message 5 of 10
(4,147 Views)

Hey, thanks it works now.

 

One problem is that there is a gap between the first triggered set of data and the second. It gets cut off at the x-axis, and the next point is like 0.12 or something, so it starts off a bit above the axis so there is empty space between the two triggered plots.

 

Is there any way of avoiding that?

0 Kudos
Message 6 of 10
(4,144 Views)

Also, I can't seem to find a "Threshold" terminal. All I see is an option for having a manual trigger, but nowhere to configure it.

I never use express VIs so sorry if the question sounds dumb.

0 Kudos
Message 7 of 10
(4,143 Views)
Solution
Accepted by topic author Bilal_J

OK - lucky I'm not too busy today ....

I usually don't use express VIs either, but was just looking for a quick solution for you.

here is the sample done with just the basic trigger function - no express VI.

Also added a user selectable threshold.

 

 

Next,  regarding the space between plots, if there is no data in the original, there will be no data in the colors either.

see second attachment

 

Download All
Message 8 of 10
(4,128 Views)

sorry the jpg had only the false case shown - here is an image of the true case also

 

0 Kudos
Message 9 of 10
(4,126 Views)
Thanks a lot. It worked perfectly!
Message 10 of 10
(4,097 Views)