Search code examples
reporting-servicesbackgroundchartslinezone

Conditional background color in line charts


I am currently trying to convert our charts over from PQ Systems Chartrunner to SSRS 2008 charts. I am currently working with a line chart in SSRS 2008 and am trying to get the background color to change for the different sigmas. I am able to calculate and chart the standard deviation sigma lines, but I have not been able to change the color of the background between the lines.

What I have so far in SSRS:

SSRS chart

In the Chartrunner chart, the Red/Yellow/Green zones:

Chartrunner chart

Is there a way to do this in SSRS 2008?


Solution

  • Yes, you need to look at using Strip Lines in your report:

    Highlight data by adding Strip Lines.

    This is a decent link, too:

    Axis Strip Lines in SSRS.

    Because you can make these expression based, the bands can be determined at run time. It should work in your case as you always have a set number of bands, just different values when you run the report.

    Here's a simple example, based off the following dataset:

    enter image description here

    Most important thing to note is that I've included the limit rows max, mid, and min in the dataset; these makes the Strip Lines easier to create.

    Create a simple chart:

    enter image description here

    Select the Y Chart Axis and expand the StripLines collection:

    enter image description here

    You can see that I've set IntervalOffset and StripWidth, based on the fields in my dataset. End result:

    enter image description here

    So you can see it's possible to do this dynamically as required. It's a simplified example but the concept is readily transferable; you should be able to adapt it to your requirements.