Click or drag to resize

IChartShape Interface

Defines the contract for chart shapes, which can be used to represent various graphical elements in a chart.

Namespace: Spire.Xls.Core
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public interface IChartShape : IShape, 
	IExcelApplication, IChart

The IChartShape type exposes the following members.

Properties
Name Description
Public property AlternativeText
Returns or sets the descriptive (alternative) text string for a Shape object.
(Inherited from IShape .)
Public property Code example AutoScaling
True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.
Examples
The following code illustrates how to set auto scaling for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set auto scaling</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.HeightPercent = 50;</para><para>chart.AutoScaling = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property BottomRow
Bottom row of the chart in the worksheet.
Public property Code example ChartArea
Returns an object that represents the complete chart area for the chart. Read-only.
Examples
The following code illustrates how to access IChartFrameFormat using ChartArea property and set foreground color for the ChartArea:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart frame format</para><para>IChartFrameFormat frameFormat = chart.ChartArea;</para><para>//Set color</para><para>frameFormat.Fill.ForeColor = System.Drawing.Color.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example ChartType
Type of the chart.
Examples
The following code illustrates how to setExcelChartType.PyramidBarStacked to ChartType property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and set chart type</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>chart.ChartType = ExcelChartType.PyramidBarStacked;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example DataRange
DataRange for the chart series.
Examples
The following code illustrates how to set the data range for the chart:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and set range</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example DataTable
Represents charts dataTable object.
Examples
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:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart data table</para><para>chart.HasDataTable = true;</para><para>IChartDataTable dataTable = chart.DataTable;</para><para>//Set border</para><para>dataTable.HasBorders = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example DepthPercent
Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
Examples
The following code illustrates how to set DepthPercent to a Column 3D chart:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart depth percent</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.DepthPercent = 500;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property DisplayAxisFieldButtons
Gets or sets a value indicating whether [show axis field buttons].
(Inherited from IChart .)
Public property DisplayBlanksAs
Represents the way that blank cells are plotted on a chart.
(Inherited from IChart .)
Public property DisplayEntireFieldButtons
Gets or sets a value indicating whether [show all field buttons].
(Inherited from IChart .)
Public property DisplayLegendFieldButtons
Gets or sets a value indicating whether [show legend field buttons].
(Inherited from IChart .)
Public property DisplayValueFieldButtons
Gets or sets a value indicating whether [show value field buttons].
(Inherited from IChart .)
Public property Code example Elevation
Returns or sets the elevation of the 3-D chart view, in degrees (?0 to +90 degrees).
Examples
The following code illustrates how to set Rotation for 3-D charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart elevation</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.Elevation = 50;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Fill
Gets the fill style of the shape.
(Inherited from IShape .)
Public property Code example Floor
Represents chart floor. Read-only.
Examples
The following code illustrates how to access IChartWallOrFloor using Floor property and set foreground color for the chart's Floor:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get chart</para><para>Chart chart = worksheet.Charts[0];</para><para>//Set chart wall</para><para>IChartWallOrFloor floor = chart.Floor;</para><para>//Set color</para><para>floor.Fill.FillType = ShapeFillType.SolidColor;</para><para>floor.Fill.ForeColor = System.Drawing.Color.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example GapDepth
Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width.( 0 - 500 )
Examples
The following code illustrates how to set GapDepth to a Column 3D chart:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set gap depth</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.GapDepth = 450;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Glow
Gets the glow effect applied to the object.
(Inherited from IShape .)
Public property Code example HasDataTable
True if the chart has a data table.
Examples
The following code illustrates how data table can be set for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart data table</para><para>chart.HasDataTable = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example HasLegend
True if the chart has a legend object.
Examples
The following code illustrates how to set HasLegend property:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set hasLegend</para><para>chart.HasLegend = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property HasPlotArea
Indicates whether chart has plot area.
(Inherited from IChart .)
Public property Height
The height of the object. Read/write Integer
(Inherited from IShape .)
Public property Code example HeightPercent
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
Examples
The following code illustrates how to set HeightPercent to a Column 3D chart:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart height percent</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.AutoScaling = false;</para><para>chart.HeightPercent = 50;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property HtmlString
Gets and sets the html string which contains data and some formattings in this shape.
(Inherited from IShape .)
Public property ID
Returns the type for the specified object. Read-only Integer.
(Inherited from IShape .)
Public property IsLockAspectRatio
True means that don't allow changes in aspect ratio.
(Inherited from IShape .)
Public property IsLocked
True if the object is locked, False if the object can be modified when the sheet is protected.
(Inherited from IShape .)
Public property IsPrintable
True if the object is printable
(Inherited from IShape .)
Public property IsSmartArt
Gets a value indicating whether the object is a SmartArt graphic.
(Inherited from IShape .)
Public property Left
The distance from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart). Read/write Integer.
(Inherited from IShape .)
Public property LeftColumn
Left column of the chart in the worksheet.
Public property Code example Legend
Represents chart legend.
Examples
The following code illustrates how to access IChartLegend using IChart.Legend property and set IChartLegend.Position to LegendPositionType.Left:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart legend and legend position</para><para>IChartLegend legend = chart.Legend;</para><para>legend.Position = LegendPositionType.Left;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Line
Returns the border line object of a shape.
(Inherited from IShape .)
Public property LinkedCell
Gets or sets the range linked to the shape's value.
(Inherited from IShape .)
Public property Name
Returns or sets the name of the object. Read/write String.
(Inherited from IShape .)
Public property OnAction
Gets or sets the action to be performed.
(Inherited from IShape .)
Public property Code example PageSetup
Page setup for the chart. Read-only.
Examples
The following code illustrates how to set paper size:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart page setup and paper size</para><para>IChartPageSetup pageSetup = chart.PageSetup;</para><para>pageSetup.PaperSize = PaperSizeType.A3TransversePaper;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Parent
Gets the parent object of the current instance.
(Inherited from IExcelApplication .)
Public property Code example Perspective
Returns or sets the perspective for the 3-D chart view (0 to 100).
Examples
The following code illustrates how to set Perspective for the charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart perspective</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.Perspective = 70;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property PivotChartType
Gets or sets the type of the pivot chart.
(Inherited from IChart .)
Public property PivotTable
Gets or sets the pivot source.
(Inherited from IChart .)
Public property Code example PlotArea
Returns plot area frame format. Read-only.
Examples
The following code illustrates how to access IChartFrameFormat using PlotArea property and set foreground color for the chart's PlotArea:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart frame format</para><para>IChartFrameFormat frameFormat = chart.PlotArea;</para><para>//Set color</para><para>frameFormat.Fill.ForeColor = System.Drawing.Color.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example PlotVisibleOnly
True if only visible cells are plotted. False if both visible and hidden cells are plotted.
Examples
The following code illustrates how to set PlotVisibleOnly to "true" so that chart plots all the cells within the chart's DataRange:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Hide column and create chart</para><para>worksheet.Columns[2].ColumnWidth = 0;</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Plot visible only</para><para>chart.PlotVisibleOnly = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example PrimaryCategoryAxis
Primary category axis. Read-only.
Examples
The following code illustrates how to set the visibility of PrimaryCategoryAxis:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Chart category axis</para><para>IChartCategoryAxis categoryAxis = chart.PrimaryCategoryAxis;</para><para>//Set visibility</para><para>categoryAxis.Visible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example PrimarySerieAxis
Primary serie axis. Read-only.
Examples
The following code illustrates how to set the visibility of PrimarySerieAxis:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set chart type</para><para>chart.ChartType = ExcelChartType.Surface3D;</para><para>//Chart series axis</para><para>IChartSeriesAxis seriesAxis = chart.PrimarySerieAxis;</para><para>//Set visibility</para><para>seriesAxis.Visible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example PrimaryValueAxis
Primary value axis. Read-only.
Examples
The following code illustrates how to set the visibility of PrimaryValueAxis:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Chart value axis</para><para>IChartValueAxis valueAxis = chart.PrimaryValueAxis;</para><para>//Set visibility</para><para>valueAxis.Visible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Reflection
Gets the reflection effect applied to the shape.
(Inherited from IShape .)
Public property ResizeBehave
Specifies all possible settings for how drawing object shall be resized when the rows and columns between its start and ending anchor are resized or inserted(ComboBoxShape and CheckBoxShape and RadioButtonShape set MoveAndResize type value is invalid)
(Inherited from IShape .)
Public property Code example RightAngleAxes
True if the chart axes are at right angles, independent of chart rotation or elevation.
Examples
The following code illustrates how RightAngleAxes can be set for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>//Set Chart rotation and RightAngleAxes</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.Rotation = 50;</para><para>chart.RightAngleAxes = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property RightColumn
Right column of the chart in the worksheet.
Public property Rotation
Returns or sets the rotation of the shape, in degrees.
(Inherited from IShape .)
Public property Code example SecondaryCategoryAxis
Secondary category axis. Read-only.
Examples
The following code illustrates how to disable PrimaryCategoryAxis and set SecondaryCategoryAxis for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";
 worksheet.Range["A3"].Value = "100";
 worksheet.Range["B3"].Value = "200";
 worksheet.Range["C3"].Value = "300";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set secondary axis</para><para>IChartSerie serie = chart.Series[1];</para><para>serie.UsePrimaryAxis = false;</para><para>chart.SecondaryCategoryAxis.Visible = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example SecondaryValueAxis
Secondary value axis. Read-only.
Examples
The following code illustrates how to disable PrimaryValueAxis and set SecondaryValueAxis for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";
 worksheet.Range["A3"].Value = "100";
 worksheet.Range["B3"].Value = "200";
 worksheet.Range["C3"].Value = "300";</para><para>//Create chart and range</para><para>Chart chart = worksheet.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C3"];</para><para>//Set secondary axis</para><para>IChartSerie serie = chart.Series[1];</para><para>serie.UsePrimaryAxis = false;</para><para>chart.SecondaryValueAxis.Visible = true;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Code example SeriesDataFromRange
True if series are in rows in DataRange;False otherwise.
Examples
The following code illustrates how to set SeriesDataFromRange property for charts:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Add data</para><para>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";</para><para>//Create chart and set SeriesDataFromRange</para><para>IChart chart = workbook.Charts.Add();</para><para>chart.DataRange = worksheet.Range["A1:C2"];</para><para>chart.SeriesDataFromRange = false;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property Shadow
Gets the shadow settings for the object.
(Inherited from IShape .)
Public property ShapeType
The shape type of the object.
(Inherited from IShape .)
Public property ShowReportFilterFieldButtons
Gets or sets a value indicating whether [show report filter field buttons].
(Inherited from IChart .)
Public property 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.
(Inherited from IChart .)
Public property TextFrame
Gets the text frame associated with the object.
(Inherited from IShape .)
Public property ThreeD
Gets the 3D formatting options for the object.
(Inherited from IShape .)
Public property Top
The distance from the top edge of the topmost shape in the shape range to the top edge of the worksheet. Read/write Integer.
(Inherited from IShape .)
Public property TopRow
Top row of the chart in the worksheet.
Public property Visible
Determines whether the object is visible.
(Inherited from IShape .)
Public property Code example Walls
Represents chart walls. Read-only.
Examples
The following code illustrates how to access IChartWallOrFloor using Walls property and set foreground color for the chart's Walls:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get chart</para><para>Chart chart = worksheet.Charts[0];</para><para>//Set chart wall</para><para>IChartWallOrFloor wall = chart.Walls;</para><para>//Set color</para><para>wall.Fill.FillType = ShapeFillType.SolidColor;</para><para>wall.Fill.ForeColor = System.Drawing.Color.Red;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from IChart .)
Public property WallsAndGridlines2D
True if gridlines are drawn two-dimensionally on a 3-D chart.
(Inherited from IChart .)
Public property Width
The width of the object. Read/write Integer.
(Inherited from IShape .)
Public property XPos
X coordinate of the upper-left corner of the chart in points (1/72 inch).
(Inherited from IChart .)
Public property YPos
Y coordinate of the upper-left corner of the chart in points (1/72 inch).
(Inherited from IChart .)
Top
Methods
Name Description
Public method Remove
Removes this shape from shapes collection.
(Inherited from IShape .)
Public method Scale
Scales the shape.
(Inherited from IShape .)
Top
See Also