ExcelChart Class
Represents a base class for all charts in a worksheet.
- Inheritance:
- System.
Object ExcelChart
- Derived
Properties
CategoryLabels
Gets the chart's category labels.
Property Value
- System.
Collections. <System.Generic. IEnumerable String >
The chart's category labels.
Remarks
If category labels are not set neither as Category
CategoryLabelsReference
Gets or sets the chart's category labels as a cell range reference (for example, 'Sheet1!A1:D1'). Values from cells in the referenced range will be used as category labels.
Property Value
- System.
String
The chart's category labels as a cell range reference.
ChartType
Gets the Chart
Property Value
The Chart
DataLabels
Gets the settings for the data labels for the entire chart.
Property Value
The settings for the data labels for the entire chart.
Fill
Gets or sets the fill formatting options.
Property Value
The fill formatting options.
Legend
Gets the chart's legend.
Property Value
The chart's legend.
Outline
Gets or sets the outline formatting options.
Property Value
The outline formatting options.
PlotArea
Gets the chart's plot area.
Property Value
The chart's plot area.
RoundedCorners
Gets or sets a value indicating whether the chart area border has rounded corners.
Default value is false.
Property Value
- System.
Boolean
true if the chart area border has rounded corners; otherwise, false.
Remarks
Supported only in XLSX and XLSB.
Series
Gets the chart's series.
Property Value
The chart's series.
ShowDataInHiddenCells
Gets or sets the value which indicates whether only visible cells should be plotted on the chart.
Property Value
- System.
Boolean
true to plot also cells in hidden rows or columns, false otherwise.
ShowEmptyCellsAs
Gets or sets the value which indicates how empty cells (cells with Value equal to null) shall be plotted on the chart.
Property Value
The value which indicates how empty cells (cells with Value equal to null) shall be plotted on the chart.
TextFormat
Gets or sets the text formatting options.
Property Value
The text formatting options.
Title
Gets the chart's title.
Property Value
The chart's title.
UseSecondaryAxis
Gets or sets the value which indicates whether this chart should use the secondary axis of parent Combo
Property Value
- System.
Boolean
true if this chart uses the secondary axis, false otherwise.
Remarks
This property is only used for charts that are children of a Combo
Setting Use
Methods
BringForward()
Moves the chart one position forward in the drawings if the parent collection is Excel
Remarks
The index of the chart in the Excel
BringToFront()
Brings the chart to the front of the drawings if the parent collection is Excel
ChangeChartType(ChartType)
Changes the chart to a different type of chart.
Parameters
chartType
- Chart
Type
Type of chart to change the chart to.
Returns
A chart of different type.
Exceptions
- System.
Not Supported Exception
Changing to or from Combo is not supported.
ChangeChartType<TChart>()
Changes the chart to a different type of chart.
Returns
- TChart
A chart of different type.
Type Parameters
TChart
Type of chart deriving from Excel
MoveZIndex(Int32)
Moves the picture forward or backward in the drawings with the given relative index if the parent collection is Excel
Parameters
relativeIndex
- System.
Int32
The relative index for the picture to update. Negative to move backward and positive to move forward.
SelectData(CellRange)
Selects the data for the chart.
Parameters
range
- Cell
Range
The cell range which contains data for the chart.
Exceptions
Parameter range
is null or not valid.
SelectData(CellRange, Boolean)
Selects the data for the chart.
Parameters
range
- Cell
Range
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
Exceptions
Parameter range
is null or not valid.
SelectData(CellRange, Boolean, Boolean)
Selects the data for the chart.
Parameters
range
- Cell
Range
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
excludeCategoryLabels
- System.
Boolean
if set to true, category labels won't be resolved from range
.
Exceptions
Parameter range
is null or not valid.
SelectData(CellRange, Boolean, Boolean, Boolean)
Selects the data for the chart.
public void SelectData(CellRange range, bool switchRowColumn, bool excludeCategoryLabels, bool excludeSeriesNames)
Parameters
range
- Cell
Range
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
excludeCategoryLabels
- System.
Boolean
if set to true, category labels won't be resolved from range
.
excludeSeriesNames
- System.
Boolean
if set to true, series names won't be resolved from range
.
Exceptions
Parameter range
is null or not valid.
SelectData(String)
Selects the data for the chart.
Parameters
range
- System.
String
The cell range which contains data for the chart.
Exceptions
Either chart is in invalid state or range
parameter is not valid.
SelectData(String, Boolean)
Selects the data for the chart.
Parameters
range
- System.
String
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
Exceptions
Either chart is in invalid state or range
parameter is not valid.
SelectData(String, Boolean, Boolean)
Selects the data for the chart.
Parameters
range
- System.
String
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
excludeCategoryLabels
- System.
Boolean
if set to true, category labels won't be resolved from range
.
Exceptions
Either chart is in invalid state or range
parameter is not valid.
SelectData(String, Boolean, Boolean, Boolean)
Selects the data for the chart.
public void SelectData(string range, bool switchRowColumn, bool excludeCategoryLabels, bool excludeSeriesNames)
Parameters
range
- System.
String
The cell range which contains data for the chart.
switchRowColumn
- System.
Boolean
if set to true category labels will be in first column (not row), series names will be in first row (not column) and series values will be in columns (not rows).
excludeCategoryLabels
- System.
Boolean
if set to true, category labels won't be resolved from range
.
excludeSeriesNames
- System.
Boolean
if set to true, series names won't be resolved from range
.
Exceptions
Either chart is in invalid state or range
parameter is not valid.
SendBackward()
Moves the chart one position backward in the drawings if the parent collection is Excel
Remarks
The index of the chart in the Excel
SendToBack()
Sends the chart to the back of the drawings if the parent collection is Excel
SetCategoryLabels(IEnumerable<String>)
Sets the chart's category labels.
Parameters
categoryLabels
- System.
Collections. <System.Generic. IEnumerable String >
The chart's category labels.
Exceptions
- System.
Argument Null Exception
categoryLabels
is null.
SetCategoryLabels(String[])
Sets the chart's category labels.
Parameters
categoryLabels
- System.
String []
The chart's category labels.
ToString()
Returns a System.
Returns
- System.
String
A System.
Overrides
Remarks
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).
Inherited Properties
Hyperlink | Gets or sets the hyperlink on this drawing (picture, chart, etc.). (Inherited from Excel |
Metadata | Gets the metadata (non-visual properties) of this Excel (Inherited from Excel |
Position | Gets the position of this drawing (picture, chart, etc.) in the worksheet. (Inherited from Excel |
Worksheet | Gets the parent worksheet. (Inherited from Excel |
ZIndex | Gets the z-order position of the picture. -1 if the picture is not contained in proper collection. (Inherited from Excel |
Inherited Methods
Format() | Formats this drawing (picture, chart, etc.) to its default size so it can be exported to PDF, XPS, image or be printed. (Inherited from Excel |
Format(System. | Formats this drawing (picture, chart, etc.) to specified size so it can be exported to PDF, XPS, image or be printed. (Inherited from Excel |