Winfrom Chart饼状图的使用
2015-02-11 17:28
375 查看
应用
using System.Windows.Forms.DataVisualization.Charting;
Title title1 = new Title();
title1.Text = "总合格率(%)";
title1.ForeColor = Color.Blue;
this.chart1.Titles.Add(title1);
this.chart1.Series.Clear();
Series series1 = new Series();
series1.ChartType = SeriesChartType.Pie;
this.chart1.Series.Add(series1);
int[] percents = new int[3] { 20, 30, 50 };
string[] pointsText = new string[3] { "紧急", "严重", "普通" };
Color[] myColor = new Color[3] { Color.FromArgb(0, 183, 238),
Color.FromArgb(250, 205, 137),
Color.FromArgb(255, 124, 255)};
DataPoint[] AllPoints = new DataPoint[3];
for (int i = 0; i < AllPoints.Length; i++)
{
AllPoints[i] = new DataPoint(i + 1, percents[i]);
AllPoints[i].LegendText = "紧急";
AllPoints[i].Color = myColor[i];
AllPoints[i].ToolTip = percents[i].ToString() + "%";
AllPoints[i].Label = percents[i].ToString() + "%";
AllPoints[i].LabelForeColor = Color.Black;
this.chart1.Series[0].Points.Add(AllPoints[i]);
}
this.chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
this.chart1.Series[0]["PieLabelStyle"] = "Outside";
this.chart1.EndInit();
using System.Windows.Forms.DataVisualization.Charting;
Title title1 = new Title();
title1.Text = "总合格率(%)";
title1.ForeColor = Color.Blue;
this.chart1.Titles.Add(title1);
this.chart1.Series.Clear();
Series series1 = new Series();
series1.ChartType = SeriesChartType.Pie;
this.chart1.Series.Add(series1);
int[] percents = new int[3] { 20, 30, 50 };
string[] pointsText = new string[3] { "紧急", "严重", "普通" };
Color[] myColor = new Color[3] { Color.FromArgb(0, 183, 238),
Color.FromArgb(250, 205, 137),
Color.FromArgb(255, 124, 255)};
DataPoint[] AllPoints = new DataPoint[3];
for (int i = 0; i < AllPoints.Length; i++)
{
AllPoints[i] = new DataPoint(i + 1, percents[i]);
AllPoints[i].LegendText = "紧急";
AllPoints[i].Color = myColor[i];
AllPoints[i].ToolTip = percents[i].ToString() + "%";
AllPoints[i].Label = percents[i].ToString() + "%";
AllPoints[i].LabelForeColor = Color.Black;
this.chart1.Series[0].Points.Add(AllPoints[i]);
}
this.chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
this.chart1.Series[0]["PieLabelStyle"] = "Outside";
this.chart1.EndInit();
相关文章推荐
- 使用组件来保护你的ASP代码
- SCI软件使用方法总结-定位测量篇
- IP 伪装简易使用说明
- 源码推荐:一个使用C#绘制图形引擎的Framework
- Win32汇编教程六 工具栏和状态栏的使用
- Win32汇编教程五 菜单和加速键的使用
- Win32汇编教程三 一个简单的对话框 --- 兼谈资源文件的使用
- 使用ActiveX控件开发网页常见的问题
- 使用 ASP+ DataGrid 控件来创建主视图/详细资料视图 (2)
- 使用 ASP+ DataGrid 控件来创建主视图/详细资料视图
- 手册中关于怎样使用TQuery 的误导
- 使用ASP和Word进行服务器端拼写检查
- 单独使用CRecordSet
- 在 Web 页上使用条件数值格式
- 关于PHP与Sybase数据库的连接与使用
- 使用ASP常见问题解答
- [导入]Guru of the Week:#41 使用标准库
- 如何使用ASP进行打印操作
- VB中Winsock控制的UDP协议的使用
- FUNCky 的使用