Conditionally set line color in chart to "No Color"?

  • Hello --

    I'm using SSRS 2012, but I suspect this problem is also relevant to earlier versions as well.

    I have a need to use a parameter that sets the Fill property of a line on a chart to "Blue" or to "No Color". (I don't want to change the hide/show property since hiding this line could alter the scale of the chart. So, the line must be present on the chart, but may be colored Blue or have no color.)

    If I manually set the "Fill" property of the line to No Color (by checking the check-box for No Color), the line will not be seen but it is being plotted on the chart (So far, so good...). Examining the expression of Fill property shows No Color (without an equal sign or quotes). But, if I change the expression to be ="No Color", then the line will be plotted with a default green color. So, apparently there is something special about setting the expression to just No Color (without an equal sign or quotes).

    So, in my quest to create a conditional statement to set the Fill color to either "Blue" or No Color, I have tried the following expressions unsuccessfully:

    =iif(Parameters!prmShowLine.Value=1,"Blue","No Color")

    or

    =iif(Parameters!prmShowLine.Value=1,"Blue",Nothing)

    or

    =iif(Parameters!prmShowLine.Value=1,"Blue",No Color)

    .... this last expression generates an error that it doesn't recognize "No".

    So, how can a line be conditionally set to No Color?

    Thanks in advance,

    Pete

  • I solved it!

    By looking at the underlying xml code, I discovered that No Color is set to [font="Courier New"]#00ffffff[/font]

    So, the following expression now sets the Fill color property of the line to be either No Color or Blue.

    =iif(Parameters!prmShowLine.Value=0,"#00ffffff","Blue")

    Hope this helps someone else who may be struggling with a similar problem.

    --Pete

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply