Saturday, January 1, 2011

Adding Custom Color in SSRS Chart Reports

Do you ever come across a requirement where you need to use user defined colors instead of default colors in a chart (for example Pie Chart).

In this article, I'll explain how to create a Custom Palette and how to use that palette in a Pie Chart.

In the above screen-shot, I am using color Blue, Red, Teal and Gold for the first four values of the Period column and same colors are used in Pie Chart as well.

Here are the steps to achieve this task:

Create your custome color palette in the report using Custom Code in your report. To do so, click Report => Report Properties => Code and copy below code:

Private colorPalette As String() = { "Blue", "Red", "Teal", "Gold", "Green","#A59D93", "#B8341B", "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}

Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()

Public Function GetColor(ByVal groupingValue As String) As String
   If mapping.ContainsKey(groupingValue) Then
      Return mapping(groupingValue)
   End If
   Dim c As String = colorPalette(count Mod colorPalette.Length)
   count = count + 1
   mapping.Add(groupingValue, c)
   Return c
End Function

You can define your own colors in the above function.

In the Pie Chart, select Series Properties and select the Fill option from left side as shown below:

Now write following expression in the Color expression:


Here Fields!Year.Value is a field of dataset which is used as Chart Category fields.

In the left most column of the tabular report, insert character and in the color property of the textbox write following expression:


Here I am considing that tabular report is grouped on Fields!Year.Value field.

Thats it. Click on the preview and enjoy your custom colors in charting.



  1. Thank you so much for the helpful post, I really enjoy being able to snaz up my reports and it really makes it easier to distinguish the data on it. I was also able to draw help form this video on creating custom reports, this is just in case other like the visual help like I do.

    1. Data visualization comes at a later stage of decision making where the data needs to be visualized in a presentable format and SSRS has many fully loaded controls to fulfil this requirements. SSRS gives a lot of features to represent the data into graphical mode to give the clear picture of the business growth. Integration a line-chart into a column-chart makes our SSRS report more elegant and insightful to display the meaningful analyzed data to the business advisors.
      To know more here


Here are few FREE resources you may find helpful.