Spread WPF 17
Spread WPF Documentation / Developer's Guide / Working with Charts / Creating Charts / Creating Chart Types / Adding a 3D Chart
In This Topic
    Adding a 3D Chart
    In This Topic

    You can create 3D chart types such as Area3D, AreaStacked3D, AreaStacked100pc3D, BarStacked3D, BarStacked100pc3D, Column3D, ColumnStacked3D, ColumnStacked100pc3D, Line3D, Pie3D, PieExploded3D, and surface charts.

    The following image displays a 3D pie chart.

    An example of 3d Pie Chart

    The chart type must be a 3D type to create a 3D chart. You can also specify the perspective and rotation with the View3DSettings class.

    Using Code

    The following code creates a 3D pie chart.

    1. Create and add values with the SpreadDataSeries class.
    2. Create the chart and specify the chart type with the SpreadChart class.
    3. Set the perspective and rotation with the View3DSettings class.
    4. Add the chart.
    CS
    Copy Code
    GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries series0 = new GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries();
    series0.Name = "Series 0";
    series0.Values.Add(1.0);
    series0.Values.Add(2.0);
    series0.Values.Add(4.0);
    series0.Values.Add(8.0);
    GrapeCity.Windows.SpreadSheet.Data.SpreadChart chart = new GrapeCity.Windows.SpreadSheet.Data.SpreadChart();
    chart.DataSeries.Add(series0);
    chart.ChartType = GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Pie3D;
    chart.Name = "name1";
    chart.View3D.Perspective = 10;
    chart.View3D.RotationX = 5;
    chart.View3D.RotationZ = 5;
    chart.View3D.RotationY = 5;
    this.gcSpreadSheet1.ActiveSheet.Charts.Add(chart);
    VB.NET
    Copy Code
    Dim series0 As New GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries()
    series0.Name = "Series 0"
    series0.Values.Add(1.0)
    series0.Values.Add(2.0)
    series0.Values.Add(4.0)
    series0.Values.Add(8.0)
    Dim chart As New GrapeCity.Windows.SpreadSheet.Data.SpreadChart()
    chart.DataSeries.Add(series0)
    chart.ChartType = GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Pie3D
    chart.Name = "name1"
    chart.View3D.Perspective = 10
    chart.View3D.RotationX = 5
    chart.View3D.RotationZ = 5
    chart.View3D.RotationY = 5
    GcSpreadSheet1.ActiveSheet.Charts.Add(chart)
    See Also