Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

LegendEntry Interface

A single legend entry in a chart legend.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

#Declaration

public interface LegendEntry

The following members return LegendEntry objects:

#Remarks

To hide a single legend entry or change its font, add a LegendEntry instance to the Legend.CustomEntries collection at the required LegendEntry.Index and specify the LegendEntry.Hidden and LegendEntry.Font properties.

The example below removes entries from the chart legend.

View Example

Worksheet worksheet = workbook.Worksheets["chartTask3"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:F6"]);
chart.TopLeftCell = worksheet.Cells["H2"];
chart.BottomRightCell = worksheet.Cells["N14"];

// Exclude entries from the legend.
chart.Legend.CustomEntries.Add(2).Hidden = true;
chart.Legend.CustomEntries.Add(3).Hidden = true;
See Also