Table of Contents

Class XlsChartShape

Namespace
Spire.Xls.Core.Spreadsheet.Shapes
Assembly
Spire.XLS.dll
public class XlsChartShape : XlsShape, IDisposable, ICloneParent, INamedObject, IChartShape, IShape, IExcelApplication, IChart
Inheritance
XlsChartShape
Implements
Derived
Inherited Members

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

BottomRow

Bottom row of the chart in the worksheet.

public int BottomRow { get; set; }

Property Value

int

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

ChartSubTitle

Gets the chart's sub-title. Only for ODS format file.

public string ChartSubTitle { get; }

Property Value

string

ChartTitle

Represents the title of the specified chart.

public string ChartTitle { get; set; }

Property Value

string

ChartTitleArea

public IChartTextArea ChartTitleArea { get; }

Property Value

IChartTextArea

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

CheckBoxes

public ICheckBoxes CheckBoxes { get; }

Property Value

ICheckBoxes

CodeName

public string CodeName { get; }

Property Value

string

ComboBoxes

public IComboBoxes ComboBoxes { get; }

Property Value

IComboBoxes

DataRange

DataRange for the chart series.

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

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

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 worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add data
worksheet.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 range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set Chart elevation
chart.ChartType = ExcelChartType.Column3DClustered;
chart.Elevation = 50;

//Save to file
workbook.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

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; set; }

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 worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add data
worksheet.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 range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set Chart data table
chart.HasDataTable = true;

//Save to file
workbook.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 worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add data
worksheet.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 range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set hasLegend
chart.HasLegend = false;

//Save to file
workbook.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

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

IsRightToLeft

Indicates whether chart is displayed right to left.

public bool IsRightToLeft { get; set; }

Property Value

bool

LeftColumn

Left column of the chart in the worksheet.

public int LeftColumn { get; set; }

Property Value

int

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

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 worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add data
worksheet.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 range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set Chart perspective
chart.ChartType = ExcelChartType.Column3DClustered;
chart.Perspective = 70;

//Save to file
workbook.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

PrimaryFormats

Returns chart format collection in primary axis.

public XlsChartFormatCollection PrimaryFormats { get; }

Property Value

XlsChartFormatCollection

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

RightColumn

Right column of the chart in the worksheet.

public int RightColumn { get; set; }

Property Value

int

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 worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Add data
worksheet.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 range
Chart chart = worksheet.Charts.Add();
chart.DataRange = worksheet.Range["A1:C2"];

//Set Chart rotation
chart.ChartType = ExcelChartType.Column3DClustered;
chart.Rotation = 50;

//Save to file
workbook.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

public string SecondaryCategoryAxisTitle { get; set; }

Property Value

string

SecondaryFormats

Returns chart format collection in secondary axis.

public XlsChartFormatCollection SecondaryFormats { get; }

Property Value

XlsChartFormatCollection

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. The following code illustrates how to set SeriesDataFromRange property 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 set SeriesDataFromRangeIChart chart = workbook.Charts.Add();chart.DataRange = worksheet.Range["A1:C2"];chart.SeriesDataFromRange = false;//Save to fileworkbook.SaveToFile("Chart.xlsx");
public bool SeriesDataFromRange { get; set; }

Property Value

bool

Shapes

public IShapes Shapes { get; }

Property Value

IShapes

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

SupportWallsAndFloor

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

public bool SupportWallsAndFloor { get; }

Property Value

bool

TextBoxes

public ITextBoxes TextBoxes { get; }

Property Value

ITextBoxes

TopRow

Top row of the chart in the worksheet.

public int TopRow { get; set; }

Property Value

int

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

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

Methods

AddShapeInChart(ExcelShapeType, ResizeBehaveType, int, int, int, int)

public IShape AddShapeInChart(ExcelShapeType type, ResizeBehaveType placement, int left, int top, int height, int width)

Parameters

type ExcelShapeType
placement ResizeBehaveType
left int
top int
height int
width int

Returns

IShape

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

Creates a clone of the current shape.

public virtual IShape Clone(object parent, Dictionary<string, string> hashNewNames, Dictionary<int, int> dicFontIndexes, bool addToCollections)

Parameters

parent object

New parent for the shape object.

hashNewNames Dictionary<string, string>

Hashtable with new worksheet names.

dicFontIndexes Dictionary<int, int>

Dictionary with new font indexes.

addToCollections bool

Returns

IShape

A copy of the current shape.

RefreshChart()

public void RefreshChart()