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 with the following example codes:
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 chart, the data source can be a range of cells (such as “A1:C3”), or 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 Clustered Column Chart |
| ColumnStacked | Represents Stacked Column Chart |
| Column100PercentStacked | Represents 100% Stacked Column Chart |
| Column3DClustered | Represents 3D Clustered Column Chart |
| Column3DStacked | Represents 3D Stacked Column Chart |
| Column3D100PercentStacked | Represents 3D 100% Stacked Column Chart |
| Column3D | Represents 3D Column Chart |
| Bar | Represents Clustered Bar Chart |
| BarStacked | Represents Stacked Bar Chart |
| Bar100PercentStacked | Represents 100% Stacked Bar Chart |
| Bar3DClustered | Represents 3D Clustered Bar Chart |
| Bar3DStacked | Represents 3D Stacked Bar Chart |
| Bar3D100PercentStacked | Represents 3D 100% Stacked Bar Chart |
| Line | Represents Line Chart |
| LineStacked | Represents Stacked Line Chart |
| Line100PercentStacked | Represents 100% Stacked Line Chart |
| LineWithDataMarkers | Represents Line Chart with data markers |
| LineStackedWithDataMarkers | Represents Stacked Line Chart with data markers |
| Line100PercentStackedWithDataMarkers | Represents 100% Stacked Line Chart with data markers |
| Line3D | Represents 3D Line Chart |
| Pie | Represents Pie Chart |
| Pie3D | Represents 3D Pie Chart |
| PiePie | Represents Pie of Pie Chart |
| PieExploded | Represents Exploded Pie Chart |
| Pie3DExploded | Represents 3D Exploded Pie Chart |
| PieBar | Represents Bar of Pie Chart |
| Scatter | Represents Scatter Chart |
| ScatterConnectedByCurvesWithDataMarker | Represents Scatter Chart connected by curves, with data markers |
| ScatterConnectedByCurvesWithoutDataMarker | Represents Scatter Chart connected by curves, without data markers |
| ScatterConnectedByLinesWithDataMarker | Represents Scatter Chart connected by lines, with data markers |
| ScatterConnectedByLinesWithoutDataMarker | Represents Scatter Chart connected by lines, without data markers |
| Area | Represents Area Chart |
| AreaStacked | Represents Stacked Area Chart |
| Area100PercentStacked | Represents 100% Stacked Area Chart |
| Area3D | Represents 3D Area Chart |
| Area3DStacked | Represents 3D Stacked Area Chart |
| Area3D100PercentStacked | Represents 3D 100% Stacked Area Chart |
| Doughnut | Represents Doughnut Chart |
| DoughnutExploded | Represents Exploded Doughnut Chart |
| Radar | Represents Radar Chart |
| RadarWithDataMarkers | Represents Radar Chart with data markers |
| RadarFilled | Represents Filled Radar Chart |
| Surface3D | Represents 3D Surface Chart |
| SurfaceWireframe3D | Represents Wireframe 3D Surface Chart |
| SurfaceContour | Represents Contour Chart |
| SurfaceContourWireframe | Represents Wireframe Contour Chart |
| Bubble | Represents Bubble Chart |
| Bubble3D | Represents 3D Bubble Chart |
| Cylinder | Represents Cylinder Chart |
| CylinderStacked | Represents Stacked Cylinder Chart |
| Cylinder100PercentStacked | Represents 100% Stacked Cylinder Chart |
| CylindricalBar | Represents Cylindrical Bar Chart. |
| CylindricalBarStacked | Represents Stacked Cylindrical Bar Chart |
| CylindricalBar100PercentStacked | Represents 100% Stacked Cylindrical Bar Chart |
| CylindricalColumn3D | Represents 3D Cylindrical Column Chart |
| Cone | Represents Cone Chart |
| ConeStacked | Represents Stacked Cone Chart |
| Cone100PercentStacked | Represents 100% Stacked Cone Chart |
| ConicalBar | Represents Conical Bar Chart |
| ConicalBarStacked | Represents Stacked Conical Bar Chart |
| ConicalBar100PercentStacked | Represents 100% Stacked Conical Bar Chart |
| ConicalColumn3D | Represents 3D Conical Column Chart |
| Pyramid | Represents Pyramid Chart |
| PyramidStacked | Represents Stacked Pyramid Chart |
| Pyramid100PercentStacked | Represents 100% Stacked Pyramid Chart |
| PyramidBar | Represents Pyramid Bar Chart |
| PyramidBarStacked | Represents Stacked Pyramid Bar Chart |
| PyramidBar100PercentStacked | Represents 100% Stacked Pyramid Bar Chart |
| PyramidColumn3D | Represents 3D Pyramid Column Chart |
|
When you assign a range of cells as the data source, you can only set the range from top left to bottom right. For example, “A1:C3” is valid while “C3:A1” is invalid.
|
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.
In order to create a bubble chart, the ChartType has to be set to ChartType.Bubble and few extra properties such as BubbleSizes, Values & XValues need to be set accordingly. Upon executing the following code, a bubble chart is added to the worksheet.
In order to create a line with the data marker chart, ChartType has to be set to ChartType.LineWithDataMarkers and few extra properties such as background area,Series Markers, Values & XValues need to be set accordingly. Upon executing the following code, a line with the data marker chart 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.