Description
The Chart class represents an Excel chart. It is the main class for code-based chart creation and modification.
Signature: C#
Signature: VB.NET
Remarks
To create a Chart object:
Properties
| Name | Description |
|---|---|
| CategoryAxis | Returns a CategoryAxis object representing the chart's X axis. |
| ChartArea | Returns a ChartRegion object, representing the chart area in the worksheet. The chart area is the entire area within the worksheet assigned to the chart. |
| ChartSettings3D | Returns a ChartSettings3D object representing the properties of a three-dimensional chart. |
| ChartType | Sets or returns the chart's type (Area, Column, Bubble, etc.). |
| DataTable | For all chart types except Pie, Doughnut, Bubble, and Surface, DataTable returns a ChartDataTable object, representing a chart's data table. |
| Height | Sets or returns the height of the chart, in points (1/72 inch). |
| Legend | Returns a Legend object, representing the chart's legend. |
| Name | Sets or returns the name of the chart. |
| ObjectPositioning | Sets or returns the ObjectPositioning value that determines the chart's resize and reposition behavior when the cells in the worksheet are changed. |
| PageSetup | Returns the ChartPageSetup object for this chart. |
| PlotArea | Returns a ChartRegion object, representing the chart's plot area, the area of the chart itself. |
| Position | Sets or returns the chart's position in the worksheet. |
| PositionInCollection | Returns the 0-based position in the parent Charts collection. If this Chart is on its own Chartsheet, then this will return 0. |
| ScatterValueAxis | Returns a ValueAxis object representing the chart's scatter values on the X axis. |
| SecondaryCategoryAxis | Returns a CategoryAxis object, representing a chart's secondary X axis. |
| SecondaryValueAxis | Returns a ValueAxis object, representing a chart's secondary Y axis. |
| SeriesCollection | Returns a SeriesCollection object representing the set of data series in the chart. |
| ShowRoundedCorners | Sets or returns whether the chart area will be sharp-cornered or round-cornered. |
| Title | Returns a ChartText object representing the chart's title. |
| ValueAxis | Returns a ValueAxis object, representing a chart's Y axis. |
| Width | Sets or returns the width of the chart, in points (1/72 inch). |
| ZCategoryAxis | Returns a CategoryAxis object representing the chart's category values on the Z axis. |
Methods
| Name | Description |
|---|---|
| MoveChart(Chart.ChartLocation, Int32) | Moves the chart to a different worksheet. The method specifies whether the chart should be inserted as an object within the worksheet, or converted to a chart sheet. |
| MoveChart(Chart.ChartLocation, Int32, Anchor) | Moves the chart to a different worksheet. The method specifies whether the chart should be inserted as an object within the worksheet, or converted to a chart sheet. |
| MoveChart(Chart.ChartLocation, String) | Moves the chart to a different worksheet. The method specifies whether the chart should be inserted as an object within the worksheet, or converted to a chart sheet. |
| MoveChart(Chart.ChartLocation, String, Int32) | Moves the chart to a different worksheet. The method specifies whether the chart should be inserted as an object within the worksheet, or converted to a chart sheet. |
Nested Classes
| Name | Description |
|---|---|
| ChartLocation | A ChartLocation value specifies whether a chart should be an object within a worksheet, or converted to a chart sheet. |