Article

Custom colors (or defined colors) in charts in SSRS

I needed specific colors for specific values on a pie chart in SSRS. We were charting work requests in a month. Each job had one of four states: completed, missed, pending and due today.  I wanted to color code those values to dark green, red, lime and orange respectivly.  The existing color palette (and options) was not going to get it done.  Here is how I accomplished it:

 Chart properties > Data > element in values > Edit > Appearance tab > Series Style button > Fill tab > color function builder

=Switch(
Fields!Schedule_Status.Value = "completed", "dark green"
,
Fields!Schedule_Status.Value="missed","red"
,
Fields!Schedule_Status.Value="pending","lime"
,
Fields!Schedule_Status.Value="due today","orange" )

This will only work for a chart with known values but, in this case, I will never have anything more that four slices so defining each is simple enough.  If you don't know exactly all of your options, this technique isn't going to work for you.

Since the feeding query is a view into the tables which defines the status label (Schedule_Status in this case), I am thinking I might have the view supply the color as well so I don't have to change all the color properties in numerious reports if another state was added in the future like "missed > 30 days".  The color properties could then use the view to feed the color to the charts. hmm… 

I was making it far too hard by trying to follow the example in Microsofts white paper on custom paletts

Comments Closed.