-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form1.cs
56 lines (45 loc) · 2.16 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...
namespace _DPieChart {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
}
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.Label.TextPattern = "{VP:p0}";
// 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.Visibility = DevExpress.Utils.DefaultBoolean.False;
// Add the chart to the form.
PieChart3D.Dock = DockStyle.Fill;
this.Controls.Add(PieChart3D);
}
}
}