Click or drag to resize

IChartLegend Methods

The IChartLegend type exposes the following members.

Methods
Name Description
Public method Code example Clear
Clears chart legend.
Examples
The following code illustrates how to use the Clear method for legend of chart:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Clears the legend of chart</para><para>worksheet.Charts[0].Legend.Clear();</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Public method Code example Delete
Deletes chart legend.
Examples
The following code illustrates how to use the Delete method for legend of chart:
<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>//Clears the legend of chart</para><para>worksheet.Charts[0].Legend.Delete();</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
Top
See Also