Back to Devexpress

Diagram3D.RotationType Property

corelibraries-devexpress-dot-xtracharts-dot-diagram3d-40fc6cbb.md

latest9.0 KB
Original Source

Diagram3D.RotationType Property

Gets or sets the rotation type, that determines whether the chart is rotated by specified angle values or it conforms to mouse movements.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public RotationType RotationType { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property RotationType As RotationType

Property Value

TypeDescription
RotationType

A RotationType enumeration value.

|

Available values:

NameDescription
UseMouseStandard

The 3D chart is rotated at design time with the Ctrl+mouse pointer (at runtime only the mouse pointer should be used); and the rotation is based upon the standard rotation algorithm. In this instance the chart diagram is rotated around the X-axis and Y-axis of the chart’s diagram.

For instance, to start rotating a 3D chart at design time you need to press the Ctrl button, then left-click the chart’s diagram and start moving the mouse pointer.

To start rotating a 3D chart at runtime, you need to simply left-click the chart’s diagram and start moving the mouse pointer. Note that in this instance, the RuntimeRotation property must be set to true.

| | UseMouseAdvanced |

The 3D chart is rotated at design time with the Ctrl+mouse pointer (at runtime only the mouse pointer should be used); and the rotation is based upon the advanced rotation algorithm. In this instance the chart diagram is rotated around the axes which have the same directions as the X-axis and Y-axis of the screen.

For instance, to start rotating a 3D chart at design time, you need to press the Ctrl button, then left-click the chart’s diagram and start moving the mouse pointer.

To start rotating a 3D chart at runtime, you need to simply left-click the chart’s diagram and start moving the mouse pointer. Note that in this instance, the RuntimeRotation property must be set to true.

| | UseAngles |

The 3D chart is rotated around the X, Y and Z axes by the Diagram3D.RotationAngleX, Diagram3D.RotationAngleY and Diagram3D.RotationAngleZ values in the order defined by the Diagram3D.RotationOrder property.

|

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RotationType property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-chart-create-a-3d-pie-chart/CS/3DPieChart/Form1.cs#L41

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

winforms-chart-create-a-3d-pie-chart/VB/3DPieChart/Form1.vb#L38

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

See Also

Diagram3D Class

Diagram3D Members

DevExpress.XtraCharts Namespace