[]
Represents the legend in a chart.
A legend identifies the data series or points plotted in a chart and can be used to control legend position, layout participation, formatting, and legend entries. Use Legend to access the legend for a chart, then customize it through members such as Font, Format, LegendEntries, Position, and Position.
public interface ILegend
Public Interface ILegend
worksheet.Range["A1:C3"].Value = new object[,] {
{"Item", "Sales", "Cost"},
{"North", 100, 80},
{"South", 120, 90}
};
IShape shape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 20, 20, 320, 220);
shape.Chart.SeriesCollection.Add(worksheet.Range["A1:C3"], RowCol.Columns, true, true);
shape.Chart.HasLegend = true;
ILegend legend = shape.Chart.Legend;
legend.Position = LegendPosition.Left;
| Name | Description |
|---|---|
| Font | Gets the IFontFormat object that represents the font of the legend. Use the returned object to access and modify font settings for the legend text, such as color, size, and italic style. |
| Format | Gets the chart format of the legend. |
| IncludeInLayout | Gets or sets whether the legend is included in the chart layout.
If this property is |
| LegendEntries | Gets the collection of legend entries in this legend. |
| Parent | Gets the parent IChart that contains this legend. Use this property to access the chart that owns the current legend. |
| Position | Gets or sets the position of the legend on the chart. |
| Name | Description |
|---|---|
| Delete() | Deletes the legend from its parent chart. After this method is called, the chart no longer displays this legend. |