Add Total to a Legend
Is it possible to add a Total line to the legend of a pie chart? I am using SSRS on 2008 R2.
October 10th, 2010 8:18pm

Hi DAMW, Based on your requirement, I think you could customize the legend utilizing a table, actually this table is just a fake legend, please follow these steps: ==== Step one Create a custom function to return a series color based on the group value: 1. Click Report Properties on the Report menu 2. Select the Code tab and enter the following code in the Custom Code box: 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 Step two 1. Hide the legend in the chart properties dialog firstly. 2. Create a table with two columns grouped by the group expression used as the graph series. 3. In the dataset window, click seriesdatafield and drag it to the first cell, which is the row just below the table header. 4. Delete header row which is unnecessary and set the background color of the second column in the table using expression =Code.GetColor(Fields! seriesdatafield.Value) 5. Right-click the detail row, and move to Insert row->OutSide group-below. Type the expression for this row =SUM(Fields!Datafield.value), and set its background based on your requirement. For a more detailed description about "Customizing Chart Legends”, please see this blog written by BRIAN WELCKER http://blogs.msdn.com/bwelcker/archive/2005/05/20/perfect-from-now-on-custom-chart-legends.aspx Regards, Challen Fu
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2010 11:56am

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

Other recent topics Other recent topics