Back to Devexpress

Pie Chart

aspnet-15934-components-chart-control-concepts-creating-charts-3d-chart-types-pie-chart.md

latest6.0 KB
Original Source

Pie Chart

  • May 28, 2025
  • 3 minutes to read

Short Description

The Pie Chart is represented by the Pie3DSeriesView object, which belongs to Pie, Doughnut and Funnel Series Views. This view is useful when it’s necessary to compare the percentage values of different point arguments in the same series, and to illustrate these values as easy to understand pie slices.

A Pie chart is shown in the image below.

Chart Type Characteristics

The table below lists the main characteristics of this chart type.

FeatureValue
Series View typePie3DSeriesView
Diagram typeSimpleDiagram3D
Number of arguments per series point1
Number of values per series point1

Note

For information on which chart types can be combined with the Pie Chart , refer to the Combining Different Series Views document.

Example

The following example demonstrates how to create a ChartControl with a series of the Pie3DSeriesView type, set its general properties, and add this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and include all necessary assemblies to the References list of your project.

Then, add the following code to the Form.Load event handler.

csharp
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create an empty chart.
    ChartControl PieChart3D = new ChartControl();

    // Create a pie series.
    Series series1 = new Series("Pie Series 1", ViewType.Pie3D);

    // Populate the series with points.
    series1.Points.Add(new SeriesPoint("Russia", 17.0752));
    series1.Points.Add(new SeriesPoint("Canada", 9.98467));
    series1.Points.Add(new SeriesPoint("USA", 9.63142));
    series1.Points.Add(new SeriesPoint("China", 9.59696));
    series1.Points.Add(new SeriesPoint("Brazil", 8.511965));
    series1.Points.Add(new SeriesPoint("Australia", 7.68685));
    series1.Points.Add(new SeriesPoint("India", 3.28759));
    series1.Points.Add(new SeriesPoint("Others", 81.2));

    // Add the series to the chart.
    PieChart3D.Series.Add(series1);

    // Adjust the value numeric options of the series.
    series1.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent;
    series1.PointOptions.ValueNumericOptions.Precision = 0;

    // Adjust the view-type-specific options of the series.
    ((Pie3DSeriesView)series1.View).Depth = 30;
    ((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[0]);
    ((Pie3DSeriesView)series1.View).ExplodedDistancePercentage = 30;

    // Access the diagram's options.
    ((SimpleDiagram3D)PieChart3D.Diagram).RotationType = RotationType.UseAngles;
    ((SimpleDiagram3D)PieChart3D.Diagram).RotationAngleX = -35;

    // Add a title to the chart and hide the legend.
    ChartTitle chartTitle1 = new ChartTitle();
    chartTitle1.Text = "3D Pie Chart";
    PieChart3D.Titles.Add(chartTitle1);
    PieChart3D.Legend.Visible = false;

    // Add the chart to the form.
    PieChart3D.Dock = DockStyle.Fill;
    this.Controls.Add(PieChart3D);
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    ' Create an empty chart.
    Dim PieChart3D As New ChartControl()

    ' Create a pie series.
    Dim series1 As New Series("Pie Series 1", ViewType.Pie3D)

    ' Populate the series with points.
    series1.Points.Add(New SeriesPoint("Russia", 17.0752))
    series1.Points.Add(New SeriesPoint("Canada", 9.98467))
    series1.Points.Add(New SeriesPoint("USA", 9.63142))
    series1.Points.Add(New SeriesPoint("China", 9.59696))
    series1.Points.Add(New SeriesPoint("Brazil", 8.511965))
    series1.Points.Add(New SeriesPoint("Australia", 7.68685))
    series1.Points.Add(New SeriesPoint("India", 3.28759))
    series1.Points.Add(New SeriesPoint("Others", 81.2))

    ' Add the series to the chart.
    PieChart3D.Series.Add(series1)

    ' Adjust the value numeric options of the series.
    series1.PointOptions.ValueNumericOptions.Format = NumericFormat.Percent
    series1.PointOptions.ValueNumericOptions.Precision = 0

    ' Adjust the view-type-specific options of the series.
    CType(series1.View, Pie3DSeriesView).Depth = 30
    CType(series1.View, Pie3DSeriesView).ExplodedPoints.Add(series1.Points(0))
    CType(series1.View, Pie3DSeriesView).ExplodedDistancePercentage = 30

    ' Access the diagram's options.
    CType(PieChart3D.Diagram, SimpleDiagram3D).RotationType = RotationType.UseAngles
    CType(PieChart3D.Diagram, SimpleDiagram3D).RotationAngleX = -35

    ' Add a title to the chart and hide the legend.
    Dim chartTitle1 As New ChartTitle()
    chartTitle1.Text = "3D Pie Chart"
    PieChart3D.Titles.Add(chartTitle1)
    PieChart3D.Legend.Visible = False

    ' Add the chart to the form.
    PieChart3D.Dock = DockStyle.Fill
    Me.Controls.Add(PieChart3D)
End Sub

Tip

For the complete sample project, see the following DevExpress Support Center example: https://supportcenter.devexpress.com/ticket/details/e1028/chart-for-winforms-create-a-3d-pie-chart.

See Also

Simple Diagram 3D