简要说明
圆环图 是由 Doughnut3DSeriesView 对象来表示的,此对象属于 饼、圆环和漏斗系列视图。 当需要比较相同系列中不同点参数的百分比取值时、并且以易于理解的圆环切块来说明这些取值时,使用这种视图。 另外,三维外观使旋转图表变得可能,从而以一种吸引眼球且易于理解的方式来放置圆环切块。
在下面的插图中显示了一个圆环图。
图表类型特征
下表列出了这种图表类型的主要特征。
特征 |
取值 |
---|---|
系列视图类型 | Doughnut3DSeriesView |
图象类型 | SimpleDiagram3D |
每个数据点的参数个数 | 1 |
每个数据点的取值个数 | 1 |
注意 |
---|
要获得关于哪些图表类型可以与 圆环图 组合使用的信息,请参阅 组合使用不同的系列视图 文档。 |
示例
下面的示例演示了在运行时刻如何创建 ChartControl (拥有一个 Doughnut3DSeriesView 类型的系列),设置它的常规属性,并把图表添加到窗体中。 在继续本示例之前,首先要在 Visual Studio 中创建一个 Windows 窗体应用程序,并把所有 必需的程序集 包含到项目的“引用”列表中。
然后,把下列代码添加到 Form.Load 事件处理程序。
C# | 复制代码 |
---|---|
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); } |
Visual Basic | 复制代码 |
---|---|
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 |
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E1020。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |