用字典方式存储数据并绘图: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
using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace DXApplication1chart1
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
this.xtraTabControl1.TabPages.Add("普通折线图");
ChartControl lineChart = new ChartControl();
Series series1 = new Series("通过人数", ViewType.Line);
series1.ArgumentScaleType = ScaleType.Numerical;
((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
((LineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Dash;
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.Points.Add(new SeriesPoint(, new double[] { }));
series1.CheckableInLegend = true; Series series2 = new Series("报名人数", ViewType.Line);
series2.ArgumentScaleType = ScaleType.Numerical;
((LineSeriesView)series2.View).LineMarkerOptions.Kind = MarkerKind.Cross;
((LineSeriesView)series2.View).LineStyle.DashStyle = DashStyle.DashDotDot;
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
series2.Points.Add(new SeriesPoint(, new double[] { }));
lineChart.Series.Add(series1); lineChart.Series.Add(series2); lineChart.Legend.Visible = true;
((XYDiagram)lineChart.Diagram).Rotated = false;
lineChart.Dock = DockStyle.Fill; lineChart.Size = new System.Drawing.Size(, );
this.Controls.Add(lineChart);
int tabPagesCount = this.xtraTabControl1.TabPages.Count - ;
this.xtraTabControl1.TabPages[tabPagesCount].Controls.Add(lineChart);
this.xtraTabControl1.SelectedTabPageIndex = tabPagesCount;
}
}
}
devexpress14 绘图