Click or drag to resize

IChartLegendEntry Methods

The IChartLegendEntry type exposes the following members.

Methods
Name Description
Public method Code example Delete
Deletes current legend entry.
Examples
The following code illustrates how to use Delete method for legend:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Create chart and set range</para><para>IChart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["B2:C6"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Cone3DClustered;</para><para>//Create a chartLegend</para><para>IChartLegend chartLegend = chart.Legend;</para><para>//Delete the first legend entry out of five entires</para><para>chartLegend.LegendEntries[0].Delete();</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Top
See Also