DevExpress之ChartControl实现时间轴实例

2019-12-26 12:22:31王冬梅
易采站长站为您分析DevExpress中ChartControl实现时间轴的方法,涉及相关C#绘图程序用法,具有一定的实用价值,需要的朋友可以参考下    

本文实例讲述了DevExpress采用ChartControl实现时间轴的方法,。具体实现方法如下:

关键代码如下:

 

复制代码 using System;
using System.Data;
using System.Windows.Forms;
using DevExpress.XtraCharts;

 

namespace DevExpressChart
{
    public partial class winDateTime : Form
    {
        public winDateTime()
        {
            InitializeComponent();
        }

        private void winDateTime_Load(object sender, EventArgs e)
        {
            BuilderDevChart();
        }
        private DataTable CreateChartData()
        {
            DataTable table = new DataTable("Table1");
            table.Columns.Add("Date", typeof(DateTime));
            table.Columns.Add("Value", typeof(Int32));
            table.Rows.Add(new object[] { new DateTime(2014, 5, 21), 10 });
            table.Rows.Add(new object[] { new DateTime(2014, 6, 22), 20 });
            table.Rows.Add(new object[] { new DateTime(2014, 7, 23), 40 });
            table.Rows.Add(new object[] { new DateTime(2014, 8, 24), 20 });
            table.Rows.Add(new object[] { new DateTime(2014, 9, 25), 30 });
            return table;
        }
        private void BuilderDevChart()
        {
            Series _lineSeries = new Series("利润", ViewType.Line);