Back to Devexpress

ChartControl.CustomizePieTotalLabel Event

windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-3e927b75.md

latest3.2 KB
Original Source

ChartControl.CustomizePieTotalLabel Event

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

Declaration

csharp
public event CustomizePieTotalLabelEventHandler CustomizePieTotalLabel
vb
Public Event CustomizePieTotalLabel As CustomizePieTotalLabelEventHandler

Event Data

The CustomizePieTotalLabel event's data class is CustomizePieTotalLabelEventArgs. The following properties provide information specific to this event:

PropertyDescription
SeriesReturns a pie series whose total label is customized.
TextGets or sets the total label text.
TextColorGets or sets the total label’s text color.
TotalValueReturns the total label value.

Remarks

The CustomizePieTotalLabel event allows you to customize the total label appearance based on a specific condition.

Example

This example shows how to format the Doughnut series total label text depending on the pie slice total value:

csharp
chartControl1.CustomizePieTotalLabel += OnCustomizePieTotalLabel;
//...
private void OnCustomizePieTotalLabel(object sender, CustomizePieTotalLabelEventArgs e) {
    if (e.TotalValue > 10000) {
        e.TextColor = Color.Green;
        e.Text = $"{e.TotalValue / 1000}K";
    }
}
vb
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

CustomizeStackedBarTotalLabel

ChartControl Class

ChartControl Members

DevExpress.XtraCharts Namespace