Setting custom colors on a column stacked bar chart
I have set the fill for the values series to an expression of: =Switch((Fields!Priority.Value)="Medium","CornflowerBlue",(Fields!Priority.Value)="Critical","Firebrick",(Fields!Priority.Value)="high","RosyBrown",(Fields!Priority.Value) ="Low", "Green")
When running the report colors switch properly however the legend colors do not change
Here is a screenshot of the issue
As you can see the bar colors change properly but i cannot seem to get the legend to work right. Does anyone have any suggestions?
July 17th, 2012 4:17pm
Hi There
Thanks for your posting.
Based on my testing as well this is known issue when you use expression the legend does not always follow your chart colour pattern. For more info please have a look with similar issue has been discussed
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/0dc8aad4-b846-476d-a429-f8fc2312c585/
For work around Please have a look on this thread that might help you
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/24b191e0-ef7f-490d-9602-b584518e1bcf/
Many thanks
Syed Qazafi Anjum
Free Windows Admin Tool Kit Click here and download it now
July 17th, 2012 9:26pm
My chart uses a category group and series group which makes following this post: Fix Thread you posted very
confusing.
July 18th, 2012 1:54pm
Hi Laec,
As Syed posted, this is a known issue when formatting the series color of a Chart in Reporting Services. Besides, please understand that the issue only occurs when we use certain Aggregate functions for the Value field (in this issue, it is Count function).
For example, if we place a numeric data type field in the Chart Values area and use the Sum Aggregate function, the colors of the Legend will display correctly.
At this time, you can refer to the following detailed steps to work around the issue:
Drag a Matrix to the right of the Chart, delete the first row. Right click the first column and select Insert Column-> Inside Group-Right.Drag the "Priority" field to the secod column, set the Backgroup color of the textbox in the first column by using the same expression as that you use to control the Chart series fill color.
Set the three textboxes of the matrix to "No Border" style.Add a List control into the report. Set the "DataSetName" of the list to the same dataset as the chart.Selct the list, open the "Details" group properties window from the Grouping Pane and group the list on "[Priority]" field.Drag the matrix into the list, and adjust the height of the matrix and the list.
The screenshot below is for your reference:
If you have any questions, please feel free to ask.
Regards,
Mike Yin
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2012 11:59pm