SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Define colors for a series for multiple charts


Define colors for a series for multiple charts

Author
Message
Amit Raut
Amit Raut
SSC Eights!
SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)

Group: General Forum Members
Points: 905 Visits: 342
I've a requirement where I need to design a dashboard with 6 pie charts. Each pie chart will have drill down / drill through capabilities.

All charts have same series meaning, Chart-1 is TotalSales vs Region, Chart-2 is Profit vs Region and so on.

I need to have a single table displaying legends (Region in this case). I'll build expressions to have uniform color for a region across all 6 charts.

Restriction is: I'm not supposed to create any new objects (table, stored procedure) in database. All the logic/ code is handled in report.

Now to have color defined against each region, what options I would have?

I had thought of Shared Dataset but Shared Dataset is not supported in SSRS 2005.

Using a dataset within a dataset is also not feasible, as far as I've explored.

At present, I've an option of creating a temp table to hold region & color. Then join this table with main query. But for 6 charts, I'll have to repeat it 6 times. In case I need to change color for a region, it would be prone to mistakes.

Do I have any other options?
Amit Raut
Amit Raut
SSC Eights!
SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)

Group: General Forum Members
Points: 905 Visits: 342
Just came to know that Lookup can be another option. It works in SSRS 2008. Not sure if it's available in 2005. Let me check.
peterzeke
peterzeke
SSChasing Mays
SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)SSChasing Mays (660 reputation)

Group: General Forum Members
Points: 660 Visits: 1766
There are a couple of approaches to solving this. Here's a link to an entire series devoted to custom/conditional colors in SSRS by Dave Lean:
http://blogs.msdn.com/b/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx

Below is a technique mentioned in Dave's series that is quite useful:

Basically, you create custom code to handle the region; place a function call to the custom code in the relevant field property while passing the region value to the function.

Step 1: Paste this into the Custom Code window.

Public Function ColorRegion(ByVal RegionName As String) As String
Select Case RegionName
Case"Africa"
Return"Brown"
Case"Americas"
Return"Blue"
Case"ANZ"
Return"GoldenRod"
Case"Asia"
Return"Olive"
Case"Europe"
Return"MediumTurquoise"
Case Else
Return"Red"
End Select
End Function



Step 2: Use it in a report Expression to assign a value to a color property.

=code.ColorRegion(Fields!Region.Value)




Lastly, although you are creating pie charts, you may want to reconsider or persuade the person requesting them. Pie charts are generally not an effective visualization compared to bar charts when comparing values. Stephen Few (data visualization expert) has a website (www.perceptualedge.com) that should be required reading for anyone creating charts/graphs -- really great stuff. Here's a direct link to an article he wrote explaining the limitations of pie charts: http://www.perceptualedge.com/articles/visual_business_intelligence/save_the_pies_for_dessert.pdf



Amit Raut
Amit Raut
SSC Eights!
SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)SSC Eights! (905 reputation)

Group: General Forum Members
Points: 905 Visits: 342
Thanks peterzeke! Appreciate your detailed suggestions. I'll go through the links and re-analyze the requirement of pie charts.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search