Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Iam using sql-server2008, VS2008 with SSRS.
bar-chart color changes when the report is exported to PDF. The legend doesn't have the same colors that of the bar-chart. This works fine in SSRS. However when exported to PDF the legend colors dramatically change.

Private colorPalette_AnaI As String()={"#097054","#FFDE00","#0599FF","#FF9900","#009900","#FCB3D0","#990033","#E86850","#887058","#92CD00","#C13100",}


Private colorPalette_AnaII As String()={"#005B9A","#03B585","#8C8984","#0191C8","#025E45","#B7C7D7","#024575","#03F7B8","#5D5D5C","#74E2C1","#D2D1CF","#06D2D2","#8080C0","#000000","#C0D9AF","#A6D785","#61B329","#77896C","#687E5A","#3F602B","#8AA37B","#8FA880","#646F5E"}


Private colorPalette_AnaIII As String()={"#9C16CB","#E47297","#FAC993","#B675F7","#FFCDCB","#AA0114","#FC3232","#6600CC","#F57E80","#F6CEE3","#CA278C","#F90421","#8080C0","#000000","#C0D9AF","#A6D785","#61B329","#77896C","#687E5A","#3F602B","#8AA37B","#8FA880","#646F5E","#476A34","#5DFC0A","#435D36","#93DB70","#3B5E2B","#84BE6A","#4CBB17","#484D46","#3A6629","#49E20E","#308014"}


Private count_AnaI As Integer = 0
Private count_AnaII As Integer = 0
Private count_AnaIII As Integer = 0
Private mapping_AnaI As New System.Collections.Hashtable()
Private mapping_AnaII As New System.Collections.Hashtable()
Private mapping_AnaIII As New System.Collections.Hashtable()

Public Function GetColor_AnaI(ByVal groupingValue_AnaI As String) As String
   If mapping_AnaI.ContainsKey(groupingValue_AnaI) Then
   Return mapping_AnaI(groupingValue_AnaI)
   End If
  Dim c1 As String = colorPalette_AnaI(count_AnaI Mod colorPalette_AnaI.Length)
   count_AnaI = count_AnaI + 1
   mapping_AnaI.Add(groupingValue_AnaI, c1)
   Return c1
End Function



Public Function GetColor_AnaII(ByVal groupingValue_AnaII As String) As String
If mapping_AnaII.ContainsKey(groupingValue_AnaII) Then
      Return mapping_AnaII(groupingValue_AnaII)
   End If
Dim c2 As String = colorPalette_AnaII(count_AnaII Mod colorPalette_AnaII.Length)
   count_AnaII = count_AnaII + 1
   mapping_AnaII.Add(groupingValue_AnaII, c2)
   Return c2
End Function



Public Function GetColor_AnaIII(ByVal groupingValue_AnaIII As String) As String
   If mapping_AnaIII.ContainsKey(groupingValue_AnaIII) Then
      Return mapping_AnaIII(groupingValue_AnaIII)
   End If
Dim c3 As String = colorPalette_AnaIII(count_AnaIII Mod colorPalette_AnaIII.Length)
   count_AnaIII = count_AnaIII + 1
   mapping_AnaIII.Add(groupingValue_AnaIII, c3)
   Return c3
End Function


Sounds like the counter gets resets everytime but dont know why..Please help !! I did a lot of research but all invain.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900