Back to Devexpress

SeriesBase.ShowInLegend Property

corelibraries-devexpress-dot-xtracharts-dot-seriesbase-65b89d38.md

latest5.1 KB
Original Source

SeriesBase.ShowInLegend Property

Gets or sets a value that specifies whether the data series is represented in the chart control’s legend.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public virtual bool ShowInLegend { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Overridable Property ShowInLegend As Boolean

Property Value

TypeDescription
Boolean

true to represent the data series in the legend; otherwise, false.

|

Remarks

Use the ShowInLegend property to control whether the data series is indicated within the chart control’s legend.

Note that if this property is customized at the level of a series template object (which is accessed via the ChartControl.SeriesTemplate/WebChartControl.SeriesTemplate property), it controls the indication of all automatically generated series within the legend of the chart control in the following manner:

  • If this property is set to true , each data series from the bound data source (which is specified via the ChartControl.DataSource property) is represented within the legend and can be identified by its color (if legend markers are visible due to the Legend.MarkerVisible property’s setting) and its name (which is taken from the data source’s field specified via the ChartControl.SeriesDataMember property).
  • If the ShowInLegend property is set to false , none of the data series obtained from the chart control’s data source is represented within the legend.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowInLegend 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-charts-show-chart-legend-with-markers-in-separate-control/CS/Form1.cs#L51

csharp
currentSeries = fakeSeries;
    fakeSeries.ShowInLegend = true;
}

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/CS/CustomSeriesPointDrawingSample/Form1.cs#L62

csharp
for (int i = 1; i < chart.Series.Count; ++i)
        chart.Series[i].ShowInLegend = false;
}

winforms-charts-show-chart-legend-with-markers-in-separate-control/VB/Form1.vb#L47

vb
currentSeries = fakeSeries
    fakeSeries.ShowInLegend = True
Else

winforms-chart-draw-a-custom-legend-marker-for-a-series-point/VB/CustomSeriesPointDrawingSample/Form1.vb#L67

vb
While i < Me.chart.Series.Count
    Me.chart.Series(CInt((i))).ShowInLegend = False
    Call System.Threading.Interlocked.Increment(i)

See Also

LegendText

Legends

SeriesBase Class

SeriesBase Members

DevExpress.XtraCharts Namespace