Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 552257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:28:49+00:00 2026-05-13T11:28:49+00:00

I created a custom color palette for my charts using a technique described on

  • 0

I created a custom color palette for my charts using a technique described on TechNet.

I also have a series of drill-through column charts, where you click on one column and it passes a parameter through to the next chart and so on, giving the appearance of drill-down.

My graphs consist of 3 types of labor, and have three colors on the main chart. When I drill down to the next chart, some of the categories do not have all three types of labor that the main one has. So the first color in the palette is assigned to the series, even though it was the second color on the previous chart. I’d like to avoid this, if possible.

So a data value is green on the first chart (2nd in the color order) and yellow on the next chart (1st in the color order). How do I make the graphs “remember” the total number of series groups that were in the first chart?

This is Reporting Services 2005.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:28:49+00:00Added an answer on May 13, 2026 at 11:28 am

    I was able to solve this because I was using a custom color palette, implemented as a hash table. I basically serialized this information and passed it to a hidden parameter on the subreport and then reinflated the data structure.

    It’s not perfect, but it works for now.

    ' Define some globals, including the color palette '
    Private colorPalette As String() = _
        {"#FFF8A3", "#A9CC8F", "#B2C8D9", "#BEA37A", "#F3AA79", "#B5B5A9", "#E6A5A4", _
         "#F8D753", "#5C9746", "#3E75A7", "#7A653E", "#E1662A", "#74796F", "#C4384F", _
         "#F0B400", "#1E6C0B", "#00488C", "#332600", "#D84000", "#434C43", "#B30023"}
         ' color palette pulled from SAP guidelines '
         ' http://www.sapdesignguild.org/resources/diagram_guidelines/color_palettes.html '
    Private count As Integer = 0
    Private colorMapping As New System.Collections.Hashtable()
    ' Create a custom color palette '
    Public Function GetColor(ByVal groupingValue As String) As String
        If colorMapping.ContainsKey(groupingValue) Then
            Return colorMapping(groupingValue)
        End If
        Dim c As String = colorPalette(count Mod colorPalette.Length)
        count = count + 1
        colorMapping.Add(groupingValue, c)
        Return c
    End Function
    
    ' In custom actions of the data value, set the results of this '
    ' function to the mapping parameter in the next report '
    Public Function PassColorMapping() As String
        If colorMapping.Count = 0 Then
            Return Nothing
        End If
        Try
            ' convert the hashtable to an array so it can be serialized '
            Dim objHash As Object()() = ToJaggedArray(colorMapping)
    
            ' serialize the colorMapping variable '
            Dim outStream As New System.IO.StringWriter()
            Dim s As New System.Xml.Serialization.XmlSerializer(GetType(Object()()))
            s.Serialize(outStream, objHash)
    
            ' move on to the next report '
            Return outStream.ToString()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Function
    

    I ran into an issue where I couldn’t find the equivalent of the onLoad event for the report. Since I wasn’t sure where to put this inflate code, I stuck it in the background color of the plot area. Hence I always return “WhiteSmoke”. I’ll change this if I can find the right place to put it.

    ' Call this function when the report loads to get the series groups '
    ' that have already been loaded into the custom color palette '
    ' Pass in the parameter used to store the color mapping '
    Public Function InflateParamMapping(ByVal paramMapping As Parameter) As String
        Try
            If paramMapping.Value Is Nothing Then
                Return "WhiteSmoke"
            ElseIf colorMapping.Count = 0 Then      
                Dim pXmlized As String = paramMapping.Value
                ' deserialize the mapping parameter '
                Dim s As New System.Xml.Serialization.XmlSerializer(GetType(Object()()))
    
                ' get the jagged array and convert to hashtable '
                Dim objHash As Object()() = DirectCast(s.Deserialize(New System.IO.StringReader(pXmlized)), Object()())
                ' stick the result in the global colorMapping hashtable '
                colorMapping = ToHashTable(objHash)
                count = colorMapping.Count
            End If
        Catch ex As Exception
    '       MsgBox(ex.Message) '
        End Try
        Return "WhiteSmoke"
    End Function
    

    ToJaggedArray() and ToHashTable() are helper functions because a HashTable is not serializable since they implement an IDictionary. I was in a hurry so I just converted them to an array right quick. Code comes from the Collection Serialization in ASP.NET Web
    Services
    article written by Mark Richman. I converted the code from C# to VB.NET to use in the report.

    Public Function ToJaggedArray(ByVal ht As System.Collections.HashTable) As Object()()
        Dim oo As Object()() = New Object(ht.Count - 1)() {}
        Dim i As Integer = 0
        For EAch key As Object in ht.Keys
            oo(i) = New Object() {key, ht(key)}
            i += 1
        Next
        Return oo
    End Function
    
    Public Function ToHashTable(ByVal oo As Object()()) As System.Collections.HashTable
        Dim ht As New System.Collections.HashTable(oo.Length)
        For Each pair As Object() In oo
            Dim key As Object = pair(0)
            Dim value As Object = pair(1)
            ht(key) = value
        Next
        Return ht
    End Function
    

    Now in the report itself you need to do a couple things.

    • Add a reference to System.Xml in Report Properties in both reports.
    • In the Actions of your parent report, set the Parameter containing your data structure to =Code.PassColorMapping()
    • In the Plot Area section of your report, put this expression for the background: =Code.InflateParamMapping(Parameters!colorMapping)
    • And of course, in the Fill for your data Series Style on both charts put this expression: =Code.GetColor(Fields!Type.Value)

    You can continue doing this for as many subreports as you want – I currently have 3 levels of drill-through and it works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i have created custom title bar using following titlebar.xml file with code <?xml
We have created custom listview by using the Base adapter. List view contains Text
I have created a custom tabbar in my application (using TabHost and TabWidget ).
I am using asp.NET 4.0 with C# and have recently created a custom design
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
I have created custom posts and I want one page in my site to
I have created custom jQuery UI widget called uiPopover, very similar to UI-dialog (in
I have created custom cell in which there are n number of image views.
I have a custom view called DrawView created in the main activity. I have
I have created a custom UIButton (UIButton subclass) for my application. Within this button's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.