corelibraries-devexpress-dot-xtracharts-dot-customdrawseriespointeventargs-61bb64bd.md
Gets or sets the text of a label for the point currently being painted.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public string LabelText { get; set; }
Public Property LabelText As String
| Type | Description |
|---|---|
| String |
A String representing a label’s text.
|
Use the LabelText property to change the text of a label for the point currently being painted when handling the ChartControl.CustomDrawSeriesPoint event. For a series with points containing two labels, you can also specify the CustomDrawSeriesPointEventArgs.SecondLabelText property.
Note
If the LabelText property is set to Empty or null ( Nothing in Visual Basic), this label will be hidden.
Handle the ChartControl.CustomDrawSeriesPoint event to conditionally hide series labels. In the event handler, change the CustomDrawSeriesPointEventArgs.LabelText property value to String.Empty to hide a label.
Note
Handling the WebChartControl.CustomDrawSeriesPoint (ChartControlSettings.CustomDrawSeriesPoint) event is necessary to perform the same for the Chart Control for ASP.NET and MVC.
private void OnCustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e) {
if (e.SeriesPoint.Values[0] < 1) {
e.LabelText = String.Empty;
}
}
Private Sub OnCustomDrawSeriesPoint(ByVal sender As Object, ByVal e As CustomDrawSeriesPointEventArgs) Handles chartControl1.CustomDrawSeriesPoint
If e.SeriesPoint.Values(0) < 1 Then
e.LabelText = String.Empty
End If
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the LabelText 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#L68
string formattedValue = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row);
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;
void CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e) {
e.LabelText = e.SeriesPoint.Argument + " - " + e.LabelText;
e.LegendText = e.SeriesPoint.Argument;
string formattedValue = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row);
e.LabelText = e.SeriesPoint.Argument + " - " + formattedValue;
e.LegendText = e.SeriesPoint.Argument;
winforms-chart-conditionally-hide-series-labels/CS/Form1.cs#L30
if(!e.Series.Points.Max(p => p.ArgumentX.NumericalArgument).Equals(e.SeriesPoint.NumericalArgument)) {
e.LabelText = "";
}
winforms-dashboard-custom-items/VB/TutorialsCustomItems/CustomItems/FunnelItemControlProvider.vb#L68
Dim formattedValue As String = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row)
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument
Private Sub CustomDrawSeriesPoint(ByVal sender As Object, ByVal e As CustomDrawSeriesPointEventArgs)
e.LabelText = e.SeriesPoint.Argument & " - " & e.LabelText
e.LegendText = e.SeriesPoint.Argument
Dim formattedValue As String = flatData.GetDisplayText(dashboardItem.Metadata.Value.UniqueId, row)
e.LabelText = e.SeriesPoint.Argument & " - " & formattedValue
e.LegendText = e.SeriesPoint.Argument
winforms-chart-conditionally-hide-series-labels/VB/Form1.vb#L28
If Not Enumerable.Max(e.Series.Points, Function(p) p.ArgumentX.NumericalArgument).Equals(e.SeriesPoint.NumericalArgument) Then
e.LabelText = ""
End If
See Also
CustomDrawSeriesPointEventArgs Class