Chart Class
Encapsulates the object that represents a single Excel chart.
Inheritance Hierarchy
SystemObject
  Aspose.Cells.ChartsChart

Namespace: Aspose.Cells.Charts
Assembly: Aspose.Cells (in Aspose.Cells.dll) Version: 19.11.0.0 (19.11)
Syntax
public class Chart

The Chart type exposes the following members.

Properties
  NameDescription
Public propertyActualChartSize
Gets actual size of chart
Public propertyAutoScaling
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.
Public propertyBackWall
Returns a Walls object that represents the back wall of a 3-D chart.
Public propertyCategoryAxis
Gets the chart's X axis.
Public propertyChartArea
Gets the chart area in the worksheet
Public propertyChartDataTable
Represents the chart data table.
Public propertyChartObject
Represents the chartShape;
Public propertyDepthPercent
Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).
Public propertyElevation
Represents the elevation of the 3-D chart view, in degrees.
Public propertyFirstSliceAngle
Gets or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360.
Public propertyFloor
Returns a Floor object that represents the walls of a 3-D chart.
Public propertyGapDepth
Gets or sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500.
Public propertyGapWidth
Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500.
Public propertyHeightPercent
Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).
Public propertyHidePivotFieldButtons
Indicates whether hide the pivot chart field buttons only when the chart is PivotChart
Public propertyIs3D
Indicates whether the chart is a 3d chart.
Public propertyIsRectangularCornered
Gets or sets a value indicating whether the chart area is rectangular cornered. Default is true.
Public propertyLegend
Gets the chart legend.
Public propertyLine
Gets the line.
Public propertyName
Gets and sets the name of the chart.
Public propertyNSeries
Gets a SeriesCollection collection representing the data series in the chart.
Public propertyPageSetup
Represents the page setup description in this chart.
Public propertyPerspective
Returns or sets the perspective for the 3-D chart view. Must be between 0 and 100. This property is ignored if the RightAngleAxes property is True.
Public propertyPivotOptions
Specifies the pivot controls that appear on the chart
Public propertyPivotSource
The source is the data of the pivotTable. If PivotSource is not empty ,the chart is PivotChart.
Public propertyPlacement
Represents the way the chart is attached to the cells below it.
Public propertyPlotArea
Gets the chart's plot area which includes axis tick lables.
Public propertyPlotAreaWithoutTickLabels Obsolete.
Gets the chart's plot area which does not inculde axis tick lables.
Public propertyPlotEmptyCellsType
Gets and sets how to plot the empty cells.
Public propertyPlotVisibleCells
Indicates whether only plot visible cells.
Public propertyPrintSize
Gets and sets the printed chart size.
Public propertyRightAngleAxes
True if the chart axes are at right angles.Applies only for 3-D charts(except Column3D and 3-D Pie Charts).
Public propertyRotationAngle
Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).
Public propertySecondCategoryAxis
Gets the chart's second X axis.
Public propertySecondValueAxis
Gets the chart's second Y axis.
Public propertySeriesAxis
Gets the chart's series axis.
Public propertyShapes
Returns all drawing shapes in this chart.
Public propertyShowDataTable
Gets or sets a value indicating whether the chart displays a data table.
Public propertyShowLegend
Gets or sets a value indicating whether the chart legend will be displayed. Default is true.
Public propertySideWall
Returns a Walls object that represents the side wall of a 3-D chart.
Public propertySizeWithWindow
True if Microsoft Excel resizes the chart to match the size of the chart sheet window.
Public propertyStyle
Gets and sets the builtin style.
Public propertySubTitle
Gets the chart's sub-title. Only for ODS format file.
Public propertyTitle
Gets the chart's title.
Public propertyType
Gets or sets a chart's type.
Public propertyValueAxis
Gets the chart's Y axis.
Public propertyWalls
Returns a Walls object that represents the walls of a 3-D chart.
Public propertyWallsAndGridlines2D
True if gridlines are drawn two-dimensionally on a 3-D chart.
Public propertyWorksheet
Gets the worksheet which contains this chart.
Methods
  NameDescription
Public methodCalculate
Calcuate the custom position of plot area, axises if the position of them are auto assigned.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodHasAxis
Returns which axes exist on the chart.
Public methodIsChartDataChanged
Detects if a chart's data source has changed.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMove
Moves the chart to a specified location.
Public methodRefreshPivotData
Refreshes pivot chart's data from it's pivot data source.
Public methodSetChartDataRange
Specifies data range for a chart.
Public methodToImage
Gets a 32-bit Bitmap object of the chart.
Public methodToImage(String)
Creates the chart image and saves it to a file. The extension of the file name determines the format of the image.
Public methodCode exampleToImage(ImageOrPrintOptions)
Gets a 32-bit Bitmap object of the chart. ImageOrPrintOptions.ImageFormat, ImageOrPrintOptions.TiffCompression and ImageOrPrintOptions.Quality attributes are ignored.
Public methodToImage(Stream, ImageOrPrintOptions)
Creates the chart image and saves it to a stream in the specified format.
Public methodToImage(Stream, ImageFormat)
Creates the chart image and saves it to a stream in the specified format.
Public methodToImage(Stream, Int64)
Creates the chart image and saves it to a stream in the Jpeg format.
Public methodCode exampleToImage(String, ImageOrPrintOptions)
Creates the chart image and saves it to a file. The extension of the file name determines the format of the image.
Public methodToImage(String, ImageFormat)
Creates the chart image and saves it to a file in the specified format.
Public methodToImage(String, Int64)
Creates the chart image and saves it to a file in the Jpeg format.
Public methodToPdf(Stream)
Creates the chart pdf and saves it to a stream.
Public methodToPdf(String)
Saves the chart to a pdf file.
Public methodToPdf(Stream, Single, Single, PageLayoutAlignmentType, PageLayoutAlignmentType)
Creates the chart pdf and saves it to a stream.
Public methodToPdf(String, Single, Single, PageLayoutAlignmentType, PageLayoutAlignmentType)
Saves the chart to a pdf file.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
[C#]

Workbook workbook = new Workbook();
   Worksheet sheet = workbook.Worksheets[0];

   Cells cells = sheet.Cells;
   cells[0,1].PutValue("Income");
   cells[1,0].PutValue("Company A");
   cells[2,0].PutValue("Company B");
   cells[3,0].PutValue("Company C");
   cells[1,1].PutValue(10000);
   cells[2,1].PutValue(20000);
   cells[3,1].PutValue(30000);

   int chartIndex = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15);

   Chart chart = sheet.Charts[chartIndex];
   chart.NSeries.Add("B2:B4", true);
   chart.NSeries.CategoryData = "A2:A4";

   ASeries aSeries = chart.NSeries[0];
   aSeries.Name = "=B1";
   chart.IsLegendShown = true;
   chart.Title.Text = "Income Analysis";

[Visual Basic]

Dim workbook as Workbook = new Workbook()
Dim sheet as Worksheet = workbook.Worksheets(0)

Dim cells as Cells = sheet.Cells
cells(0,1).PutValue("Income")
   cells(1,0).PutValue("Company A")
   cells(2,0).PutValue("Company B")
   cells(3,0).PutValue("Company C")
   cells(1,1).PutValue(10000)
   cells(2,1).PutValue(20000)
   cells(3,1).PutValue(30000)

   Dim chartIndex as Integer = sheet.Charts.Add(ChartType.Column, 9, 9, 21, 15)

   Dim chart as Chart = sheet.Charts(chartIndex)
   chart.NSeries.Add("B2:B4", true)
   chart.NSeries.CategoryData = "A2:A4"

   Dim aSeries as ASeries = chart.NSeries(0)
   aSeries.Name = "=B1"
   chart.IsLegendShown = true
   chart.Title.Text = "Income Analysis"
See Also