Thursday, 6 December 2012

SSRS 2008 R2 - Alternate Bar Chart Colours

A simple Bar Chart or Column Chart in SQL Services Reporting Services (SSRS) that only has one category group can look a bit boring.


An easy way to make it a bit more interesting on the eye is to change the fill colour on the bars (or columns) for the alternating ones.




Right click on the series and select Series Properties.



Select Fill and then click on the expression button.



In the expression box simply paste in the same code you use to alternate rows in a table.

=IIF(RunningValue(Fields!County_Name.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0, "#4573D5","#7399EA")

In this case I'm using colour codes #4573D5 and #7399EA but you can also use names like this:

=IIF(RunningValue(Fields!County_Name.Value,COUNTDISTINCT,NOTHING) MOD 2 = 0, "LightGrey","White")


Your chart will now be a bit more pleasing on the eye.