Back to Devexpress

Doughnut3DSeriesView Class

corelibraries-devexpress-dot-xtracharts-dot-doughnut3dseriesview.md

latest7.1 KB
Original Source

Doughnut3DSeriesView Class

Represents a series view of the 3D Doughnut type.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public class Doughnut3DSeriesView :
    Pie3DSeriesView,
    IDoughnutSeriesView
vb
Public Class Doughnut3DSeriesView
    Inherits Pie3DSeriesView
    Implements IDoughnutSeriesView

Remarks

The Doughnut3DSeriesView class provides the functionality of a series view of the 3D Doughnut type within a chart control.

In addition to the common view settings inherited from the base Pie3DSeriesView class, the Doughnut3DSeriesView class declares the Doughnut type specific settings that allow you to define a percentage value for a hole radius (Doughnut3DSeriesView.HoleRadiusPercent).

Note that a particular view type can be defined for a series via its SeriesBase.View property.

For more information on series views of the pie type, please see the Doughnut Chart topic.

Example

The following example demonstrates how to create a ChartControl with a series of the Doughnut3DSeriesView 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 DoughnutChart3D = new ChartControl();

    // Create a doughnut series.
    Series series1 = new Series("Doughnut Series 1", ViewType.Doughnut3D);

    // 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.
    DoughnutChart3D.Series.Add(series1);

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

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

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

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

    // Add the chart to the form.
    DoughnutChart3D.Dock = DockStyle.Fill;
    this.Controls.Add(DoughnutChart3D);
}
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 DoughnutChart3D As New ChartControl()

    ' Create a doughnut series.
    Dim series1 As New Series("Doughnut Series 1", ViewType.Doughnut3D)

    ' 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.
    DoughnutChart3D.Series.Add(series1)

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

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

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

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

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

Implements

IXtraSerializable

IXtraSupportDeserializeCollectionItem

Inheritance

Object ChartElement SeriesViewBase SimpleDiagramSeriesViewBase PieSeriesViewBase Pie3DSeriesView Doughnut3DSeriesView

See Also

Doughnut3DSeriesView Members

Pie3DSeriesView

DevExpress.XtraCharts Namespace