Back to Devexpress

Legend.CustomEntries Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-legend-c9fcdbc8.md

latest2.8 KB
Original Source

Legend.CustomEntries Property

Provides access to a collection of modified legend entries.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
LegendEntryCollection CustomEntries { get; }
vb
ReadOnly Property CustomEntries As LegendEntryCollection

Property Value

TypeDescription
LegendEntryCollection

A LegendEntryCollection object that contains modified legend entries.

|

Remarks

When a legend is displayed (Legend.Visible property is true ), you can modify the individual legend entries by adding items to the LegendEntryCollection and setting their properties.

The example below removes entries from the chart legend.

View Example

csharp
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;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As 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

Legend Interface

Legend Members

DevExpress.Spreadsheet.Charts Namespace