2 Replies Latest reply: Dec 12, 2012 8:02 AM by Matteo Sulis

# How to color bars of a bar chart in different colours depending on the value showned

Hi All,

I'm asking for the Community help to solve this apparantly simple problem:

I have a bar chart and every bar should be dyed in a specific color depending on its value.

The expression I'm using in the "Base Colour" calculation is:

if(avg([Assessment Value])<=2, Yellow(), if(avg([Assessment Value])>2 and avg([Assessment Value])<=3, LightGreen(), Green()))

The expression showned by the chart is: vg([Assessment Value])

Now if I filter to see a single column it has the right colour depending on its value, if I see more columns they all have the colour of the first bar.

Thanks a lot for helping

Matteo

• ###### Re: How to color bars of a bar chart in different colours depending on the value showned

try using something like this;

if(rangemin(.5,rangemax(condition),-.5)) < 0,

-Sqrt(-(rangemin(.5,rangemax(condition),-.5)))/(-.5)),

Sqrt((rangemin(.5,rangemax(condition),-.5)))/(.5))),

ARGB(255, 255, 0, 0), ARGB(255, 0, 255, 0), ARGB(255, 255, 255, 255))

• ###### Re: How to color bars of a bar chart in different colours depending on the value showned

I solved, I needed to use the background property of the oexpression instead of the general color property.

Thanks for helping anyway! I learned a new thing!