flutterpiechart_chartControl 饼状图小Demo

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. In addition, the 3D look makes it possible to rotate a chart to position pie slices in an attractive and easy-to-understand way.

A Pie chart is shown in the image below.

HelpResource.ashx?help=WindowsForms&document=img5378.jpg

Chart Type Characteristics

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

FeatureValue

Series View type

Number of arguments per series point

1

Number of values per series point

1

8826ce34c43c1467469546c18712329b.gifNote

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.

使用ChartControl创建饼图,使用序列集类型为Pie3DSeriesView,设置通用属性,并添加图表到运行时。在运行例子之前,首先新建窗体应用程序,并添加需要的程序集到引用列表。

Then, add the following code to the Form.Load event handler.添加如下代码到Form.Load事件处理中

72d60438c4cb78de1e150c3cb4837053.gif

C#

VB

2442ba8beb80717ca256096065e14f33.gif

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);

}

------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The complete sample project is available in the DevExpress Code Central database at http://www.devexpress.com/example=E1028. Depending on the target platform type (ASP.NET, WinForms, etc), you can either run this example online or download an auto-executable sample.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值