Skip to main content
A newer version of this page is available. .

CustomDrawSeriesEventArgsBase.LegendText Property

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.v18.2.dll

Declaration

public string LegendText { get; set; }

Property Value

Type Description
String

The text of the legend for the series currently being painted.

Remarks

If the LegendText property is set to Empty or null (Nothing in Visual Basic), the corresponding legend item will be hidden.

Example

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;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.

See Also