New to Telerik Reporting? Download free 30-day trial

Pie Charts Overview

Pie charts are used to display the contribution of fractional parts to a whole. Pie charts are most commonly used to make comparisons between groups. They have no axes. When a numeric field is used, the chart can calculate the percentage of each value to the total.

The following image displays a pie chart with a legend:

Pie Chart\Pie Chart

Pie Chart Variations

Design Considerations for Pie Charts

  • Pie charts are popular in reports because of their visual impact. However, pie charts are a very simplified chart type that may not best represent your data. Consider using a pie chart only after the data has been aggregated to seven data groups or less.

  • Pie charts display each data group as a separate slice on the chart. You must add at least one data field and one series field to the pie chart. If more than one data field is added to a pie chart, the pie chart will display both data fields in the same chart.

  • If you are defining your own colors on a pie chart using a custom palette, be sure that you have enough colors in your palette to display each data point with its own unique color.

  • A pie chart requires at least two values in order to make a valid comparison between proportions. If your pie chart contains only one color, verify that you have added a series field to group by. When the pie chart does not contain series, it aggregates the values from your data field into one value for display.

Displaying Percentage Values on a Pie Chart

Pie charts represent proportions of the total. As a result, it is common to format pie chart labels as percentages. In order to be consistent with other chart types, the chart does not display percentage labels by default. To show labels with percentages follow these steps:

  1. Select the series by clicking anywhere on the pie.

  2. Set DataPointLabelStyle.Visible property of the series from the Properties window to true.

  3. Set DataPointLabel property of the series to an expression adjusted to your specific needs similar to the following one: =Sum(Fields.LineTotal)/Exec('graph1', Sum(Fields.LineTotal)) where 'graph1 ' is the name of the Graph item.

  4. Select the series labels and from the 'Graph Tools | Format ' contextual tab select 'Percent ' for the label format.

  5. Adjust the precision according to your needs.

  6. Position the labels through the DataPointLabelAlignment property of the series.

Preventing Overlapped Labels on a Pie Chart

By default, the layout engine will try to arrange the data labels so they do not overlap. When the bounds of two or more labels overlap, the engine will move them and their adjacent labels vertically, trying to find them a proper non-overlapping positions. During this rearrangement, a label can be moved aside from its original location, which may produce a hard to read chart. Additionally, if the plot area doesn't provide enough space and there are a lot of data points, the labels will overlap. There are several ways to prevent labels from overlapping:

  • Decrease the font size of the data point labels.

  • Increase the width and height of your chart to allow more room for the labels.

  • Change pie labels position through the DataPointLabelAlignment property of the series.

  • Set the DataPointLabelOffset to a greater value so the labels will be arranged around a circle with a bigger radius.

For Pie Charts with lots of data points the best approach might be to use a combination of the above-mentioned approaches. The following image shows a chart series that has its DataPointLabelAlignment set to OutsideColumn, DataPointLabelOffset set to 0.5cm and DataPointLabelConnectorStyle .Visible set to true.

Outside Column Pie Chart

The algorithm that moves the data point labels, preventing them from overlapping, is activated only when the labels have their DataPointLabelAngle set to a multiple of 2*π radians in degrees (i.e. 0, 360, etc.).

Merging Small Slices on a Pie Chart

Based on the data, a pie chart may produce too many slices, resulting in unreadable data presentation. To overcome this, slices that are determined insignificant based on particular criteria can be merged into a single dedicated slice on the pie chart.

The merging setup is controlled by the Telerik.Reporting.BarSeries.MergedDataPoints property found under the Layout properties category of the bar series.

To turn on the merge logic, change the Telerik.Reporting.MergedDataPoints.MergeMode property from None to SingleSlice. Next thing is to choose between four different modes (algorithms) for splitting the slices (or data points) to significant ones and small ones. This is controlled from the Telerik.Reporting.MergedDataPoints.ThresholdMode property values, which can be found in the Telerik.Reporting.ThresholdMode enumeration. Based on the chosen mode, an appropriate Telerik.Reporting.MergedDataPoints.ThresholdValue should be set. The value of each slice being considered for merging is evaluated over the Telerik.Reporting.BarSeries.X property. Telerik.Reporting.MergedDataPoints.ThresholdMode supports expressions. The expression must evaluate to the needed number type.

By default, the merged slice is labeled in the chart’s legend as Others. You can change this by setting the Telerik.Reporting.MergedDataPoints.LegendItemLabel. It supports expressions.

The styling of the merged data point, its label or the corresponding legend item can be customized using the corresponding Conditional Formatting property using the Filter:
= IsMergedData() | Operator.Equals | = True

See Also

In this article