How to: Change the Display Format for Series Labels of a Pie Chart

  • 3 minutes to read

This tutorial demonstrates how to change the display format for Pie chart series labels at design time to show both arguments and values as real values, and not percentages.

To change the display format of series labels, do the following.

  1. Create a simple unbound chart of the PieSeriesView type. Or, for an existing chart, change the view of its series to Pie.

    The following image demonstrates the points added to the Pie series (for more information, refer to Manually Add Points to a Series).

    PieSeriesCollectionEditor

  2. After this step, the Pie chart will appear as follows (with its legend hidden).

    PieSeriesView

    The next steps demonstrate how to customize the display format of pie series labels.

  3. By default, Pie series labels display their point values as percentages. To make them display real values, do the following.

    • Click the Pie series in the Chart control to select it.
    • In the Properties window, locate the SeriesLabelBase.TextPattern property and set its value to the "{V}" pattern.

    PieSeriesLabel_TextPattern

    You can also specify this text pattern for series labels using the Pattern Editor or via the Chart Designer (this method is not illustrated in this example).

  4. To invoke the Pattern Editor, click the ellipsis button of the SeriesLabelBase.TextPattern property in the Properties window, as shown below.

    InvokePatternEditor

  5. To specify the "{V}" pattern, double click the Value placeholder in the "Placeholders:" column of the Pattern Editor.

    PatternEditor_Value

    The "{V}" pattern appears in the "Pattern:" column. To save this pattern, click OK. This closes the editor.

    After applying the pattern, the Pie series labels show real values.

    PieSeriesLabels_RealValues

    To display both arguments and values in series labels and apply the currency format to the point values, do the following:

  6. Invoke the Pattern Editor, as you did in the previous step.
  7. Select Currency from the "Format:" drop-down list and click the second format.

    This adds the format specifier to the "{V}" pattern in the "Pattern:" editor column.

    PatternEditor_ApplyCurrencyFormat

    You can see the preliminary result of applying this format in the preview at the bottom of the "Pattern:" column.

  8. To add the Argument placeholder before the "{V:$0}" pattern, place the mouse cursor at the start line position in the "Pattern:" column. Then, double click Argument in the "Placeholders:" column.

    PatternEditor_AddArgument

  9. Finally, specify the colon separator after the "{A}" pattern in the "Pattern:" column.

    PatternEditor_AddColonSeparator.

    To apply the pattern, click OK.

The result is shown in the following image.

PieSeriesPointsCurrencyFormat

In addition, you can perform similar operations for the Pie chart's legend (e.g., to make it display values as percentages and show the arguments as well).

To learn how to do this, refer to How to: Show Currency Values in the Legend of a Pie Chart.

See Also