[WinForm]Dundas Chart控件学习(附源码)

1Dundas公司简介

     加拿大的一家公司,专业做图表展现的,很牛,据说现在被Microsoft收购了。官网地址:http://www.dundas.com/

2Chart基本要素

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;

源码: 动态显示信号_正弦波.zip

原文地址:https://www.cnblogs.com/huxiaolin/p/4484955.html