all groups > sql server reporting services > september 2005 >
You're in the

sql server reporting services

group:

adjust colours of bars in bar charts at run time



adjust colours of bars in bar charts at run time Peter Nolan
9/24/2005 2:57:53 PM
sql server reporting services: Hi,
does anyone know if it is possible to adjust the colours of the bars in
bar charts at run time using custom assemblies or functions? I have
clicked on all the options I can find and I can see no expression
capability for the colours of the bars, only a selection of color
schemes...is this just not an option in 2000?

Thanks

Peter
www.peternolan.com
Re: adjust colours of bars in bar charts at run time Robert Bruckner [MSFT]
9/24/2005 6:22:26 PM
You will need to have at least SP1 of Reporting Services 2000 installed (on
the server and on the report designer). Please check the SP1/SP2 Readme for
more details:
http://download.microsoft.com/download/5/1/3/513534ae-a0e7-44e6-9a04-ba3c549a5f5f/sp2Readme_EN.htm#_chart_enhancements

You can also search the archives of this newsgroup and you should find many
related threads about setting datapoint colors in charts.

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.



[quoted text, click to view]

Re: adjust colours of bars in bar charts at run time Peter Nolan
9/25/2005 7:02:29 AM
Hi Robert,
I just installed RS...SP2......yes, I understand I can change the
colour of the data points printed on the chart at run time......but I
cannot see any way to change the colour of the bar itself.....it only
appears that I can change the style of the report between things like
'excel', 'earthy', 'transparent' etc...and the colours of the bars are
rendered according to these definitions for all bars in the
series......

No big deal as I will probably use another charting package on
2005...but I was wondering if I can do this in RS charts...

Thanks

Peter
Re: adjust colours of bars in bar charts at run time Paul Ibison
9/26/2005 1:20:02 PM
Peter,
I've done this in the following way:

In Chart Properties, Data, Values, Edit, Appearance, Series Style I use this
function:

= Code.GetColor(Fields!RightsHolder.Value)

And in the code for the report I have:

Public Function GetColor(ByVal RightsHolder As String) As String
if RightsHolder = "EMI" Then
Return "#CC3333" ' "Red"
end if
if RightsHolder = "EMI RW" Then
Return "Pink"
end if
if RightsHolder = "WMG" Then
Return "#3300CC" ' "Blue"
end if
if (RightsHolder <> "WMG") and (RightsHolder <> "EMI") and (RightsHolder
<> "EMI RW") Then
Return "Black"
end if
End Function

HTH,

Paul Ibison, SQL Server MVP

Re: adjust colours of bars in bar charts at run time Peter Nolan
9/26/2005 2:45:44 PM
Paul,
thanks for that...I will give it a go.
Peter
Re: adjust colours of bars in bar charts at run time Robert Bruckner [MSFT]
9/26/2005 3:57:16 PM
You cannot define your own custom palettes directly. The closest you can get
is to use the approach discussed in the following blog posting (it also
provides a sample for download):
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx

The sample defines its own "color palette" by always overriding the colors
that come from the selected color palette.

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

Re: adjust colours of bars in bar charts at run time Robert Bruckner [MSFT]
9/27/2005 9:27:50 AM
That's fine. I'm glad people find my samples, tips, answers, etc. useful and
it helps them solving their issues.

-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.


[quoted text, click to view]

Re: adjust colours of bars in bar charts at run time Paul Ibison
9/27/2005 1:57:29 PM
Robert,
apologies for not referencing/crediting your great blog example - knew I got
my code template from somewhere but couldn't remember where :)
Cheers,
Paul Ibison, SQL Server MVP

Re: adjust colours of bars in bar charts at run time Peter Nolan
10/8/2005 9:08:42 AM
Paul,
you are brilliant!!! Thank You!!!!

When I read this I thought it related to the numbers that were printed
on the chart if they were printed...but when I tested I found it was
the bar and line colour that it was referring to...now I can pass data
from the row to a member of a custom assembly and get it to generate
the bars on the chart to be the colours I want!!

Thank you very much for this....this is a feature I really wanted on my
charts.....

Best Regards

Peter
www.peternolan.com
Re: adjust colours of bars in bar charts at run time Ard Goossens
11/22/2005 7:20:20 AM
Hello,
I read the blog and for HTML and PDF it works great. However when i export a
report to excel, excel reinterprets the colors to what it can handle.
In my case i made a colorpalette of only oranges and browns. When i export
it to excel, the graph itself is exported ok. Only the colors i used in the
legend table are changed. eg. GoldenRod, Orange and DarkOrange are all
reverted to the same color.
Is there a way to have the table also exported as a picture or something to
get the right color across?
[quoted text, click to view]
Re: adjust colours of bars in bar charts at run time Richard Walsh
12/4/2005 6:53:01 PM
Hi,

I don't seem to have the 'Series Style" section showing on my 'Appearance'
tab.
Have installed SP2 for RS 2000 on the server, but surely this is a "client"
issue with
SQL Server Report Designer. I'm using Ver 8.00.743

Any ideas?

[quoted text, click to view]
AddThis Social Bookmark Button