While the legend built into Reporting Services charts is relatively easy to use, it lacks some of the flexibility that you might like to have. One issue is that it takes up space within the chart boundaries, making the plot area smaller as the number of series grows. So how can you get more control over the legend? Roll your own!

The trick here is to replace the legend inside the chart with a table data region beside the chart bound to the same data set. First create a custom function to return a series color based on the group value. To be consistent, the function should use a hash table to map the same value to the same color:

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

Create your chart and set the series value appropriately. Hide the legend in the chart properties dialog. Now create a table with with two columns and a single row grouped by the group expression used as the graph series. Set the color of the data point in the chart as well as the background color of the first column in the table to:


Thanks to Robert Bruckner for the work on this one. I have atttached a sample report using this technique using the Northwind sample database.