Bar chart group colour
I have a bar chart which has a group on it, i'd like each member of the group to be displayed in a different colour. I cant figure out how to set a colour for the grouping?
June 30th, 2011 11:33pm

Hi, Simplest way is to be put the same group in Series and Category both places, it will generate different colures for each group. But this way specing between bars does not come perfact. The another way is to use this kind of expression for Color property of series fill style, = Choose(RowNumber("DataSet1") ,"Red","Green","Blue","Yellow") Note:- If your dataset is not producing the agrrgate results, you can ROW_NUMBER() clause over group clause in sql query to create that goup by filed. You can add more colors if you have more groups. Kindly revert if this is not the same thing you want. - Chintak (My Blog)
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2011 3:09am

Hi ClareMoore, Based on your requirements, you can try to use custom code to achieve this. Please take the following steps of my sample as a reference: 1. On the menu bar, select Report -> Report Properties and then click the “Code” tab. Paste the above code to the Custom code area: Private colorPalette As String() = {"Green", "Blue", "Red", "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#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 2. Click the Series on the bar chart, and then set the “Color” property to the following expression: =Code.GetColor(Fields!Category.Value) When preview the report, the result as shown in the following figure: For more information about Get More Out of SQL Server Reporting Services Charts, please refer to the article below: http://msdn.microsoft.com/en-us/library/aa964128(v=sql.90).aspx Regards, Bin Long
July 4th, 2011 2:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics