Class XlsChartLegend
- Namespace
- Spire.Xls.Core.Spreadsheet.Charts
- Assembly
- Spire.XLS.dll
public class XlsChartLegend : XlsObject, IExcelApplication, IDisposable, IChartLegend
- Inheritance
-
XlsChartLegend
- Implements
- Derived
- Inherited Members
Properties
AutoPosition
Automatic positioning .
public bool AutoPosition { get; }
Property Value
AutoPositionX
X positioning is automatic.
public bool AutoPositionX { get; set; }
Property Value
AutoPositionY
Y positioning is automatic.
public bool AutoPositionY { get; set; }
Property Value
FrameFormat
public IChartFrameFormat FrameFormat { get; }
Property Value
HasDataTable
True if chart contains data table.
public bool HasDataTable { get; set; }
Property Value
Height
Y-size. 1/4000 of chart plot. IsHMode Shall set to True
public int Height { get; set; }
Property Value
IncludeInLayout
Show legend without overlapping. Default is True.
public bool IncludeInLayout { get; set; }
Property Value
InnerLayoutTarget
public bool InnerLayoutTarget { get; set; }
Property Value
IsHMode
false value Specifies that the Height shall be interpreted as the Bottom of the chart element..
public bool IsHMode { get; set; }
Property Value
IsVerticalLegend
Indicates whether if vertical legend.
public bool IsVerticalLegend { get; set; }
Property Value
IsWMode
false value Specifies that the Width shall be interpreted as the Right of the chart element..
public bool IsWMode { get; set; }
Property Value
IsXMode
true value Specifies that the X shall be interpreted as the Left of the chart element..
public bool IsXMode { get; set; }
Property Value
IsYMode
true value Specifies that the Y shall be interpreted as the Top of the chart element..
public bool IsYMode { get; set; }
Property Value
LegendEntries
Represents legend entries collection. Read only.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Get the count of legend entriesint legendEntriesCount = chart.Legend.LegendEntries.Count;if(legendEntriesCount != 0){ //Your code here }//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartLegendEntries LegendEntries { get; }
Property Value
Position
Legend position type.
public LegendPositionType Position { get; set; }
Property Value
TextArea
Return text area of legend.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Set chart typechart.ChartType = ExcelChartType.Cone3DClustered;//Set text area for the legendchart.Legend.TextArea.Color = Color.Gray;chart.Legend.TextArea.Size = 10;chart.Legend.TextArea.FontName = "Bernard MT Condensed";//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartTextArea TextArea { get; }
Property Value
Width
X-size. 1/4000 of chart plot. IsWMode Shall set to True
public int Width { get; set; }
Property Value
X
X-position of upper-left corner. 1/4000 of chart plot. IsXMode Shall set to True
public int X { get; set; }
Property Value
Y
Y-position of upper-left corner. 1/4000 of chart plot. IsYMode Shall set to True
public int Y { get; set; }
Property Value
Methods
Clear()
Clears chart legend.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Clears the legend of chartworksheet.Charts[0].Legend.Clear();//Save to fileworkbook.SaveToFile("Chart.xlsx");
public void Clear()
Clone(object, Dictionary<int, int>, Dictionary<string, string>)
public XlsChartLegend Clone(object parent, Dictionary<int, int> dicFontIndexes, Dictionary<string, string> dicNewSheetNames)
Parameters
parent
objectdicFontIndexes
Dictionary<int, int>dicNewSheetNames
Dictionary<string, string>
Returns
Delete()
Deletes chart legend.
//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Create chart and set rangeIChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["B2:C6"];//Clears the legend of chartworksheet.Charts[0].Legend.Delete();//Save to fileworkbook.SaveToFile("Chart.xlsx");
public void Delete()