LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing colors of individual bars in a XY Graph

I am using an XY Graph (bar style) to display 50 voltages. I have limit settings (low alarm,low warning, high warning, high alarm)that I would like to impose on each of the 50 bars in the XY graph. My problem is that any way I try it the limits are only imposed on the first bar on the graph and all the following bars change colors along with the first bar no matter what value they have. Is it possible to control the properties of individual bars inside an XY Graph ??
0 Kudos
Message 1 of 3
(2,810 Views)
> I am using an XY Graph (bar style) to display 50 voltages. I have
> limit settings (low alarm,low warning, high warning, high alarm)that I
> would like to impose on each of the 50 bars in the XY graph. My
> problem is that any way I try it the limits are only imposed on the
> first bar on the graph and all the following bars change colors along
> with the first bar no matter what value they have. Is it possible to
> control the properties of individual bars inside an XY Graph ??
>

The short answer is no. All of the elements in a plot use the same
colors to draw. To get the display you want, you need four plots.
Write a subVI that takes in your array and returns the four that you
need. It will index the elements and generates a value in four othe
r
arrays such that three of them are NaN and the fourth contains your
value depending on the alarm status keeping the same X value with all
four plots. As an example, if the value is lower than the low alarm
limit, the value will be placed in the low array and NaNs in the other
three arrays.

Now wire the four arrays to the graph as a multiplot, you will either
use a build array or a Build Clustered array depending on the XY type.
The plots will overlay, with only one point being non-NaN for each X
location. It will use the color for plot 0, 1, 2, or 3 depending on
which array the value was in.

Greg McKaskle
Message 2 of 3
(2,810 Views)
Since I have a similar question to the original poster (except that I have line graphs instead of bargraph) I will add my comment/question here:

Is it possible to have only one legend for the whole dataset then or is there a legend for each "color" then?

Olaf
0 Kudos
Message 3 of 3
(2,810 Views)