corelibraries-devexpress-dot-xtracharts-dot-customdrawserieseventargsbase-73859885.md
Gets or sets the text of the legend item of the series or series point that is currently being painted.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public string LegendText { get; set; }
Public Property LegendText As String
| Type | Description |
|---|---|
| String |
The text of the legend for the series currently being painted.
|
If the LegendText property is set to Empty or null ( Nothing in Visual Basic), the corresponding legend item will be hidden.
This example demonstrates how you can conditionally customize legend items in the ChartControl.CustomDrawSeriesPoint event handler.
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
private void chartControl1_CustomDrawSeriesPoint(object sender,
CustomDrawSeriesPointEventArgs e) {
if (Convert.ToDouble(e.SeriesPoint.Values[0]) > 5) {
e.LegendText = "exceeded";
e.LegendTextColor = Color.Red;
}
else {
e.LegendMarkerVisible = false;
e.LegendTextVisible = false;
}
}
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 Convert.ToDouble(e.SeriesPoint.Values(0)) > 5 Then
e.LegendText = "exceeded"
e.LegendTextColor = Color.Red
Else
e.LegendMarkerVisible = False
e.LegendTextVisible = False
End If
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the LegendText property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-dashboard-custom-items/CS/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.cs#L69
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;
}
e.LabelText = e.SeriesPoint.Argument + " - " + e.LabelText;
e.LegendText = e.SeriesPoint.Argument;
}
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;
}
winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L69
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument
End Sub
e.LabelText = e.SeriesPoint.Argument & " - " & e.LabelText
e.LegendText = e.SeriesPoint.Argument
End Sub
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument
End Sub
See Also
CustomDrawSeriesEventArgsBase Class