Click or drag to resize

Chart Properties

The Chart type exposes the following members.

Properties
Name Description
Public property AlternativeText
Returns or sets the descriptive (alternative) text string for a Shape object when the object is saved to a Web page. Read/write String
(Inherited from XlsShape .)
Public property AlternativeTextTitle
Returns or sets the descriptive (alternative) text title string for a Shape object when the object is saved to a Web page. Read/write String
(Inherited from XlsShape .)
Public property AutoScaling
True if Microsoft Excel scales a 3-D chart so that it's closer in size to the equivalent 2-D chart.
(Inherited from XlsChartShape .)
Public property AutoSize
True if the size of the specified object is changed automatically to fit text within its boundaries.
(Inherited from XlsShape .)
Public property BottomRow
Bottom row of the chart in the worksheet.
(Inherited from XlsChartShape .)
Public property BottomRowOffset
Bottom row offset.
(Inherited from XlsShape .)
Public property CategoryAxisTitle
Title of the category axis.
(Inherited from XlsChartShape .)
Public property Code example ChartArea
Returns a ChartArea object that represents the complete chart area for the chart.
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>
Public property ChartSubTitle
Gets the chart's sub-title. Only for ODS format file.
(Inherited from XlsChartShape .)
Public property ChartTitle
Represents the title of the specified chart.
(Inherited from XlsChartShape .)
Public property ChartTitleArea
Gets title text area. Read-only.
Public property ChartType
Type of the chart.
(Inherited from XlsChartShape .)
Public property CheckBoxes
Returns collection with all checkboxes inside this worksheet. Read-only.
(Inherited from XlsChartShape .)
Public property CodeName
Gets code name of the chart.
(Inherited from XlsChartShape .)
Public property ComboBoxes
Returns collection with all comboboxes inside this worksheet. Read-only.
(Inherited from XlsChartShape .)
Public property DataRange
DataRange for the chart series.
Public property Code example DataTable
Returns a DataTable object that represents the chart data table.
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>
Public property DepthPercent
Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
(Inherited from XlsChartShape .)
Public property DisplayAxisFieldButtons
Gets or sets a value indicating whether [show axis field buttons].
(Inherited from XlsChartShape .)
Public property DisplayBlanksAs
Represents the way that blank cells are plotted on a chart.
(Inherited from XlsChartShape .)
Public property DisplayEntireFieldButtons
Gets or sets a value indicating whether [show all field buttons].
(Inherited from XlsChartShape .)
Public property DisplayLegendFieldButtons
Gets or sets a value indicating whether [show legend field buttons].
(Inherited from XlsChartShape .)
Public property DisplayValueFieldButtons
Gets or sets a value indicating whether [show value field buttons].
(Inherited from XlsChartShape .)
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 XlsChartShape .)
Public property Fill
Represents fill properties.
(Inherited from XlsShape .)
Public property Code example Floor
Returns a Floor object that represents the floor of the 3-D chart.
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>
Public property GapDepth
Returns or sets the distance between the data series in a 3-D chart, as a percentage of the marker width.( 0 - 500 )
(Inherited from XlsChartShape .)
Public property Glow
Gets the glow properties.
(Inherited from XlsShape .)
Public property HasChartArea
Indicates whether chart has chart area.
(Inherited from XlsChartShape .)
Public property HasChartTitle
Indicates wheather the chart has title
(Inherited from XlsChartShape .)
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 XlsChartShape .)
Public property HasFill
Indicates whether XlsFill item was created. Read-only.
(Inherited from XlsShape .)
Public property HasFloor
Gets value indicating whether floor object was created.
(Inherited from XlsChartShape .)
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 XlsChartShape .)
Public property HasLineFormat
Indicates whether line item was created. Read-only.
(Inherited from XlsShape .)
Public property HasPivotTable
Indicates whether contains pivot table.
(Inherited from XlsChartShape .)
Public property HasPlotArea
Indicates whether chart has plot area.
(Inherited from XlsChartShape .)
Public property HasWalls
Gets value indicating whether floor object was created.
(Inherited from XlsChartShape .)
Public property Height
Height of object.
(Inherited from XlsShape .)
Public property HeightPercent
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
(Inherited from XlsChartShape .)
Public property HtmlString
Gets and sets the html string which contains data and some formattings in this shape.
(Inherited from XlsShape .)
Public property ID
ID of object.
(Inherited from XlsShape .)
Public property Instance Obsolete.
Returns instance value. Read-only.
(Inherited from XlsShape .)
Public property IsFlipH
Returns or sets if the shape flips Horizontal.false is default;
(Inherited from XlsShape .)
Public property IsFlipV
Returns or sets if the shape flips Vertical.false is default;
(Inherited from XlsShape .)
Public property IsGroup
This shape is group shape.
(Inherited from XlsShape .)
Public property IsInGroup
This shape is child shape of group shape.
(Inherited from XlsShape .)
Public property IsLockAspectRatio
True means that don't allow changes in aspect ratio.
(Inherited from XlsShape .)
Public property IsLocked
Gets or sets a value indicating whether the shape is locked.
(Inherited from XlsShape .)
Protected property IsMoveWithCell
Determines whether the object moves with the cell it is associated with.
(Inherited from XlsShape .)
Public property IsPrintable
Gets or sets a value indicating whether the shape is printable.
(Inherited from XlsShape .)
Public property IsRelative
Gets or sets a value indicating whether the shape is relative.
(Inherited from XlsShape .)
Public property IsRelativeResize
True means that is relative to original size of picture.
(Inherited from XlsShape .)
Public property IsRightToLeft
Indicates whether chart is displayed right to left.
(Inherited from XlsChartShape .)
Public property IsShortVersion Obsolete.
Indiicates whether it is short version of the shape (without obj and maybe some other properties).
(Inherited from XlsShape .)
Protected property IsSizeWithCell
Determines whether the size is calculated based on the cell dimensions.
(Inherited from XlsShape .)
Public property IsSmartArt
Determines whether the shape is a SmartArt graphic based on the presence of a linked drawing.
(Inherited from XlsShape .)
Public property Left
X of object
(Inherited from XlsShape .)
Public property LeftColumn
Left column of the chart in the worksheet.
(Inherited from XlsChartShape .)
Public property LeftColumnOffset
Left column offset. 1024 means whole column offset
(Inherited from XlsShape .)
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>
Public property Line
Represents line format properties. Read only.
(Inherited from XlsShape .)
Public property LinkedCell
Gets or sets the linked cell for the shape.
(Inherited from XlsShape .)
Public property Name
Name of object.
(Inherited from XlsShape .)
Public property OnAction
Gets or sets macro-command that is called when action happens.
(Inherited from XlsShape .)
Public property PageSetup
Page setup for the chart.
Public property Parent
Reference to Parent object. Read-only.
(Inherited from XlsObject .)
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 XlsChartShape .)
Public property PivotChartType
Gets or sets the type of the pivot chart.
(Inherited from XlsChartShape .)
Public property PivotTable
Gets or sets the pivot source.
(Inherited from XlsChartShape .)
Public property Code example PlotArea
Returns a PlotArea object that represents the plot area of a chart.
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>
Public property PlotVisibleOnly
True if only visible cells are plotted. False if both visible and hidden cells are plotted.
(Inherited from XlsChartShape .)
Public property PrimaryCategoryAxis
Returns primary category axis.
Public property PrimaryFormats
Returns chart format collection in primary axis.
(Inherited from XlsChartShape .)
Public property PrimarySerieAxis
Returns primary series axis. Read-only.
Public property PrimaryValueAxis
Returns primary value axis.
Protected property ReferenceCount
Get quantity of instance references.
(Inherited from XlsObject .)
Public property Reflection
Gets the reflection effect applied to the shape.
(Inherited from XlsShape .)
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 XlsShape .)
Public property RichText
Gets the rich text string associated with the current object. If the rich text string has not been initialized, it creates a new instance of RichTextShape.
(Inherited from XlsShape .)
Public property RightAngleAxes
True if the chart axes are at right angles, independent of chart rotation or elevation.
(Inherited from XlsChartShape .)
Public property RightColumn
Right column of the chart in the worksheet.
(Inherited from XlsChartShape .)
Public property RightColumnOffset
Right column offset.
(Inherited from XlsShape .)
Public property Code example 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).
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 rotation</para><para>chart.ChartType = ExcelChartType.Column3DClustered;</para><para>chart.Rotation = 50;</para><para>//Save to file</para><para>workbook.SaveToFile("Chart.xlsx");</para>
(Inherited from XlsChartShape .)
Public property SecondaryCategoryAxis
Returns secondary category axis.
Public property SecondaryCategoryAxisTitle
Title of the secondary category axis.
(Inherited from XlsChartShape .)
Public property SecondaryFormats
Returns chart format collection in secondary axis.
(Inherited from XlsChartShape .)
Public property SecondaryValueAxis
Returns secondary value axis. Read-only.
Public property SecondaryValueAxisTitle
Title of the secondary value axis.
(Inherited from XlsChartShape .)
Public property Series
Returns an object that represents either a single series (a Series object) or a collection of all the series (a SeriesCollection collection) in the chart or chart group.
Public property SeriesAxisTitle
Title of the series axis.
(Inherited from XlsChartShape .)
Public property SeriesDataFromRange
True if series are in rows in DataRange; False otherwise.
(Inherited from XlsChartShape .)
Public property Shadow
Gets the shadow properties.
(Inherited from XlsShape .)
Public property ShapeCount Obsolete.
Returns number of shapes contained by this shape (1 means no sub shapes). Read-only.
(Inherited from XlsShape .)
Public property ShapeId
Gets / sets shape id.
(Inherited from XlsShape .)
Public property Shapes
Returns chart shapes.
(Inherited from XlsChartShape .)
Public property ShapeType
Type of shape , Read Only.
(Inherited from XlsShape .)
Public property ShowReportFilterFieldButtons
Gets or sets a value indicating whether [show report filter field buttons].
(Inherited from XlsChartShape .)
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 XlsChartShape .)
Public property SupportWallsAndFloor
Indicates whether this chart supports walls and floor. Read-only.
(Inherited from XlsChartShape .)
Public property TextBoxes
Returns collection with all textboxes inside this worksheet. Read-only.
(Inherited from XlsChartShape .)
Public property TextFrame
Gets the text frame associated with the shape.
(Inherited from XlsShape .)
Public property TextVerticalAlignment
Get or set Text Vertical Alignment in shape.
(Inherited from XlsShape .)
Public property ThreeD
Gets the chart3 D properties.
(Inherited from XlsShape .)
Public property Top
Top of object.
(Inherited from XlsShape .)
Public property TopRow
Top row of the chart in the worksheet.
(Inherited from XlsChartShape .)
Public property TopRowOffset
Top row offset.256 means whole row offset
(Inherited from XlsShape .)
Public property UpdatePositions
Indicates whether we have to update absolute positions after setting TopRow, BottomRow, LeftColumn, RightColumn.
(Inherited from XlsShape .)
Public property ValueAxisTitle
Title of the value axis.
(Inherited from XlsChartShape .)
Public property Visible
Gets or sets the visibility of the shape. When set to true, the shape is visible; when set to false, the shape is hidden.
(Inherited from XlsShape .)
Public property VmlShape
Indicates whether this is vml shape or not.
(Inherited from XlsShape .)
Public property Code example Walls
Represents chart walls.
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>
Public property WallsAndGridlines2D
True if gridlines are drawn two-dimensionally on a 3-D chart.
(Inherited from XlsChartShape .)
Public property Width
Width of object.
(Inherited from XlsShape .)
Public property Workbook
Workbook contains the chart.
Public property Worksheet
Worksheet which contains the chart.
Public property XPos
X coordinate of the upper-left corner of the chart in points (1/72 inch).
(Inherited from XlsChartShape .)
Public property YPos
Y coordinate of the upper-left corner of the chart in points (1/72 inch).
(Inherited from XlsChartShape .)
Top
See Also