LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keeping plot colors with the right data

Solved!
Go to solution

I have a vi written in 7.1 that has three traces in one plot.  I have selector radio buttons so the user can turn on or off any channel.  The problem is the color of the trace is automatically grabbed by the vi and chooses the colors based on which trace is turned on first, second and third.  So, if the user turns off all of the channels and then turns them on one at a time, from top to bottom, they are correct, green, blue, and then red.  But, if they turn them on from the bottom first, then the first and third traces no longer follow the plot color legend.  Basically, I want to know how to lock a plot color to a given channel.

Regards,

Ron

0 Kudos
Message 1 of 20
(2,937 Views)

I can't vouch for 7.1, but you are looking at plot.color property node similar to the one in this example. http://digital.ni.com/public.nsf/allkb/C6BFD9BD5F01108C86256F8100638B29

 


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 20
(2,925 Views)

Likewise I don't know if this property exists in LabVIEW 7.1, but at least in newer LabVIEW versions there is a plot visible property which you can use to hide plots without changing the colors.

0 Kudos
Message 3 of 20
(2,920 Views)

nathand,

That one sounds like it will work.  The only question is, will the colors still change to the active plot?  That is my problem.  Once I turn off two plots and then turn on just one, it changes colors.

 

0 Kudos
Message 4 of 20
(2,916 Views)

In recent versions of LabVIEW, the visible property sets only whether or not the plot is shown on the graph.  All other properties (such as color) remain unchanged regardless of whether or not the plot is visible, so you can hide or show plots with no effect on any other plot.  I don't know if this was the case in LabVIEW 7.1.

0 Kudos
Message 5 of 20
(2,913 Views)

Thanks, I'll try it!

0 Kudos
Message 6 of 20
(2,910 Views)

No go.

The problem is that LabVIEW looks at the first plot, no matter what channel it is and automatically colors it blue.  The second trace is red and the third trace is green.

0 Kudos
Message 7 of 20
(2,905 Views)

Maybe I should have been clearer... are you only adding the data to the plot that you want to show?  In order for the visible plot approach to work, you need to plot all the data, and let LabVIEW take care of hiding the channels that you don't want shown.

0 Kudos
Message 8 of 20
(2,902 Views)

Yes.  I have a triax accelerometer which measures horizontal, vertical and axial vibration.  All three go to one plot representing the vibration in all three directions at that bearing.  I have the cursor block set up for three cursors, one for each direction.  I have toggles set up to turn on or off any or all of these three inputs.  I have the cursors initially locked, one to each direction that is labeled in the cursor block.  There are also colors chosen for each direction.  The problem, as soon as I turn off any channel, the two channels still on display automatically change to the default colors for 2 traces, first one blue, second one green, no longer matching my plot color legend.

0 Kudos
Message 9 of 20
(2,899 Views)

I am losing the plot here! I was thinking this would have done the job!

set plot.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 10 of 20
(2,898 Views)