Overlay a line on a column chart? Manually set the color of the columns? Screen grab included...

  • I'm trying to create a report in SSRS 2005 similar to the one attached. Attached .png shows what I'm going for. 2 things I'm having trouble getting to right now...

    1) I'll need to be able to color the first destination 1 color (red) and all other destinations a single second color (green). How does one go about setting this attribute?

    2) I haven't seen any SSRS examples of laying the blue line over the bar chart like in the .png. Is there some way to overlay reports to do this?

    I've been trying to find answers to these all day. I've got AdventureWorks (and ~DW) installed if anyone has any example .rdl's.

    I welcome any links to sites you think might help as well.

    Thank you SSC!

  • Hello Greg. I do know of a way to do both things that you are asking, but my answer will be based on a few assumptions

    1) It is not clear in that example, what exactly represents the 'first' column. So I'll assume that it is the first value for each month, but I am going to use the value for the first day of each month in my solution. It is simple, in the Chart Properties, Edit the "Values" of the data that is plotted on your chart. Select the Appearance tab, Series Style..., Fill tab and click the Expression button beside the Color property. Your expression could be something like this =iif(datepart("d", Fields![field_with_date].Value_ = 1, "Red", "Green")

    2) For this, you can add a second "Values" data column to your chart, and click the Edit button under the Chart Properties. Under the Appearance tab select "Plot data as line". You may need to add an expression under the Values tab, depending on if your chart has more than one data plot.

    I hope this helps.

    Jeff.

  • Re: custom colors for the chart.

    I have just done something similar to jeff122877's approach - but to standardise things I created some custom code. In my case it was to set a color for the bars/ columns depending on the day of the week like this:

    Public Function pickColor(weekday)

    If weekday = "Monday" Then

    pickColor = "#bbbbff"

    ElseIf weekday = "Tuesday" Then

    pickColor = "#a6e2ff"

    ElseIf weekday = "Wednesday" Then

    pickColor = "#b7ffb7"

    ElseIf weekday = "Thursday" Then

    pickColor = "#ffffae"

    ElseIf weekday = "Friday" Then

    pickColor = "#ff8282"

    Else pickColor = "Red"

    End If

    End Function

    Then in the series style properties (fill tab) reference the code like this:

    =code.pickColor(Fields!WeekDayName.Value)

    🙂

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

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