Table of Contents

Class XlsChart

Namespace
Spire.Xls.Core.Spreadsheet.Charts
Assembly
Spire.XLS.dll
public class XlsChart : XlsWorksheetBase, IDisposable, INamedObject, ITabSheet, IExcelApplication, IChart, ICloneParent
Inheritance
XlsChart
Implements
Derived
Inherited Members

Fields

DEF_SUPPORT_ERROR_BARS

public static readonly string[] DEF_SUPPORT_ERROR_BARS

Field Value

string[]

DEF_SUPPORT_SERIES_AXIS

public static readonly ExcelChartType[] DEF_SUPPORT_SERIES_AXIS

Field Value

ExcelChartType[]

DEF_SUPPORT_TREND_LINES

public static readonly ExcelChartType[] DEF_SUPPORT_TREND_LINES

Field Value

ExcelChartType[]

m_book

protected XlsWorkbook m_book

Field Value

XlsWorkbook

Properties

AutoScaling

True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart. The following code illustrates how to set auto scaling for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set auto scalingchart.ChartType = ExcelChartType.Column3DClustered;chart.HeightPercent = 50;chart.AutoScaling = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool AutoScaling { get; set; }

Property Value

bool

CanChartBubbleLabel

Returns True if chart can have bubble data labels. Read-only.

public bool CanChartBubbleLabel { get; }

Property Value

bool

CanChartHaveSeriesLines

Returns True if chart can have series lines. Read-only.

public bool CanChartHaveSeriesLines { get; }

Property Value

bool

CanChartPercentageLabel

Returns True if chart can have percentage data labels. Read-only.

public bool CanChartPercentageLabel { get; }

Property Value

bool

CategoryAxisTitle

Title of the category axis.

public string CategoryAxisTitle { get; set; }

Property Value

string

ChartArea

Returns an object that represents the complete chart area for the chart. Read-only. The following code illustrates how to access IChartFrameFormat using ChartArea property and set foreground color for the ChartArea:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart frame formatIChartFrameFormat frameFormat = chart.ChartArea;//Set colorframeFormat.Fill.ForeColor = System.Drawing.Color.Red;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartFrameFormat ChartArea { get; }

Property Value

IChartFrameFormat

ChartStartType

Returns start type of chart type. Read-only.

public string ChartStartType { get; }

Property Value

string

ChartTitle

Title of the chart.

public string ChartTitle { get; set; }

Property Value

string

ChartTitleFont

public IFont ChartTitleFont { get; }

Property Value

IFont

ChartType

Type of the chart. The following code illustrates how to set ExcelChartType.PyramidBarStacked to ChartType property:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and set chart typeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];chart.ChartType = ExcelChartType.PyramidBarStacked;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public ExcelChartType ChartType { get; set; }

Property Value

ExcelChartType

DataRange

DataRange for the chart series. The following code illustrates how to set the data range for the chart:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and set rangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IXLSRange DataRange { get; set; }

Property Value

IXLSRange

DataTable

Represents charts dataTable object. The following code illustrates how to set HasDataTable to "true" to enable data table and set IChartDataTable.HasBorders to "false" to hide the borders of data table:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart data tablechart.HasDataTable = true;IChartDataTable dataTable = chart.DataTable;//Set borderdataTable.HasBorders = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartDataTable DataTable { get; }

Property Value

IChartDataTable

DefaultLinePattern

Returns default line pattern for the chart. Read-only.

public ChartLinePatternType DefaultLinePattern { get; }

Property Value

ChartLinePatternType

DefaultTextIndex

[Obsolete("get and set are not implemented")]
public int DefaultTextIndex { get; }

Property Value

int

DepthPercent

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). The following code illustrates how to set DepthPercent to a Column 3D chart:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart depth percentchart.ChartType = ExcelChartType.Column3DClustered;chart.DepthPercent = 500;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int DepthPercent { get; set; }

Property Value

int

DestinationType

Gets chart type after type change.

public ExcelChartType DestinationType { get; set; }

Property Value

ExcelChartType

DisplayAxisFieldButtons

public bool DisplayAxisFieldButtons { get; set; }

Property Value

bool

DisplayBlanksAs

Represents the way that blank cells are plotted on a chart.

public ChartPlotEmptyType DisplayBlanksAs { get; set; }

Property Value

ChartPlotEmptyType

DisplayEntireFieldButtons

public bool DisplayEntireFieldButtons { get; set; }

Property Value

bool

DisplayLegendFieldButtons

public bool DisplayLegendFieldButtons { get; set; }

Property Value

bool

DisplayValueFieldButtons

public bool DisplayValueFieldButtons { get; set; }

Property Value

bool

Elevation

Returns or sets the elevation of the 3-D chart view, in degrees (?0 to +90 degrees). The following code illustrates how to set Rotation for 3-D charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart elevationchart.ChartType = ExcelChartType.Column3DClustered;chart.Elevation = 50;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int Elevation { get; set; }

Property Value

int

Floor

Represents chart floor. Read-only. The following code illustrates how to access IChartWallOrFloor using Floor property and set foreground color for the chart's Floor:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Get chartChart chart = worksheet.Charts[0];//Set chart wallIChartWallOrFloor floor = chart.Floor;//Set colorfloor.Fill.FillType = ShapeFillType.SolidColor;floor.Fill.ForeColor = System.Drawing.Color.Red;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartWallOrFloor Floor { get; }

Property Value

IChartWallOrFloor

Font

Gets font which used for displaying axis text .

public FontWrapper Font { get; }

Property Value

FontWrapper

GapDepth

Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width.( 0 - 500 ) The following code illustrates how to set GapDepth to a Column 3D chart:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set gap depthchart.ChartType = ExcelChartType.Column3DClustered;chart.GapDepth = 450;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int GapDepth { get; set; }

Property Value

int

HasChartArea

Indicates whether chart has chart area.

public bool HasChartArea { get; set; }

Property Value

bool

HasChartTitle

Indicates wheather the chart has title

public bool HasChartTitle { get; }

Property Value

bool

HasDataTable

True if the chart has a data table. The following code illustrates how data table can be set for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart data tablechart.HasDataTable = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasDataTable { get; set; }

Property Value

bool

HasFloor

Gets value indicating whether floor object was created.

public bool HasFloor { get; }

Property Value

bool

HasLegend

True if the chart has a legend object. The following code illustrates how to set HasLegend property:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set hasLegendchart.HasLegend = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool HasLegend { get; set; }

Property Value

bool

HasPivotTable

Indicates whether contains pivot table.

public bool HasPivotTable { get; }

Property Value

bool

HasPlotArea

Indicates whether chart has plot area.

public bool HasPlotArea { get; set; }

Property Value

bool

HasWalls

Gets value indicating whether floor object was created.

public bool HasWalls { get; }

Property Value

bool

Height

Height of the chart in points (1/72 inch).

public double Height { get; set; }

Property Value

double

HeightPercent

Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent). The following code illustrates how to set HeightPercent to a Column 3D chart:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                        worksheet.Range["B1"].Text = "Feb";
                        worksheet.Range["C1"].Text = "Mar";
                        worksheet.Range["A2"].Text = "10";
                        worksheet.Range["B2"].Text = "20";
                        worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart height percentchart.ChartType = ExcelChartType.Column3DClustered;chart.AutoScaling = false;chart.HeightPercent = 50;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int HeightPercent { get; set; }

Property Value

int

IsCategoryAxisAvail

Indicates whether chart has a category axis. Read-only.

public bool IsCategoryAxisAvail { get; }

Property Value

bool

IsChart3D

Returns True if chart is 3D. Read-only.

public bool IsChart3D { get; }

Property Value

bool

IsChartBar

Returns True if chart is a bar chart. Read-only.

public bool IsChartBar { get; }

Property Value

bool

IsChartBubble

Returns True if chart is a bubble chart. Read-only.

public bool IsChartBubble { get; }

Property Value

bool

IsChartCone

Returns True if chart is a conical shape. Read-only.

public bool IsChartCone { get; }

Property Value

bool

IsChartCylinder

Returns True if chart is a cylinder shape. Read-only.

public bool IsChartCylinder { get; }

Property Value

bool

IsChartDoughnut

Returns True if chart is a doughnut chart. Read-only.

public bool IsChartDoughnut { get; }

Property Value

bool

IsChartExploded

Returns True if chart is exploded. Read-only.

public bool IsChartExploded { get; }

Property Value

bool

IsChartFloor

Returns True if chart has floor. Read-only.

public bool IsChartFloor { get; }

Property Value

bool

IsChartLine

Returns True if chart is line. Read-only.

public bool IsChartLine { get; }

Property Value

bool

IsChartPie

Returns True if chart is a pie chart. Read-only.

public bool IsChartPie { get; }

Property Value

bool

IsChartPyramid

Returns True if chart is a pyramid shape. Read-only.

public bool IsChartPyramid { get; }

Property Value

bool

IsChartRadar

Returns True if chart is a radar chart. Read-only.

public bool IsChartRadar { get; }

Property Value

bool

IsChartScatter

Returns True if chart is a scatter chart. Read-only.

public bool IsChartScatter { get; }

Property Value

bool

IsChartSmoothedLine

Returns True if chart has smoothed lines. Read-only.

public bool IsChartSmoothedLine { get; }

Property Value

bool

IsChartStock

Returns True if this is a stock chart. Read-only.

public bool IsChartStock { get; }

Property Value

bool

IsChartVeryColor

Returns True if chart should have a different color for each series value. Read-only.

public bool IsChartVeryColor { get; }

Property Value

bool

IsChartVolume

Returns True if chart is a stock chart with volume. Read-only.

public bool IsChartVolume { get; }

Property Value

bool

IsChartWalls

Returns True if chart has walls. Read-only.

public bool IsChartWalls { get; }

Property Value

bool

IsChart_100

Returns True if chart is 100%. Read-only.

public bool IsChart_100 { get; }

Property Value

bool

IsClustered

Returns True if chart is a clustered chart. Read-only.

public bool IsClustered { get; }

Property Value

bool

IsEmbeded

Gets value indicating whether chart is embeded into worksheet.

public bool IsEmbeded { get; }

Property Value

bool

IsPerspective

Returns True if chart has perspective. Read-only.

public bool IsPerspective { get; }

Property Value

bool

IsPivot3DChart

Gets a value indicating whether this instance is pivot 3D chart .

public bool IsPivot3DChart { get; }

Property Value

bool

IsSecondaryAxes

[Obsolete("get and set are not implemented")]
public bool IsSecondaryAxes { get; set; }

Property Value

bool

IsSecondaryCategoryAxisAvail

[Obsolete("get and set are not implemented")]
public bool IsSecondaryCategoryAxisAvail { get; }

Property Value

bool

IsSecondaryValueAxisAvail

[Obsolete("get and set are not implemented")]
public bool IsSecondaryValueAxisAvail { get; }

Property Value

bool

IsSeriesAxisAvail

[Obsolete("get and set are not implemented")]
public bool IsSeriesAxisAvail { get; }

Property Value

bool

IsSeriesLines

Returns True if chart has series lines. Read-only.

public bool IsSeriesLines { get; }

Property Value

bool

IsSpecialDataLabels

Returns True if chart needs special data labels serialization. Read-only.

public bool IsSpecialDataLabels { get; }

Property Value

bool

IsStacked

Returns True if chart is stacked. Read-only.

public bool IsStacked { get; }

Property Value

bool

IsValueAxisAvail

Indicates whehter chart has a value axis. Read-only.

public bool IsValueAxisAvail { get; }

Property Value

bool

Legend

Represents chart legend. The following code illustrates how to access IChartLegend using IChart.Legend property and set IChartLegend.Position to LegendPositionType.Left:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart legend and legend positionIChartLegend legend = chart.Legend;legend.Position = LegendPositionType.Left;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartLegend Legend { get; }

Property Value

IChartLegend

NeedDataFormat

Returns True if chart needs data format to be saved. Read-only.

public bool NeedDataFormat { get; }

Property Value

bool

NeedDropBar

Returns True if chart needs drop bars to be saved. Read-only.

public bool NeedDropBar { get; }

Property Value

bool

NeedMarkerFormat

Returns True if chart needs marker format to be saved. Read-only.

public bool NeedMarkerFormat { get; }

Property Value

bool

NoPlotArea

Returns True if chart has no plot area. Read-only.

public bool NoPlotArea { get; }

Property Value

bool

PageSetup

Page setup for the chart. Read-only. The following code illustrates how to set paper size:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart page setup and paper sizeIChartPageSetup pageSetup = chart.PageSetup;pageSetup.PaperSize = PaperSizeType.A3TransversePaper;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartPageSetup PageSetup { get; }

Property Value

IChartPageSetup

Perspective

Returns or sets the perspective for the 3-D chart view (0 to 100). The following code illustrates how to set Perspective for the charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart perspectivechart.ChartType = ExcelChartType.Column3DClustered;chart.Perspective = 70;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int Perspective { get; set; }

Property Value

int

PivotChartType

public ExcelChartType PivotChartType { get; set; }

Property Value

ExcelChartType

PivotTable

public PivotTable PivotTable { get; set; }

Property Value

PivotTable

PlotArea

Returns plot area frame format. Read-only. The following code illustrates how to access IChartFrameFormat using PlotArea property and set foreground color for the chart's PlotArea:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart frame formatIChartFrameFormat frameFormat = chart.PlotArea;//Set colorframeFormat.Fill.ForeColor = System.Drawing.Color.Red;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartFrameFormat PlotArea { get; }

Property Value

IChartFrameFormat

PlotVisibleOnly

True if only visible cells are plotted. False if both visible and hidden cells are plotted. The following code illustrates how to set PlotVisibleOnly to "true" so that chart plots all the cells within the chart's DataRange:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Hide column and create chartworksheet.Columns[2].ColumnWidth = 0;Chart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Plot visible onlychart.PlotVisibleOnly = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool PlotVisibleOnly { get; set; }

Property Value

bool

PrimaryCategoryAxis

Primary category axis. Read-only. The following code illustrates how to set the visibility of PrimaryCategoryAxis:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Chart category axisIChartCategoryAxis categoryAxis = chart.PrimaryCategoryAxis;//Set visibilitycategoryAxis.Visible = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartCategoryAxis PrimaryCategoryAxis { get; }

Property Value

IChartCategoryAxis

PrimarySerieAxis

Primary serie axis. Read-only. The following code illustrates how to set the visibility of PrimarySerieAxis:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set chart typechart.ChartType = ExcelChartType.Surface3D;//Chart series axisIChartSeriesAxis seriesAxis = chart.PrimarySerieAxis;//Set visibilityseriesAxis.Visible = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartSeriesAxis PrimarySerieAxis { get; }

Property Value

IChartSeriesAxis

PrimaryValueAxis

Primary value axis. Read-only. The following code illustrates how to set the visibility of PrimaryValueAxis:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Chart value axisIChartValueAxis valueAxis = chart.PrimaryValueAxis;//Set visibilityvalueAxis.Visible = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartValueAxis PrimaryValueAxis { get; }

Property Value

IChartValueAxis

RightAngleAxes

True if the chart axes are at right angles, independent of chart rotation or elevation. The following code illustrates how RightAngleAxes can be set for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart rotation and RightAngleAxeschart.ChartType = ExcelChartType.Column3DClustered;chart.Rotation = 50;chart.RightAngleAxes = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool RightAngleAxes { get; set; }

Property Value

bool

Rotation

Returns or sets the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).(0 to 360 degrees). The following code illustrates how to set Rotation for 3-D charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];//Set Chart rotationchart.ChartType = ExcelChartType.Column3DClustered;chart.Rotation = 50;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public int Rotation { get; set; }

Property Value

int

SecondaryCategoryAxis

Secondary category axis. Read-only. The following code illustrates how to disable PrimaryCategoryAxis and set SecondaryCategoryAxis for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";
                       worksheet.Range["A3"].Value = "100";
                       worksheet.Range["B3"].Value = "200";
                       worksheet.Range["C3"].Value = "300";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set secondary axisIChartSerie serie = chart.Series[1];serie.UsePrimaryAxis = false;chart.SecondaryCategoryAxis.Visible = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartCategoryAxis SecondaryCategoryAxis { get; }

Property Value

IChartCategoryAxis

SecondaryCategoryAxisTitle

Title of the secondary category axis.

public string SecondaryCategoryAxisTitle { get; set; }

Property Value

string

SecondaryValueAxis

Secondary value axis. Read-only. The following code illustrates how to disable PrimaryValueAxis and set SecondaryValueAxis for charts:

//Create worksheetWorkbook workbook = new Workbook();Worksheet worksheet = workbook.Worksheets[0];//Add dataworksheet.Range["A1"].Text = "Jan";
                       worksheet.Range["B1"].Text = "Feb";
                       worksheet.Range["C1"].Text = "Mar";
                       worksheet.Range["A2"].Text = "10";
                       worksheet.Range["B2"].Text = "20";
                       worksheet.Range["C2"].Text = "30";
                       worksheet.Range["A3"].Value = "100";
                       worksheet.Range["B3"].Value = "200";
                       worksheet.Range["C3"].Value = "300";//Create chart and rangeChart chart = worksheet.Charts.Add();chart.DataRange = worksheet.Range["A1:C3"];//Set secondary axisIChartSerie serie = chart.Series[1];serie.UsePrimaryAxis = false;chart.SecondaryValueAxis.Visible = true;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartValueAxis SecondaryValueAxis { get; }

Property Value

IChartValueAxis

SecondaryValueAxisTitle

Title of the secondary value axis.

public string SecondaryValueAxisTitle { get; set; }

Property Value

string

SeriesAxisTitle

Title of the series axis.

public string SeriesAxisTitle { get; set; }

Property Value

string

SeriesDataFromRange

True if series are in rows in DataRange; False otherwise.

public bool SeriesDataFromRange { get; set; }

Property Value

bool

ShowReportFilterFieldButtons

public bool ShowReportFilterFieldButtons { get; set; }

Property Value

bool

SizeWithWindow

True if Microsoft Excel resizes the chart to match the size of the chart sheet window. False if the chart size isn't attached to the window size. Applies only to chart sheets.

public bool SizeWithWindow { get; set; }

Property Value

bool

Style

Style index for Excel 2007 chart.

public int Style { get; set; }

Property Value

int

SupportWallsAndFloor

Indicates whether this chart supports walls and floor. Read-only.

public bool SupportWallsAndFloor { get; }

Property Value

bool

ValueAxisTitle

Title of the value axis.

public string ValueAxisTitle { get; set; }

Property Value

string

Walls

Represents chart walls. Read-only. The following code illustrates how to access IChartWallOrFloor using Walls property and set foreground color for the chart's Walls:

//Create worksheetWorkbook workbook = new Workbook();workbook.LoadFromFile("Sample.xlsx");Worksheet worksheet = workbook.Worksheets[0];//Get chartChart chart = worksheet.Charts[0];//Set chart wallIChartWallOrFloor wall = chart.Walls;//Set colorwall.Fill.FillType = ShapeFillType.SolidColor;wall.Fill.ForeColor = System.Drawing.Color.Red;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public IChartWallOrFloor Walls { get; }

Property Value

IChartWallOrFloor

WallsAndGridlines2D

True if gridlines are drawn two-dimensionally on a 3-D chart.

public bool WallsAndGridlines2D { get; set; }

Property Value

bool

Width

Width of the chart in points (1/72 inch).

public double Width { get; set; }

Property Value

double

XPos

X coordinate of the upper-left corner of the chart in points (1/72 inch).

public double XPos { get; set; }

Property Value

double

YPos

Y coordinate of the upper-left corner of the chart in points (1/72 inch).

public double YPos { get; set; }

Property Value

double

ZoomToFit

Gets or sets zoomToFit value.

public bool ZoomToFit { get; set; }

Property Value

bool

Methods

CheckDataTablePossibility(string, bool)

public static bool CheckDataTablePossibility(string startType, bool bThrowException)

Parameters

startType string
bThrowException bool

Returns

bool

CheckForSupportGridLine()

public bool CheckForSupportGridLine()

Returns

bool

Clone(Dictionary<string, string>, object, Dictionary<int, int>)

[Obsolete("the method is not implemented")]
public XlsChart Clone(Dictionary<string, string> hashNewNames, object parent, Dictionary<int, int> dicFontIndexes)

Parameters

hashNewNames Dictionary<string, string>
parent object
dicFontIndexes Dictionary<int, int>

Returns

XlsChart

Clone(object)

Clones current instance.

public override object Clone(object parent)

Parameters

parent object

Parent object.

Returns

object

Returns clone of current object.

InitializeCollections()

protected override void InitializeCollections()

MoveChartsheet(int)

Moves chartsheet into new position.

public void MoveChartsheet(int destIndex)

Parameters

destIndex int

Destination index.

SetToDefaultGridlines(ExcelChartType)

public void SetToDefaultGridlines(ExcelChartType type)

Parameters

type ExcelChartType