I am having a problem setting the colors of the bars in a bar chart. It seems like it would be the simplest thing, but apparently it's not.
The "series" is grouped on whether or not the value is positive -- if so, the bars are blue (by default) and if not, green (by default). I want to change it so the positive color is blue and the negative color is red.
I found that I can change ALL the bars to one color by going to chart properties, Data tab, Values Edit, Appearance tab, Series Style, Fill. There I set the color to red and ALL the bars became red. But this is not what I want.
I tried using a conditional statement like IIf(Fields!IsPositive.Value=True,Blue,Red) for the color, but (not surprisingly), it told me I hadn't defined Blue and Red.
Does anyone know exactly how to do this?
Nobody has even a clue how to do this? I can't find it documented anywhere .. is it impossible?|||hi there
there is some information on the following link - not sure if it will help but look at figure 14 P10
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/MoreSSRSCharts.asp
cheers
|||IIf(Fields!IsPositive.Value=True,Blue,Red)
Try to use blue and red in double quotes, it should solve the problem.
i hope by now you figured how to change the colors of the bars , the previous link has all the information, but to be in depth, for your case, you can write a code snippet in the code tab of the report properties by writing a simple vb code. for the logic you want to do it.
you can do something like this, pass a parameter ( i mean the value : fields!Positive.Value )
If (so and so.. )
Color = '03938x'
-- something like this.
Let me know if this helps.
and call this method in the data field properties.
=Code.YourFunc(Parameters)
--
Kishore
|||Yes, thank you very much! Putting the colors in quotes does it (duh!). And that link has great information. Thanks again!|||
Hi!!
I do it in this way: in the "Chart Properties", data tab, I edit the value and in "Appearance" I go to "Series style..." and in fill tab, in Color, I set the next sentence:
=Code.GetColor(Fields!Criticity.Value)
And in the Report Properties, Code tab:
Public Function GetColor(ByVal strCriticity As String) As String
Select Case strCriticity
Case 0
Return "LemonChiffon"
Case 1
Return "Gold"
Case 2
Return "DarkOrange"
Case 3
Return "DarkRed"
End Select
End Function
Well, it works... but this has a problem: if in the bar chart appear the 4 colors in the different rows but the last bar only has 2 of them, in the legend only will appear that two colors, and the other 2 will be by default (a blue and a green, it will depend of the selected palette)...
How can I do it to show the legend with the correct colors?
If I put the code like cedubose:
= Switch (Fields!Criticity.Value = 0, "LemonChiffon", Fields!Criticity.Value = 1, "Gold", Fields!Criticity.Value = 2, "DarkOrange", Fields!Criticity.Value = 3, "DarkRed")
it works different but not correctly, i means, in 3 of the 4 legends appear the same color and in the other legend the another color...
All suggestions will be wellcome... thx!!
|||Problem solved!!!
If somebody has the same problem, here is the solution:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=13958&SiteID=1
|||The only way I've found of doing it is to
1) Select Tools/Options/Color
2) Modify the colours in "Chart Fill"
...should be easier, but.
No comments:
Post a Comment