Better Dashboards

Working with Microsoft enterprise chart, dashboard and reporting technologies.

Collect Small Slices on a Pie Chart

Posted by milang on January 20, 2009

Picking up from near the end of a previous post on how to place labels outside the pie chart, you can collect small slices on a pie chart by calling a few of the “Collected” custom attributes. I think this is the best way of handling overflow on a pie chart; the chart samples also show how to show collected pie slices onto a secondary pie chart, but that solution is not very scalable, and in many ways, it only complicates the information trying to be conveyed.

Here’s the chart from near the end of the previous post that we will modify:

piechartlabel2
When collecting pie slices, the key property is the CollectedThreshold custom property, which will determine the value at which all data points will be collected. You’ll need to play around with this value depending on your data; the best rule of thumb is to collect all small data points so that between 4-7 data points remain on the chart.

Here’s the code, taken directly from the chart sample framework in the Chart Types –> Pie Charts –> Collecting Small Slices sample:

// For simplicity, we will grab the first series in the chart as a
// separate object
Series series1 = Chart2.Series[0];

// Set the threshold under which all points will be collected
series1["CollectedThreshold"] = "5";

// Set the threshold type to be in percentage
// When set to false, this property uses the actual value to determine the collected threshold
series1["CollectedThresholdUsePercent"] = "true";

// Set the label of the collected pie slice
series1["CollectedLabel"] = "Other";

/* By setting these three properties, we collect any data
// less than 5% into one slice called "Other"
*/ 

// The text that will be shown in the legend, although in this example, the legend is hidden
series1["CollectedLegendText"] = "Other";

// Collected pie slice shown as exploded (just for effect)
series1["CollectedSliceExploded"]= "true";

// Set a named color for the collected slice
// Interestingly, it appears that this means you cannot set an RGB value for this property
series1["CollectedColor"] = "Green";

collectedpie

(By the way, since a few people have asked, you can check the MSDN documentation for step-by-step guidelines on how to collect small slices on a pie chart in Reporting Services).

Advertisements

3 Responses to “Collect Small Slices on a Pie Chart”

  1. Serkan Can said

    Is it possible to collect pieces in a range ?
    For example in a range between %30 and %70. I’m asking this because after collecting pieces there’ll be a time when you need to view these small pieces. If there’s a huge data in pie chart its hard to see small pieces. So i want to view only specified percentages in a range.

    • milang said

      Hi Serkan,
      Unfortunately, no. There are no options to collect pieces across a specific range of values. The best solution I can think of is to iterate through all of the data points in your series and collect all of the points within a certain range into one point (using code). Hope this helps.

      -Milan

  2. Rahel said

    How???????????????????????????????????????

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: