Dundas学习系列——【02】Chart for .net
1、Dundas Chart For .net framework.
this framework provides over 200 detailed samples(光Chart就有200多种啊), complete with C# and VB.NET code, along with overviews and more, to ensure you are thoroughly familiar with Dundas Chart for .NET.
2、Chart基本要素
图 Chart 元素
3、最简单的柱状图
代码
//01 创建Chart对象
Chart chart = new Chart();
//02 创建ChartArea对象
ChartArea chartArea = new ChartArea();
//03 把ChartArea添加到Chart对象中
chart.ChartAreas.Add(chartArea);
//04 创建Series对象
Series series1 = new Series();
series1.Name = "测试细目";
//05 创建Point
Double[] db1 = {22};
Double[] db2 = {44};
DataPoint dp1 = new DataPoint();
dp1.XValue = 1;
dp1.YValues =db1;
DataPoint dp2 = new DataPoint();
dp2.XValue = 2;
dp2.YValues = db2;
//06 加入点
series1.Points.Add(dp1);
series1.Points.Add(dp2);
//07 加入series1
chart.Series.Add(series1);
//08 定义表头 标题
Title t = new Title();
t.Text = "我是标题我怕谁";
t.Color = Color.Red;
t.Font = new Font("Times New Roman", 12, FontStyle.Bold);
t.Alignment = System.Drawing.ContentAlignment.BottomCenter;
chart.Titles.Add(t);
//09 定义展现位置坐标
chart.Location = new System.Drawing.Point(0,0);
//10 Chart的大小
chart.Size = new System.Drawing.Size(360,260);
//11 展现Chart
this.Controls.AddRange(new System.Windows.Forms.Control[]{chart});
series1.Type = SeriesChartType.Pie;
series1.Type = SeriesChartType.Line;