LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

access plot colors programmatically

My problem isn't too many plots, but a problem  still the same.  My vi gives the user the ability to turn on or off any one of three channels of data.  LabVIEW always assigns the colors to whatever order the channels are turned on.  For example, if the colors are correct for the present display, channels 1,2 and 3, then the user turns off 1 and 2.  Then when they turn channel 2 back on, leaving channel 1 off, channel two now has the color originally assigned to channel 1!

I have tried the property node, but it won't work when assigned to a channel for the above reason.  So, I am trying to assign it to plot name.  Doesn't work.  Still reverts back to assigning colors based on channel number.

 

0 Kudos
Message 11 of 30
(814 Views)

Hi,

 

hide the plots (property "Visibility") or make them transparent (property "Color")...

Best regards,
GerdW


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

GerdW,

Thanks for the rapid response.  Still doesn't work.  No matter what channel I turn back off after turning them all off, it takes on the color of the first plot.  It won't allow me to assign a given color to a given channel.

Ron

0 Kudos
Message 13 of 30
(811 Views)

Hi Ron,

 

maybe you should attach your VI for further analysis?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 30
(808 Views)

GerdW,

Here is a diagram of what I set up to turn individual channels on and off.  Every attempt I have used to give the user the ability to turn 'on' or 'off' any individual channel, the vi always assigns the colors based on the order they were turned on.  It even highjacks the cursors and reassigns them in the same order, not leaving them as originally assigned to a given channel with a given descriptor.

Ron

0 Kudos
Message 15 of 30
(804 Views)

I know you folks have helped me in the past.  I want to incorporate this scheme to control the plot colors in my vi.  I have 7.1 and can't remember how to create the color boxes.

My vi is very simple as far as colors go.  I have a total of six traces.  i have given the user a radio button to turn on or off any channels they desire.  My problem is that LV automatically is assigning the first channel to 'blue', regardless of which of the six is turned on.  I want to assign blue to the first channel in my data list, red to the second and so and and have it stay that way.  This thread appears to have the answer, but I can't get the color boxes for the array control.

Regards,

Ron

0 Kudos
Message 16 of 30
(794 Views)

To all,

I have successfully created a array color box for six plots.  Here is the problem I still have.  The colors in the array box are six distinct colors.  I have six toggles that will turn on or off any of the six traces going to my plot.  The problem is that the colors are being assigned in order of turning the channels on and off.  I want to assign 'red' for example to channel one, even if channel one is toggled 'off' to the plot.  So, I want to assign a distinct color to each of six channels and not have them changed based on the order in which they are turned on or off.

Ron

0 Kudos
Message 17 of 30
(791 Views)

Here is my logic for turning individual channels on and off.  As you can see, the user at any time can have on or off any combination of channels.  My problem is still that the plotting routine attaches a color to the first plot, regardless of which channel it is.  The second gets the next color, etc.  I want the color to stay with the specific channel.  So, I want PEA to always be RED.  I want PEV to always be GREEN etc.

I have tried all of the suggestions and they all end up doing the same thing.

 

0 Kudos
Message 18 of 30
(786 Views)

Hi rwbrook,

 

The other suggestions are on the right track for what you want, that's definitely the right way to set different colours for different plot lines. The difference in your situation is that you want the array to be different based on what channels are being plotted.

In each true case, add an array with a colour block of the desired colour. In each false case, add an array with an empty colour block. Wire all of these outputs to an Insert Into Array function. This will build an array of only the colours in cases that are currently true. If N channels are on, only the N first indices of the array will the populated with the correct colours. You can then wire this array into a for loop for graphing all your channels, as shown in previous examples in this thread.

I attached screenshots of a simple example VI to help clarify the implementation and functionality.

 

 

I hope this helps!

 

Emily C
Applications Engineer
National Instruments
Download All
0 Kudos
Message 19 of 30
(765 Views)

Emily,

Thank you for your input.  I believe you are correct.  I still can't get repeatability on the channel colors using just property nodes.  They appear to never stay put.  I will try your method with the array.

Ron

0 Kudos
Message 20 of 30
(753 Views)