Colors in Legend Does not match with Bar Garph - SSRS 2005
Hi I have a bar graph with custom colors applied to it. The custom colors displays nicely in the bar graph, but not in the legend. The legend displays a mix of some of the "correct" custom colors, and some of the "wrong" standard colors. The colors in the legend vary, depending on the parameters passed to the report. Sometimes legend colors are all right, other times all wrong but must times a mix of right and wrongs. The value for the custom color of the graph is retrieved from a field in the dataset. However I doubt that this is the cause of the error because, the bar graph colors are correct at all times, and I have validated thet correct color names are actually in the dataset. Hope someone can help me out with this one...
July 5th, 2010 10:05pm

Hi, It seems you want to validate the values? If so, could you create drill through report to display the details of each bar. Or the colors in legend is wrong because they all the same? Could you post the color expression you are using? If this is not what you want, could you give us a demo and explain more on this? Thanks, RaymondRaymond Li - MSFT
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2010 12:54pm

Hi, Am am also facing issue with Legend color. I have 2 series with bar chart. I am using =code.GetColor1(Fields!YEAR_MONTH.Value) function to choose dynamic color. The first series is fine. But the 2nd series has problem when more than a month are selected and the legend color is shown as black though in chart the color is shown properly. any solution to this problem? Rahul Nadkarni
August 4th, 2010 6:24pm

Hi Rahul, I am having the same issue. Did you find any solution for it. Thanks.Reddy
Free Windows Admin Tool Kit Click here and download it now
January 7th, 2011 9:49pm

Hi, The easiest way I have found to match colors between two or more objects in SSRS is to use some custom code in the Report Code section. Add the following code fragment into Report Properties-->Code Private colorPalette as String() = {"Blue","Red"} 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 In the list above, I have placed two colors ("Blue","Red"). You can add as many different colors as you like, as long as they are enclosed in double quotes and separated by commas. Then, in Fill property of your graph and the Fill property of your tables, pass a string that looks like this: =Code.GetColor(Fields!my_value.Value) The function call will return the same color for a given value of my_value. The Fill color of the bar and the Fill color of the textbox background will match, as long as the value of my_value is the same. I hope this helps. --Dan DJAnsc
January 7th, 2011 10:21pm

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

Other recent topics Other recent topics