Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
It’s simple to create a chart with Aspose.Cells using the following example code:
Before creating charts, it’s important to understand some basic concepts that are helpful when creating charts using Aspose.Cells.
Aspose.Cells provides a special set of classes in the Aspose.Cells.Charts namespace used to create the charts supported by Aspose.Cells. These classes are used to create charting objects, which act as the chart building blocks. The charting objects are listed below:
As mentioned above, all charting objects are instances of their respective classes and provide specific properties and methods to perform specific tasks. Use charting objects to create charts.
Add any type of chart to a worksheet using the Charts collection. Each item in the Charts collection represents a Chart object. A Chart object encapsulates all other charting objects required to customize the appearance of the chart. The next section shows how to use a few basic charting objects to create a simple chart.
Steps:
When adding source data to a chart, the data source can be a range of cells (such as “A1:C3”), a sequence of non‑contiguous cells (such as “A1, A3, A5”), or a sequence of values (such as “1,2,3”).
These general steps allow you to create any type of chart. Use different charting objects to create different charts.
It is possible to create many different types of charts with Aspose.Cells. All standard charts supported by Aspose.Cells are pre‑defined in an enumeration named Aspose.Cells.Charts.ChartType.
The pre‑defined chart types are:
| Chart Types | Description |
|---|---|
| Column | Represents a clustered column chart |
| ColumnStacked | Represents a stacked column chart |
| Column100PercentStacked | Represents a 100 % stacked column chart |
| Column3DClustered | Represents a 3D clustered column chart |
| Column3DStacked | Represents a 3D stacked column chart |
| Column3D100PercentStacked | Represents a 3D 100 % stacked column chart |
| Column3D | Represents a 3D column chart |
| Bar | Represents a clustered bar chart |
| BarStacked | Represents a stacked bar chart |
| Bar100PercentStacked | Represents a 100 % stacked bar chart |
| Bar3DClustered | Represents a 3D clustered bar chart |
| Bar3DStacked | Represents a 3D stacked bar chart |
| Bar3D100PercentStacked | Represents a 3D 100 % stacked bar chart |
| Line | Represents a line chart |
| LineStacked | Represents a stacked line chart |
| Line100PercentStacked | Represents a 100 % stacked line chart |
| LineWithDataMarkers | Represents a line chart with data markers |
| LineStackedWithDataMarkers | Represents a stacked line chart with data markers |
| Line100PercentStackedWithDataMarkers | Represents a 100 % stacked line chart with data markers |
| Line3D | Represents a 3D line chart |
| Pie | Represents a pie chart |
| Pie3D | Represents a 3D pie chart |
| PiePie | Represents a pie‑of‑pie chart |
| PieExploded | Represents an exploded pie chart |
| Pie3DExploded | Represents a 3D exploded pie chart |
| PieBar | Represents a bar‑of‑pie chart |
| Scatter | Represents a scatter chart |
| ScatterConnectedByCurvesWithDataMarker | Represents a scatter chart connected by curves, with data markers |
| ScatterConnectedByCurvesWithoutDataMarker | Represents a scatter chart connected by curves, without data markers |
| ScatterConnectedByLinesWithDataMarker | Represents a scatter chart connected by lines, with data markers |
| ScatterConnectedByLinesWithoutDataMarker | Represents a scatter chart connected by lines, without data markers |
| Area | Represents an area chart |
| AreaStacked | Represents a stacked area chart |
| Area100PercentStacked | Represents a 100 % stacked area chart |
| Area3D | Represents a 3D area chart |
| Area3DStacked | Represents a 3D stacked area chart |
| Area3D100PercentStacked | Represents a 3D 100 % stacked area chart |
| Doughnut | Represents a doughnut chart |
| DoughnutExploded | Represents an exploded doughnut chart |
| Radar | Represents a radar chart |
| RadarWithDataMarkers | Represents a radar chart with data markers |
| RadarFilled | Represents a filled radar chart |
| Surface3D | Represents a 3D surface chart |
| SurfaceWireframe3D | Represents a wireframe 3D surface chart |
| SurfaceContour | Represents a contour chart |
| SurfaceContourWireframe | Represents a wireframe contour chart |
| Bubble | Represents a bubble chart |
| Bubble3D | Represents a 3D bubble chart |
| Cylinder | Represents a cylinder chart |
| CylinderStacked | Represents a stacked cylinder chart |
| Cylinder100PercentStacked | Represents a 100 % stacked cylinder chart |
| CylindricalBar | Represents a cylindrical bar chart |
| CylindricalBarStacked | Represents a stacked cylindrical bar chart |
| CylindricalBar100PercentStacked | Represents a 100 % stacked cylindrical bar chart |
| CylindricalColumn3D | Represents a 3D cylindrical column chart |
| Cone | Represents a cone chart |
| ConeStacked | Represents a stacked cone chart |
| Cone100PercentStacked | Represents a 100 % stacked cone chart |
| ConicalBar | Represents a conical bar chart |
| ConicalBarStacked | Represents a stacked conical bar chart |
| ConicalBar100PercentStacked | Represents a 100 % stacked conical bar chart |
| ConicalColumn3D | Represents a 3D conical column chart |
| Pyramid | Represents a pyramid chart |
| PyramidStacked | Represents a stacked pyramid chart |
| Pyramid100PercentStacked | Represents a 100 % stacked pyramid chart |
| PyramidBar | Represents a pyramid bar chart |
| PyramidBarStacked | Represents a stacked pyramid bar chart |
| PyramidBar100PercentStacked | Represents a 100 % stacked pyramid bar chart |
| PyramidColumn3D | Represents a 3D pyramid column chart |
When the example code is executed, a pyramid chart is added to the worksheet.
In the above example, simply changing the ChartType to Line creates a line chart. The complete source is provided below. When the code is executed, a line chart is added to the worksheet.
To create a bubble chart, the ChartType must be set to ChartType.Bubble and a few extra properties such as BubbleSizes, Values, and XValues need to be set accordingly. Upon executing the following code, a bubble chart is added to the worksheet.
To create a line chart with data markers, the ChartType must be set to ChartType.LineWithDataMarkers and a few extra properties such as background area, series markers, Values, and XValues must be set accordingly. Upon executing the following code, a line chart with data markers is added to the worksheet.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.