Skip to main content

Total Label

  • 3 minutes to read

Total labels display several series points’ total value. A Series View type defines which series points are used to calculate the total value. Stacked Bar Total Labels show Stacked Bar series groups’ total values. The Pie Total Label displays Pie (Doughnut) series points’ total value.

The following sections describe the types of Total Labels:

Pie Total Label

The Pie Total Label displays the total value of all Pie (Doughnut) series points.

chart-control__pie-chart-total-label

How to: Configure the Total Label at Design Time

Do the following to access the settings of a Pie Chart’s Total Label at design time:

  1. Select the Chart Control and click its smart tag to invoke the Chart Control Tasks list. Choose the Run Designer… command:

    chart-control__pie-chart-smart-tag

  2. Expand a series that should show the total label in the Designer’s chart structure tree. Select the total label element and click its eye icon (total-label__designer-show-icon):

    chart-control__pie-chart-show-total-label

  3. Specify the total label’s TotalLabel.TextPattern.

    chart-control__pie-chart-total-label-properties

  4. Close the designer to save the changes.

How to: Configure the Total Label at Runtime

The following example demonstrates how to customize the Pie Total Label at runtime:

Series landAreaSeries = chartControl.Series["Land Area"];
PieSeriesView pieView = landAreaSeries.View as PieSeriesView;
if (pieView == null) return;
pieView.TotalLabel.Visible = true;
pieView.TotalLabel.TextPattern = "Total World Population\r\n{TV:#,#}";

The code above uses the following classes and properties:

Symbol Description
PieSeriesView.TotalLabel Returns settings that configure the Pie series’ total label.
PieTotalLabel The pie’s total labels settings storage.
TotalLabel.Visible Gets or sets the value indicating whether total labels should be visible.
TotalLabel.TextPattern Gets or sets the text pattern the Chart Control uses to generate the Total Label’s text.

Stacked Bar Total Labels

Stacked Bar Total Labels show the total values of Stacked Bar series groups.

chart-control__stacked-bar-chart-total-label

How to: Configure the Total Label at Design Time

Do the following to access the Stacked Bar Total Label settings at design time:

  1. Select the Chart Control, click its smart tag to invoke the Chart Control Tasks list, and choose Run Designer… :

    chart-control__stacked-bars-chart-smart-tag

  2. Navigate to a pane’s Stacked Bar Total Label element in the Designer’s Chart Structure Tree, and click its eye icon (total-label__designer-show-icon). Changes made to the total label object in one pane are not applied to all panes. You should navigate to a specific pane’s label object to modify/show it:

    chart-control__stacked-bars-chart-show-total-labels

  3. Set the total label’s TotalLabel.TextPattern.

    chart-control__stacked-bars-chart-total-label-properties

  4. Close the designer to save the changes.

How to: Configure the Total Label at Runtime

The following example customizes Stacked Bar Total Labels at runtime:

XYDiagram2D diagram = chartControl.Diagram as XYDiagram2D;
if (diagram == null) return;
StackedBarTotalLabel totalLabel = diagram.DefaultPane.StackedBarTotalLabel;
totalLabel.Visible = true;
totalLabel.TextPattern = "{TV:C0}";

The code above uses the following classes and properties:

Symbol Description
XYDiagramPaneBase.StackedBarTotalLabel Returns the settings of total labels that belong to series groups within the pane.
StackedBarTotalLabel The stacked bars’ total labels’ settings storage.
TotalLabel.Visible Gets or sets the value indicating whether total labels should be visible.
TotalLabel.TextPattern Gets or sets the text pattern the Chart Control uses to generate the Total Label’s text.