Monday, March 12, 2012

Foramtting chart axis colour using expression

I have a chart on a report that shows value in £ on the Y Axis. The values can be both positive and negative. I would like to have the negative labels to show in red and the positive in black. What is the expression syntax to achieve this? i know it will be an IIF statement, but what is the syntax to show the Y Axis label as <0?

eg if i was doing this for a field it would be iif(Field!Fieldname.value <0, "RED","BLACK") but what would i replace the FIELD!Fieldname.vaue with so the expression would change the Y Axis label.


Thanks in advance for any help

Dave Munro

Hi Dave,

I'm a brazillian guy, but i try to help you !

First of all, You will have to create a code to fill the bars.

REPORT - REPORT PROPERTIES - CODE (tab)

Function ColorBar(VlField) As String
Dim Bar_Colour as String
if VlField > 0 then
Bar_Colour = "BLACK"
Else
Bar_Colour = "RED"
End if

Return Bar_Colour

Afther that, click in chart and set the properties.

click in TAB (VALUES) - VALUE - edit - Appearance (Tab) - Series Style - Fill - expression (color)

=code.ColorBar(Fields!XXXXXX.Value)

OK....

Bye,

Nitrini

No comments:

Post a Comment