Show / Hide Table of Contents

Class WorksheetChart

Represents a chart.

Inheritance
System.Object
WorksheetShape
WorksheetShapeGroupBase
WorksheetChart
Inherited Members
WorksheetShapeGroupBase.Shapes
WorksheetShape.ClearUnknownData()
WorksheetShape.CreatePredefinedShape(PredefinedShapeType)
WorksheetShape.GetBoundsInTwips()
WorksheetShape.GetBoundsInTwips(PositioningOptions)
WorksheetShape.SetBoundsInTwips(Sheet, Rect)
WorksheetShape.SetBoundsInTwips(Sheet, Rect, PositioningOptions)
WorksheetShape.Fill
WorksheetShape.BottomRightCornerCell
WorksheetShape.BottomRightCornerPosition
WorksheetShape.FlippedHorizontally
WorksheetShape.FlippedVertically
WorksheetShape.Outline
WorksheetShape.PositioningMode
WorksheetShape.TopLeftCornerCell
WorksheetShape.TopLeftCornerPosition
WorksheetShape.Visible
WorksheetShape.Worksheet
Namespace: Infragistics.Documents.Excel
Assembly: IgniteUI.Blazor.Documents.Excel.dll
Syntax
public class WorksheetChart : WorksheetShapeGroupBase, IRegionAddress, IWorksheetShapeOwner, IChartObject, ISheetProvider, IWorkbookProvider
Remarks

This class does not allow for the editing of chart data when the CurrentFormat is 'Excel97To2003', or 'Excel97To2003Template'. It is used for round-tripping chart data between loading and saving a workbook in those formats.

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 RightAngleAxes property must be True

Declaration
public bool AutoScaling { get; set; }
Property Value
Type Description
System.Boolean

AxisCollection

Returns the axis collection (read-only)

Declaration
public AxisCollection AxisCollection { get; }
Property Value
Type Description
AxisCollection

BackWall

Returns a Wall object that allows the user to format the back wall of a 3-D chart. Read-only.

Declaration
public Wall BackWall { get; }
Property Value
Type Description
Wall
See Also
Floor
SideWall
WallDefault

BarShape

Returns or sets the shape of Series bars. Applicable only to 3D bar-type charts.

Declaration
public Nullable<BarShape> BarShape { get; set; }
Property Value
Type Description
System.Nullable<BarShape>
Remarks

This property is applicable only to the following chart types:

  • Bar3DStacked
  • Column3DStacked
  • ConeBarStacked
  • ConeColStacked
  • PyramidBarStacked
  • PyramidColStacked
  • CylinderBarStacked
  • CylinderColStacked
  • Bar3DStacked100
  • Column3DStacked100
  • ConeBarStacked100
  • ConeColStacked100
  • PyramidBarStacked100
  • PyramidColStacked100
  • CylinderBarStacked100
  • CylinderColStacked100
  • Column3D
  • PyramidCol
  • ConeCol
  • CylinderCol

Use this property to set the bar shape for all series bars.

To set the shape for a particular series bar, use the BarShape property.

See Also
BarShape
ChartType

BarShapeResolved

Returns the resolved value of the BarShape property.

Declaration
public BarShape BarShapeResolved { get; }
Property Value
Type Description
BarShape
See Also
BarShape
BarShape

ChartArea

Returns a ChartArea object that represents the complete chart area for the chart. Read-only.

Declaration
public ChartArea ChartArea { get; }
Property Value
Type Description
ChartArea

ChartTitle

Returns or sets an ChartTitle object.

Declaration
public ChartTitle ChartTitle { get; set; }
Property Value
Type Description
ChartTitle

ChartType

Specifies the chart type.

Declaration
public ChartType ChartType { get; set; }
Property Value
Type Description
ChartType
Remarks

All chart types are supported by the WorksheetChart type; no derived classes exist or are necessary to support different chart types.

Note that changing the chart type may cause related property values to be changed.

For example, when transitioning from a chart type which supports line markers, The MarkerStyle property is changed to reflect the new chart style.

Using another example, when transitioning from a chart type which does not support Axis, such as a pie or doughnut chart, to a chart type that does support them, the AxisCollection is modified accordingly.

ComboChartGroups

Returns a collection of the ComboChartGroup instances associated with this chart.

Declaration
public ComboChartGroupCollection ComboChartGroups { get; }
Property Value
Type Description
ComboChartGroupCollection
Remarks

The properties of the WorksheetChart class which apply only to a specific chart type are not applicable for combo charts. For example, the GapWidth property, which applies to bar charts, is not used for bar charts which appear within a combo chart. The reason for this is that combo charts support multiple occurrences of the same chart type, making the WorksheetChart-level properties ambiguous in the context of a combo chart.

This class makes it possible to set chart-specific properties for one or more occurrences of a particular chart type, for a particular axis group.

For example, consider a combo chart with two ClusteredColumn series, one on the primary axis and another on the secondary. To set the GapWidth property for the chart on the primary axis, add an item to this collection with a ChartType of ClusteredColumn, and an AxisGroup of Primary. On the ComboChartGroup instance returned from the collection's Add method, set the GapWidth property to the desired value.

When the chart is serialized, this collection is checked against each series in the combo chart. If the ChartType and the AxisGroup match the respective properties on a ComboChartGroup instance, the value of that instance's GapWidth property is applied to the chart element for that series. Because the other clustered column series exists on the secondary axis, the property is not applied to that series, since while it has the same ChartType, its AxisGroup is different.

See Also
ComboChartGroup
ChartType
AxisGroup

DepthPercent

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).

Declaration
public int DepthPercent { get; set; }
Property Value
Type Description
System.Int32

DisplayBlanksAs

Returns or sets the way that blank cells are plotted on a chart.

Declaration
public DisplayBlanksAs DisplayBlanksAs { get; set; }
Property Value
Type Description
DisplayBlanksAs

DoughnutHoleSize

Returns or sets the size of the hole in a doughnut chart, expressed as a percentage of the size of the encompassing circle.

Declaration
public int DoughnutHoleSize { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property is only applicable to doughnut charts.

The valid range for this property is 0 through 90, inclusive.

DropLines

Returns or sets a ChartDropLines instance which determines the appearance for a stock chart's drop lines.

Declaration
public ChartDropLines DropLines { get; set; }
Property Value
Type Description
ChartDropLines
Remarks

This property is only applicable for stock charts.

High/low lines are not displayed by default; to enable them, assign a ChartDropLinesto this property. to null.

FirstSliceAngle

Returns or sets the angle which determines the origin of the first slice, as relative to the 12 o'clock position of the emcompassing circle.

Declaration
public int FirstSliceAngle { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property is only applicable to pie and doughnut charts.

The valid range for this property is 0 through 360, inclusive. Fractional angles are not supported; nor are negative angles.

By default, the first slice begins at the "12 o'clock" position of the pie chart, i.e., the top center point of the encompassing circle.

Use this property to offset the origin of the first slice; for example, a value of 30 positions the first slice at the 1 o'clock position, 60 at the 2 o'clock position, 90 for 3 o'clock, etc.

Larger values move along the circumference of the emcompassing circle in a clockwise direction, with a value of 0 or 360 both coinciding with the 12 o'clock position.

Floor

Returns a Wall object that allows the user to format the bottom wall of a 3-D chart. Read-only.

Declaration
public Wall Floor { get; }
Property Value
Type Description
Wall
See Also
BackWall
SideWall
WallDefault

GapDepth

Returns or sets the gap depth in a 3-D chart, expressed as a percentage of the marker width. The value of this property must be between 0 and 500.

Declaration
public int GapDepth { get; set; }
Property Value
Type Description
System.Int32
See Also
GapWidth

GapWidth

Returns or sets the distance between the data series in a bar chart, as a percentage of the marker width. The value of this property must be between 0 and 500.

Declaration
public int GapWidth { get; set; }
Property Value
Type Description
System.Int32
See Also
GapDepth

HeightPercent

Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).

Declaration
public int HeightPercent { get; set; }
Property Value
Type Description
System.Int32

HighLowLines

Returns or sets a ChartHighLowLines instance which determines the appearance for a stock chart's high/low lines.

Declaration
public ChartHighLowLines HighLowLines { get; set; }
Property Value
Type Description
ChartHighLowLines
Remarks

This property is only applicable for stock charts.

High/low lines depict the high and low prices for a stock chart.

High/low lines are displayed by default; to disable them, set this property to null.

Legend

Returns or sets a Legend object which represents the legend for the chart.

Declaration
public Legend Legend { get; set; }
Property Value
Type Description
Legend

Perspective

Returns or sets a value that represents the perspective for the 3-D chart view, expressed in degrees.

Declaration
public int Perspective { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property supports values within the inclusive range of 0 and 120.

PlotArea

Returns a PlotArea object that represents the plot area of a chart. Read-only.

Declaration
public PlotArea PlotArea { get; }
Property Value
Type Description
PlotArea

PlotVisibleOnly

True if only visible cells are plotted. False if both visible and hidden cells are plotted.

Declaration
public bool PlotVisibleOnly { get; set; }
Property Value
Type Description
System.Boolean

RightAngleAxes

True if the chart axes are at right angles, independent of chart rotation or elevation. Applies only to 3-D line, column, and bar charts.

Declaration
public bool RightAngleAxes { get; set; }
Property Value
Type Description
System.Boolean

RotationX

Returns or sets the rotation of a 3-D chart view around the X-axis, expressed in degrees.

Declaration
public int RotationX { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property controls the viewing perspective by rotating the chart around the horizontal axis, such that the top of the chart appears to move closer or further away.

This property is only applicable to 3D charts.

See Also
RotationY

RotationY

Returns or sets the rotation of a 3-D chart view around the Y-axis, expressed in degrees.

Declaration
public int RotationY { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property controls the viewing perspective by rotating the chart around the vertical axis, such that the left edge of the chart appears to move closer or further away.

This property is only applicable to 3D charts.

See Also
RotationX

SecondPlotSize

Returns or sets the size of the second plot area in a 'bar of pie' or 'pie of pie' chart, expressed as a percentage of the first plot area's size.

Declaration
public int SecondPlotSize { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property is only applicable for the BarOfPie and PieOfPie ChartType.

This property supports values in the range of 5 to 200, inclusively.

SeriesCollection

Returns the series collection (read-only)

Declaration
public SeriesCollection SeriesCollection { get; }
Property Value
Type Description
SeriesCollection

SeriesLines

Determines the Fill and WidthInPoints for the lines which connect the first and second plot areas in a 'bar of pie' or 'pie of pie' chart.

Declaration
public ChartSeriesLines SeriesLines { get; set; }
Property Value
Type Description
ChartSeriesLines
Remarks

This property is only applicable for the BarOfPie and PieOfPie ChartType.

See Also
SecondPlotSize

SeriesOverlap

Determines the amount by which intersecting Series overlap, expressed as a percentage of the bar size.

Declaration
public int SeriesOverlap { get; set; }
Property Value
Type Description
System.Int32
Remarks

This property is only applicable for 2D bar charts.

See Also
GapDepth
GapWidth

Sheet

Gets the worksheet on which the shape resides.

Declaration
public override Sheet Sheet { get; }
Property Value
Type Description
Sheet
Overrides
WorksheetShape.Sheet

SideWall

Returns a Wall object that allows the user to format the side wall of a 3-D chart. Read-only.

Declaration
public Wall SideWall { get; }
Property Value
Type Description
Wall
See Also
Floor
BackWall
WallDefault

UpDownBars

Returns or sets a UpDownBars instance which determines the appearance for a stock chart's up/down bars.

Declaration
public UpDownBars UpDownBars { get; set; }
Property Value
Type Description
UpDownBars
Remarks

This property is only applicable for stock charts.

Up/down bars depict gains or losses across a series for a stock chart.

See Also
UpBar
DownBar

VaryColors

Returns or sets a boolean value indicating whether the fill colors for Series and DataPoint are automatically selected by Excel.

Declaration
public bool VaryColors { get; set; }
Property Value
Type Description
System.Boolean
Remarks

This property defaults to true, causing fill colors for series and data points to be automatically selected by Excel.

The automatically selected color can always be overridden for individual series and/or data points using the Fill, Line, and Fill properties.

In cases where VaryColors is set to true, but a fill is explicitly assigned, the assigned fill is used for the associated series or data point, while series or data points which have no explicitly assigned fill will have a fill color automatically selected.

See Also
Fill
Line
Fill

WallDefault

Returns a Wall object which represents the back and side walls, and floor of the chart. Applicable only for 3-D charts.

Declaration
public Wall WallDefault { get; }
Property Value
Type Description
Wall
Remarks

Use this property to apply the same settings for the back wall, side wall, and floor.

Use the BackWall property to control the appearance of the back wall.

Use the SideWall property to control the appearance of the side wall.

Use the Floor property to control the appearance of the bottom wall.

The BackWall, SideWall, and Floor properties take precedence over this property.

See Also
BackWall
SideWall
Floor

Methods

SetComboChartSourceData(String, ChartType[], Boolean, Nullable<CellReferenceMode>)

Sets the source data range for a combo chart.

Declaration
public void SetComboChartSourceData(string dataRange, ChartType[] seriesChartTypes, bool plotByRows = false, Nullable<CellReferenceMode> cellReferenceMode = null)
Parameters
Type Name Description
System.String dataRange

The data range for the combo chart

ChartType[] seriesChartTypes

An array of ChartType constants which specify the chart type for each series yielded from the specified dataRange.

System.Boolean plotByRows

Optional. True to plot by rows where each row is a separate series or false to plot by columns where each column is a separate series. The default is false.

System.Nullable<CellReferenceMode> cellReferenceMode

Optional. Determines how to parse the dataRange.

Remarks

Combo charts support multiple chart types within the main chart, with each different chart type being associated with one or more Series.

Use this method to populate the SeriesCollection for a combo chart.

For example, given a dataRange which yields three series, the caller can specify an array with three elements as the value of the seriesChartTypes parameter. Each array element is then applied to the corresponding series, in the same order in which they appear in the array.

Duplicate ChartType values can appear in the seriesChartTypes array, in which case the corresponding series appear within the same chart. For example, specifying an array with ClusteredColumn, Line, and Line results in a combo chart with the first series appearing in a clustered column chart, and the remaining series appearing in a line chart.

Specifying null for the value of the seriesChartTypes parameter is treated the same as a two-element array containing 'ColumnClustered' and 'Line', resulting in a clustered column chart for the first series, and a line chart for the remaining series.

If fewer values are present in the seriesChartTypes array than the number of series yielded from the specified dataRange, the remaining series acquire the same ChartType and AxisGroup as the last element in the seriesChartTypes array. If more values are present in the array than the number of series yielded, these values are ignored.

Certain chart type values are invalid for a combo chart; if any of these chart types are present in the array, an exception is thrown, listing the invalid chart types.

The following table lists the ChartType values which are supported in combo charts, grouped by series type:

SeriesType ChartType (supported in combo charts)
AreaArea, AreaStacked, AreaStacked100
BarColumnClustered, ColumnStacked, ColumnStacked100, BarClustered, BarStacked, BarStacked100, BarOfPie
LineLine, LineStacked, LineStacked100, LineMarkers, LineMarkersStacked, LineMarkersStacked100
PiePie, PieExploded, PieOfPie, Doughnut, DoughnutExploded
RadarRadar, RadarFilled, RadarMarkers
ScatterXYScatter, XYScatterLines, XYScatterLinesNoMarkers, XYScatterSmooth, XYScatterSmoothNoMarkers
BubbleNot Supported
SurfaceNot Supported

Combo charts support a maximum of two axis groups. If the combination of values in the seriesChartTypes array necessitates more than two axis groups, an exception is thrown.

Combo charts require a minimum of two Series. If the specified dataRange yields less that two series, an exception is thrown.

If the combination of series used in a combo chart is indistinguishable from a non-combo chart, the chart may not be recognized by Excel as a combo chart. For example, adding two series, one of type Radar and one of type RadarMarkers, is a valid combination. When opened in Excel, however, such a chart will not be recognized as a combo chart, since the combination of series does not necessitate multiple chart elements. All relevant property values are persisted, however, and there is no distinguishable difference between the original chart and the serialized one.

Exceptions
Type Condition
System.Exception

The current value of the ChartType property is not Combo.

System.NotSupportedException

The specified seriesChartTypes array contains one or more values which are not supported within a combo chart.

System.NotSupportedException

The specified seriesChartTypes array contains a combination of values which would require more than the maximum allowable number of axes (two).

See Also
Series
Axis
ChartType
AxisGroup

SetSourceData(String, Boolean, Nullable<CellReferenceMode>)

Sets the source data range for the chart.

Declaration
public void SetSourceData(string dataRange, bool plotByRows = false, Nullable<CellReferenceMode> cellReferenceMode = null)
Parameters
Type Name Description
System.String dataRange

The data range for the chart

System.Boolean plotByRows

Optional. True to plot by rows where each row is a separate series or false to plot by columns where each column is a separate series. The default is false.

System.Nullable<CellReferenceMode> cellReferenceMode

Optional. Determines how to parse the dataRange.

Remarks

For combo charts, this method always displays the first series in a clustered column chart, with all subsequent series displayed in line charts. Use the SetComboChartSourceData(String, ChartType[], Boolean, Nullable<CellReferenceMode>) to customize the series charts for a combo chart.