windowsforms-119266-controls-and-libraries-chart-control-series-total-labels.md
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 :
The Pie Total Label displays the total value of all Pie (Doughnut) series’ points.
Follow the steps below to access the Pie Total Label’s settings at design time.
The same customization can be performed at the runtime. The example below demonstrates this.
Use the PieSeriesView.TotalLabel property to access settings that configure a Pie (Doughnut) series’ Total Label.
PieTotalLabel totalLabel = ((DoughnutSeriesView)pieChart.Series["Country Areas"].View).TotalLabel;
totalLabel.Visible = true;
totalLabel.TextPattern = "Total area\n{TV:F2} km\xB2";
Dim totalLabel As PieTotalLabel = CType(pieChart.Series("Country Areas").View, DoughnutSeriesView).TotalLabel
totalLabel.Visible = True
totalLabel.TextPattern = "Total area" & vbLf & "{TV:F2} km" & ChrW(&HB2).ToString()
Stacked Bar Total Labels show Stacked Bar series groups’ total values.
Follow the steps below to access the Stacked Bar Total Labels’ settings at design time.
Select a Pane on which Stacked Bar Series that Total Labels should accompany are plotted.
In the Properties window, expand the XYDiagramPaneBase.StackedBarTotalLabel property.
Configure the Total Label’s parameters to meet your requirements.
The same customization can be performed at the runtime. The example below demonstrates this.
The XYDiagramPaneBase.StackedBarTotalLabel property allows you to configure total labels of stacked bars that are in the pane. Note that Total labels’ settings are not shared between Panes. Thus, you can configure Total Labels that are on various panes differently.
StackedBarTotalLabel totalLabel = ((XYDiagram)cartesianChart.Diagram).DefaultPane.StackedBarTotalLabel;
totalLabel.Visible = true;
totalLabel.ShowConnector = true;
totalLabel.TextPattern = "Total:\n{TV:F2}";
Dim totalLabel As StackedBarTotalLabel = CType(cartesianChart.Diagram, XYDiagram).DefaultPane.StackedBarTotalLabel
totalLabel.Visible = True
totalLabel.ShowConnector = True
totalLabel.TextPattern = "Total:" & vbLf & "{TV:F2}"