c# devexpress学习绘图
用字典方式存储数据并绘图:http://www.xuebuyuan.com/465384.html
数据库存储数据,并对图形作各种设置:http://www.cnblogs.com/xuhaibiao/archive/2012/08/23/2652142.html 有图有代码:http://www.cnblogs.com/xuhaibiao/archive/2012/08/23/2652148.html
1 using DevExpress.XtraCharts; 2 using System; 3 using System.Collections.Generic; 4 using System.ComponentModel; 5 using System.Data; 6 using System.Drawing; 7 using System.Linq; 8 using System.Text; 9 using System.Windows.Forms; 10 11 namespace DXApplication1chart1 12 { 13 public partial class Form1 : DevExpress.XtraEditors.XtraForm 14 { 15 public Form1() 16 { 17 InitializeComponent(); 18 } 19 20 private void Form1_Load(object sender, EventArgs e) 21 { 22 23 } 24 25 private void button1_Click(object sender, EventArgs e) 26 { 27 this.xtraTabControl1.TabPages.Add("普通折线图"); 28 ChartControl lineChart = new ChartControl(); 29 Series series1 = new Series("通过人数", ViewType.Line); 30 series1.ArgumentScaleType = ScaleType.Numerical; 31 ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle; 32 ((LineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Dash; 33 series1.Points.Add(new SeriesPoint(1, new double[] { 2 })); 34 series1.Points.Add(new SeriesPoint(2, new double[] { 3 })); 35 series1.Points.Add(new SeriesPoint(3, new double[] { 4 })); 36 series1.Points.Add(new SeriesPoint(4, new double[] { 6 })); 37 series1.Points.Add(new SeriesPoint(5, new double[] { 8 })); 38 series1.Points.Add(new SeriesPoint(6, new double[] { 10 })); 39 series1.Points.Add(new SeriesPoint(7, new double[] { 12 })); 40 series1.Points.Add(new SeriesPoint(8, new double[] { 15 })); 41 series1.CheckableInLegend = true; 42 43 Series series2 = new Series("报名人数", ViewType.Line); 44 series2.ArgumentScaleType = ScaleType.Numerical; 45 ((LineSeriesView)series2.View).LineMarkerOptions.Kind = MarkerKind.Cross; 46 ((LineSeriesView)series2.View).LineStyle.DashStyle = DashStyle.DashDotDot; 47 series2.Points.Add(new SeriesPoint(1, new double[] { 3 })); 48 series2.Points.Add(new SeriesPoint(2, new double[] { 5 })); 49 series2.Points.Add(new SeriesPoint(3, new double[] { 6 })); 50 series2.Points.Add(new SeriesPoint(4, new double[] { 7 })); 51 series2.Points.Add(new SeriesPoint(5, new double[] { 11 })); 52 series2.Points.Add(new SeriesPoint(6, new double[] { 13 })); 53 series2.Points.Add(new SeriesPoint(7, new double[] { 15 })); 54 series2.Points.Add(new SeriesPoint(8, new double[] { 18 })); 55 lineChart.Series.Add(series1); lineChart.Series.Add(series2); lineChart.Legend.Visible = true; 56 ((XYDiagram)lineChart.Diagram).Rotated = false; 57 lineChart.Dock = DockStyle.Fill; lineChart.Size = new System.Drawing.Size(400, 250); 58 this.Controls.Add(lineChart); 59 int tabPagesCount = this.xtraTabControl1.TabPages.Count - 1; 60 this.xtraTabControl1.TabPages[tabPagesCount].Controls.Add(lineChart); 61 this.xtraTabControl1.SelectedTabPageIndex = tabPagesCount; 62 } 63 } 64 }