//创建圖形式的Chart
System.Windows.Forms.DataVisualization.Charting.Chart chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
//定义一个chart
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
//定义一个绘图区域
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
chartArea1.AxisY.LabelStyle.Format = "0%";
//定义一个数据列
chartArea1.Name = "ChartArea1";
//其实没有必要,可以使用chart1。ChartAreas[0]就可以了
chart1.ChartAreas.Add(chartArea1);
//完成Chart和chartArea的关联
//System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
//legend1.Name = "图标";
//chart1.Legends.Add(legend1);
chart1.Name = "chart1";
//series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;//定於為線性還是餅形
//设置线性
Random rd = new Random();
double[] num = new double[20];
//for (int i = 0; i < 20; i++)
//{
// int valuey = rd.Next(1,1);
// DataPoint point = new DataPoint((i + 1), valuey);
// seri
System.Windows.Forms.DataVisualization.Charting.Chart
最新推荐文章于 2024-07-01 09:52:18 发布