windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-3e927b75.md
Occurs when the ChartControl draws total labels for Pie and Doughnut series.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.UI.dll
NuGet Package : DevExpress.Win.Charts
public event CustomizePieTotalLabelEventHandler CustomizePieTotalLabel
Public Event CustomizePieTotalLabel As CustomizePieTotalLabelEventHandler
The CustomizePieTotalLabel event's data class is CustomizePieTotalLabelEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Series | Returns a pie series whose total label is customized. |
| Text | Gets or sets the total label text. |
| TextColor | Gets or sets the total label’s text color. |
| TotalValue | Returns the total label value. |
The CustomizePieTotalLabel event allows you to customize the total label appearance based on a specific condition.
This example shows how to format the Doughnut series total label text depending on the pie slice total value:
chartControl1.CustomizePieTotalLabel += OnCustomizePieTotalLabel;
//...
private void OnCustomizePieTotalLabel(object sender, CustomizePieTotalLabelEventArgs e) {
if (e.TotalValue > 10000) {
e.TextColor = Color.Green;
e.Text = $"{e.TotalValue / 1000}K";
}
}
chartControl1.CustomizePieTotalLabel += OnCustomizePieTotalLabel
'...
Private Sub OnCustomizePieTotalLabel(ByVal sender As Object, ByVal e As CustomizePieTotalLabelEventArgs)
If e.TotalValue > 10000 Then
e.TextColor = Color.Green
e.Text = $"{e.TotalValue / 1000}K"
End If
End Sub
See Also