From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing plot color of graph based on conditions

Solved!
Go to solution

Hi!

I've been struggling with a labview project where you need to change the plot color of a graph based on the seconds that need to be ignored,(see attached image) The seconds in the beginning and end and some in between need to be ignored/shown in red.

My idea is to use the select tool to determine the plot color of the xy graph, not shown in image. If I do this I can't determine plot color of the graph for the slices to ignore because it is a 1D array. How do I fix this?

Thanks!

 

0 Kudos
Message 1 of 9
(4,937 Views)

You can use a graph with two plots of the same data, make parts of one or the other NaN to only show one of the colors.

 

0 Kudos
Message 2 of 9
(4,929 Views)

I'm stuck at the part where I use my 1D array as an input to the select tool, it gives me an error. Is there a way to connect the 1D array as an input to the select tool?

0 Kudos
Message 3 of 9
(4,921 Views)

I am stuck because you don't attach your code. 😄

 

I won't even guess what you are trying to say, but a select tool only accepts scalars for the selector input. You could wrap a FOR loop around it of course, but that won't solve your primary problem.

0 Kudos
Message 4 of 9
(4,914 Views)

Sorry about that! Here's the code. 

The input to my graph is set by the user which I'm getting from the settings typedef. One of them is the 1D array. The seconds that are specified in that 1D array is like a segment of the test that needs to be highlighted in red, example from the 5th second to 9th second. How do I highlight this in the graph? 

Also, when I try to create a cluster or an array of the three inputs(seconds ignored at start, end and the 1D array of slices to ignore) so I can feed that into a graph I can't. Am I going about this correctly?

0 Kudos
Message 5 of 9
(4,910 Views)

This is more of a tip, rather than an answer to your question.

 

You really should come up with a shorter name for your cluster controls.  As a programmer, you know which control needs to be unbundled (if you have a good naming convention).  No need for a long sentence describing the control as the name of the control.  Use the caption or tooltip for that purpose. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 6 of 9
(4,905 Views)

Thank you, I will remember that. I'm still really new to labview and I appreciate all the help I get from this forum.

0 Kudos
Message 7 of 9
(4,903 Views)
Solution
Accepted by topic author Ben-Da-Nee

I won't be dissecting all your code and try to decide which the several graphs you are talking about, but here's what I had in mind.

 

TwoColorXY.png

 

 

Message 8 of 9
(4,883 Views)

Thank you! That was really helpful 🙂

0 Kudos
Message 9 of 9
(4,875 Views)