Search code examples
reporting-servicesssrs-2012

Define Axis Color for SSRS Chart


My workplace has an existing report set up in SSRS that contains a line chart. I want to know if/how I might be able to edit the colors for the major axis to highlight the Zero value as Blue. I am using Report Builder v.3.0

I suspect the background of the chart is an image, however I have not been able to find where the image is referenced or stored and the person who created the report no longer works for the company.

Initially I tried creating an additional series, this partially worked producing a line along the 0 scale line but only where there were values for the series, not the entire chart width.

Is there an expression I could write to color the 0 scale line as "Blue" and leave the remaining as Gainsboro?

I had also tried the following with no success: =IIf(Fields!Zscore.Value = "0", "Blue","Gainsboro")

I'm still quite a novice at SSRS, so any help is appreciated.

The below are some screenshots of the chart and the properties:

Chart showing chart series and major axis

Chart Axis properties

Line Color Expression Editor


Solution

  • You can do this two ways, it's sounds like you have tried the first way already and that wasn't what you wanted but I've added it here for completeness.

    Add new series

    The easy way is to add a new series and set the value property to =0. In the image at the end of this answer, this is the blue line, as you can see it will not extend the full width of the chart, I guess that was your issue.

    Strip lines

    The other way is to use the StripLines collection. To get to them, click the vertical Axis, make sure the full properties windows is visible (F4 in Visual Studio)

    enter image description here

    Click the [...] in the StripLines property

    enter image description here

    Click "Add" and then set the 4 highlighted properties. I just set them to something loud at first as they sit behind chart bars and lines etc so they are not always easy to see.

    Once this is done, if we look at the report, we see the blue, add series option and the green stripline option

    enter image description here