Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Define colors for a series for multiple charts Expand / Collapse
Author
Message
Posted Wednesday, October 09, 2013 6:34 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 6:12 PM
Points: 827, 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?
Post #1503338
Posted Thursday, October 10, 2013 4:55 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 6:12 PM
Points: 827, 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.
Post #1503829
Posted Friday, October 11, 2013 9:02 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 10:49 AM
Points: 314, Visits: 1,448
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




Post #1504057
Posted Friday, October 11, 2013 11:05 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 6:12 PM
Points: 827, Visits: 342
Thanks peterzeke! Appreciate your detailed suggestions. I'll go through the links and re-analyze the requirement of pie charts.
Post #1504097
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse