Back to Devexpress

How to: Make Series Labels Display Custom Information

windowsforms-6816-controls-and-libraries-chart-control-examples-creating-charts-appearance-customization-how-to-make-series-labels-display-custom-information.md

latest1.5 KB
Original Source

How to: Make Series Labels Display Custom Information

  • Nov 13, 2018

This example demonstrates how to make series points labels display custom information, in particular - based on the series points values.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void chartControl1_CustomDrawSeriesPoint(object sender, 
CustomDrawSeriesPointEventArgs e) {
    if(e.SeriesPoint.Values[0] > 1) {
        e.LabelText = "Critical value";
    }
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...

Private Sub chartControl1_CustomDrawSeriesPoint(ByVal sender As Object, _ 
ByVal e As CustomDrawSeriesPointEventArgs) Handles chartControl1.CustomDrawSeriesPoint
    If e.SeriesPoint.Values(0) > 1 Then
        e.LabelText = "Critical value"
    End If
End Sub

The result is shown in the following image.

See Also

How to: Conditionally Hide Series Labels

How to: Avoid Overlapping of Series Labels