Changing the Bar color Dynamically in Column chart
Dear All,
I got a requirement where I should change the Bar color dynamically in Column chart based the DB value.
I have used the following technique to achieve that.
It may be useful for you if you looking for this option in Webi.
I have DB values like below
Color condition for Current year values is like below
Now I have to create the Column chart.
I have created a column chart but I can only showcase only mono color bars for the Value. It will look like the below one
Here all bars have same colors. First We need to differentiate the bar colors .
For Current year – The condition needs to be applied
For Previous Years – Blue color
To achieve this , You need to create two variables one for Previous Year and one for Current year
Previous Years –“If([Years]<>2015) Then [Values]”
Current Year – “if([Years]=2015) Then [Values]”
Now create chart by assigning these two variables. In addition, to create the different color bars , Create a new color palette from corporate Palette where the second color will be “Green”. Name the chart as “Green Chart”
Green chart will look like this ,
Copy the Green Chart and create two charts out of it.
Name them “Yellow chart” , “Red chart”
Color Palette should be customized in both of the charts.
In Yellow chart, second color should be “Yellow”,
In Red chart; Second color should be “Red”.
Now the main part, Formula to do the dynamic visibility.
Open Green chart, in general format options, mark the following two items “Hide when Empty” and “Hide when the formula is true”.
In the formula space , “=[Value]<5” .
For Yellow chart , “=([Value]<2 )OR ( [Value]>=5)”
For Red chart , “=[Value]>2”
The three charts should get overlapped on each other. Also size and layout values should be same.
Now It is done perfectly… The requirement is achieved. Dynamic Color change is done in column chart.
Please let me know if you have any doubts.
Regards,
Balakumar Krishnasmay