ChartType Enumeration
Specifies type of a chart.

Namespace: Aspose.Words.Drawing.Charts
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public enum ChartType
Members
  Member nameValueDescription
Area0 Area chart.
AreaStacked1 Stacked Area chart.
AreaPercentStacked2 100% Stacked Area chart.
Area3D3 3D Area chart.
Area3DStacked4 3D Stacked Area chart.
Area3DPercentStacked5 3D 100% Stacked Area chart.
Bar6 Bar chart.
BarStacked7 Stacked Bar chart.
BarPercentStacked8 100% Stacked Bar chart.
Bar3D9 3D Bar chart.
Bar3DStacked10 3D Stacked Bar chart.
Bar3DPercentStacked11 3D 100% Stacked Bar chart.
Bubble12 Bubble chart.
Bubble3D13 3D Bubble chart.
Column14 Column chart.
ColumnStacked15 Stacked Column chart.
ColumnPercentStacked16 100% Stacked Column chart.
Column3D17 3D Column chart.
Column3DStacked18 3D Stacked Column chart.
Column3DPercentStacked19 3D 100% Stacked Column chart.
Column3DClustered20 3D Clustered Column chart.
Doughnut21 Doughnut chart.
Line22 Line chart.
LineStacked23 Stacked Line chart.
LinePercentStacked24 100% Stacked Line chart.
Line3D25 3D Line chart.
Pie26 Pie chart.
Pie3D27 3D Pie chart.
PieOfBar28 Pie of Bar chart.
PieOfPie29 Pie of Pie chart.
Radar30 Radar chart.
Scatter31 Scatter chart.
Stock32 Stock chart.
Surface33 Surface chart.
Surface3D34 3D Surface chart.
Examples
Shows an appropriate graph type for each chart series.
public void ChartSeriesCollection()
{
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    // There are 4 ways of populating a chart's series collection
    // 1: Each series has a string array of categories, each with a corresponding data value
    // Some of the other possible applications are bar, column, line and surface charts
    Chart chart = AppendChart(builder, ChartType.Column, 300, 300);

    // Create and name 3 categories with a string array
    string[] categories = { "Category 1", "Category 2", "Category 3" };

    // Create 2 series of data, each with one point for every category
    // This will generate a column graph with 3 clusters of 2 bars
    chart.Series.Add("Series 1", categories, new [] { 76.6, 82.1, 91.6 });
    chart.Series.Add("Series 2", categories, new [] { 64.2, 79.5, 94.0 });

    // Categories are distributed along the X-axis while values are distributed along the Y-axis
    Assert.AreEqual(ChartAxisType.Category, chart.AxisX.Type);
    Assert.AreEqual(ChartAxisType.Value, chart.AxisY.Type);

    // 2: Each series will have a collection of dates with a corresponding value for each date
    // Area, radar and stock charts are some of the appropriate chart types for this
    chart = AppendChart(builder, ChartType.Area, 300, 300);

    // Create a collection of dates to serve as categories
    DateTime[] dates = { new DateTime(2014, 3, 31),
        new DateTime(2017, 1, 23),
        new DateTime(2017, 6, 18),
        new DateTime(2019, 11, 22),
        new DateTime(2020, 9, 7)
    };

    // Add one series with one point for each date
    // Our sporadic dates will be distributed along the X-axis in a linear fashion 
    chart.Series.Add("Series 1", dates, new [] { 15.8, 21.5, 22.9, 28.7, 33.1 });

    // 3: Each series will take two data arrays
    // Appropriate for scatter plots
    chart = AppendChart(builder, ChartType.Scatter, 300, 300);

    // In each series, the first array contains the X-coordinates and the second contains respective Y-coordinates of points
    chart.Series.Add("Series 1", new[] { 3.1, 3.5, 6.3, 4.1, 2.2, 8.3, 1.2, 3.6 }, new[] { 3.1, 6.3, 4.6, 0.9, 8.5, 4.2, 2.3, 9.9 });
    chart.Series.Add("Series 2", new[] { 2.6, 7.3, 4.5, 6.6, 2.1, 9.3, 0.7, 3.3 }, new[] { 7.1, 6.6, 3.5, 7.8, 7.7, 9.5, 1.3, 4.6 });

    // Both axes are value axes in this case
    Assert.AreEqual(ChartAxisType.Value, chart.AxisX.Type);
    Assert.AreEqual(ChartAxisType.Value, chart.AxisY.Type);

    // 4: Each series will be built from three data arrays, used for bubble charts
    chart = AppendChart(builder, ChartType.Bubble, 300, 300);

    // The first two arrays contain X/Y coordinates like above and the third determines the thickness of each point
    chart.Series.Add("Series 1", new [] { 1.1, 5.0, 9.8 }, new [] { 1.2, 4.9, 9.9 }, new [] { 2.0, 4.0, 8.0 });

    doc.Save(ArtifactsDir + "Charts.ChartSeriesCollection.docx");
}

/// <summary>
/// Get the DocumentBuilder to insert a chart of a specified ChartType, width and height and clean out its default data
/// </summary>
private Chart AppendChart(DocumentBuilder builder, ChartType chartType, double width, double height)
{
    Shape chartShape = builder.InsertChart(chartType, width, height);
    Chart chart = chartShape.Chart;
    chart.Series.Clear();

    Assert.AreEqual(0, chart.Series.Count);

    return chart;
}
See Also