我将42楼中的代码修改了以下,横坐标可以显示日期:
- protected void Page_Load(object sender, EventArgs e)
- {
- DataSet ds = new DataSet();
- DataTable dt = new DataTable();
- dt.Columns.Add("ID",typeof(int));
- dt.Columns.Add("UNIT_CODE");
- dt.Columns.Add("PROCESS_CODE");
- dt.Columns.Add("PRODUCT_CODE");
- dt.Columns.Add("MEDIA_CODE");
- dt.Columns.Add("PRODUCE_CONSUME");
- dt.Columns.Add("UNIT_CONSUMPTION_TYPE");
- dt.Columns.Add("AUTOMATIC_DATA");
- dt.Columns.Add("MODIFY_DATA",typeof(int));
- dt.Columns.Add("STATUS");
- dt.Columns.Add("UNIT");
- dt.Columns.Add("OPERATOR");
- dt.Columns.Add("INPUT_DATE");
- dt.Columns.Add("REMARK");
- dt.Rows.Add(4, "", "11", "", "EE", "", "季", "", 12348, "", "", "", "2011/8/4", "");
- dt.Rows.Add(2, "", "11", "", "EE", "", "季", "",12345, "", "", "", "2011/8/2", "");
- dt.Rows.Add(3, "", "11", "", "EE", "", "季", "",12347, "", "", "", "2011/8/3", "");
- dt.Rows.Add(1, "", "11", "", "EE", "", "季", "",12345, "", "", "", "2011/8/1", "");
- dt.Rows.Add(5, "", "11", "", "EE", "", "季", "", 12348, "", "", "", "2011/8/5", "");
- dt.Rows.Add(6, "", "11", "", "EE", "", "季", "", 12346, "", "", "", "2011/8/6", "");
- dt.Rows.Add(7, "", "11", "", "EE", "", "季", "", 12345, "", "", "", "2011/8/7", "");
- ds.Tables.Add(dt);
- C1WebChart1.DataSource = ds.Tables[0];
- C1WebChart1.DataMember = ds.Tables[0].TableName;
- ChartDataSeriesCollection sc = C1WebChart1.ChartGroups[0].ChartData.SeriesList;
- sc.RemoveAll();
- ChartDataSeries s = sc.AddNewSeries();
- s.X.DataField = "INPUT_DATE";
- s.Y.DataField = "MODIFY_DATA";
- C1WebChart1.ChartArea.AxisY.Min = 12340;
- C1WebChart1.ChartArea.AxisY.Max = 12350;
-
- }
复制代码 |