日期:2014-05-18 浏览次数:20728 次
/// <summary> /// 初始化曲线图 /// </summary> void GetMonthPercent(ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; myPane.XAxis.Title.Text = "日期"; myPane.YAxis.Title.Text = "百分率"; myPane.XAxis.Type = ZedGraph.AxisType.Date; myPane.XAxis.Scale.Format = "dd"; } /// <summary> /// 更新曲线图 /// </summary> /// <param name="zgc"></param> void RefreshMonthZedGraphControl(ZedGraphControl zgc, DataSet dsTemps1) { GraphPane myPane = zgc.GraphPane; myPane.Title.Text = UserList.Text + "的月巡检率"; myPane.CurveList.Clear(); PointPairList pl = new PointPairList(); LineItem li; for (int x = 1; x < 31; x++) { try { string st = dsTemps1.Tables[0].Rows[x - 1][1].ToString(); double y = double.Parse(dsTemps1.Tables[0].Rows[x - 1][1].ToString()); pl.Add(x, y*100); } catch { pl.Add(x, 0); } } li = zgc.GraphPane.AddCurve("完成率", pl, Color.Red, SymbolType.None); zgc.AxisChange(); zgc.Refresh(); }