SSRS 2008 Conditional formatting of chart labels
Hi everyone,is it possible for the labels of a chart axis to add conditional coloring. I tried to changed it according to its value but it does not get applied. I need to have labels with positive values in black and with negative red.
Any ideas will be verymuch appreciated
May 26th, 2009 4:17am
yes, i think we can do this..under the Axis properties, there is an option called 'Label Font'. If you click on it you will be able to see the 'color' option.Besides this, there is abutton for expression.Here i thinkyou can setthe color based on the condition.This is with repect to SSRS 2008,Hope this is helpful.Best Regards,Azhar
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2009 10:16am
Hi Marie,
Try this:
1) Select the chart, right click the chart, and click properties.
2) In Chart Properties window, switch to data tab. select the value group, click edit button.
3) In edit chart value window, switch to data tab. switch to point labels tab. click label style button.
4) In style properties window, set the color with expression:
=iif(Fields!amount.Value<0,"red","black")
Hope this helps.
Raymond
May 27th, 2009 3:10am
Hi,I did exactly this I added IIf condition for the value axis properties labels font colors but it does not get applies: something like:=iif(Fields!ValueField.Value = "Some string", "Black", "Red") but I get all labels in red...Any ideas?Thank you,Maria
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2009 6:09pm
Hi Marie,
I believe iif expression works all right. The issue is caused by your data. You can test expression with :
=iif(true,"red","black")
=iif(false,"red","black")
You will find the color always base on your condition expression: Fields!ValueField.Value = "Some string"
I mean, the expression always return false, the field Fields!ValueField.Value never return Some string
So I think you can check the Fields!ValueField.Value, whether the string include spaces, or the wrong data format. Make sure you catch the correct string.
Hope this helps.
Raymond
May 28th, 2009 9:56pm
Hi Raymond,Thanks for the help. The evaluation expression within the iif statement works. However, in my case what happens is.I added the conditional coloring:
=iif(Fields!Value.Value = 1,
"red", "black") and I have values of 1,2,3,4 . I get all axis labels in red. If the expression is =iif(Fields!Value.Value = 2, "red", "black") I get all values in black. I.e. this coloring is applied to all the members in the collection. What I need to achieve in the first case is the following:condition: =iif(Fields!Value.Value = 1, "red", "black")result: 1 (colored red), 2 (colored black), 3 (colored black), 4 (colored black)for the second casecondition: =iif(Fields!Value.Value = 2, "red", "black")result: 1 (colored black), 2 (colored red), 3 (colored black), 4 (colored black)It is really something very simple and I can not figure out what the problem is - is it not supported formatting of specific members within the labels collection or am I doing something really wrong :)Once again thank you for the help.Maria
Free Windows Admin Tool Kit Click here and download it now
June 2nd, 2009 6:31am
Hi Marie,
It really strange a issue, because the conditional color always works in my situation - I tested it in Server pack 1 and server pack 3. Suppose the x-axis is group by Fields!columnx.Value, could you using following expression for label color:
=iif(Fields!columnx.Value<0,"red","black")
And suppose the y-axis is group by Fields!columny.Value, could you using following expression for label color:
=iif(sum(Fields!columny.Value)<10,"red","black")
And if you still cannot get the correct result, to validate if this is a bug, I think you could connect to
https://connect.microsoft.com/SQLServer/
Hope this helps.
Raymond
June 2nd, 2009 7:03am
Thank you Raymond,I posted a feedback here:https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=463179Hope the issue will have a resolvement.Kind regards,Maria
Free Windows Admin Tool Kit Click here and download it now
June 2nd, 2009 8:58am
Good lively thread here. This is actually not a bug in terms of how the chart currently works, but is by design. It's a bit misleading due to the fact that the property page supports expression based formatting for the axis labels which it shouldn't. Going forward, this is definitely a feature we would like to enable. Thank you for posting the feedback. The issue is definitely on our radar. -SeanProgram Manager, SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
http://blogs.msdn.com/seanboon
http://www.twitter.com/ssrs
June 2nd, 2009 1:40pm
? Are you saying that there's a dialog box for creating an expression to set the color property of labels, and it doesn't actually do anything?I hope not.
Free Windows Admin Tool Kit Click here and download it now
September 9th, 2009 11:15am
?
Are you saying that there's a dialog box for creating an expression to set the color property of labels, and it doesn't actually do anything?
I hope not.
Unfortunately he is... As far as I can tell, the expression does actually do something but it will use the first record in the dataset to calculate the result for the whole chart, not really what you'd want to achieve.MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
July 30th, 2012 5:56am