ZedGraph X轴为时间

Random ran = new Random();

PointPairList list = new PointPairList();

LineItem myCurve;

 

this.zedGraphControl1.GraphPane.Title.Text = "动态折线图";

this.zedGraphControl1.GraphPane.XAxis.Title.Text = "时间";

this.zedGraphControl1.GraphPane.YAxis.Title.Text = "数量";

this.zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal;

 

for (int i = 0; i <= 10000; i++)

{

double x = (double)new XDate(DateTime.Now.AddSeconds(-(10000 - i)));

double y = ran.NextDouble();

list.Add(x, y);

}

DateTime dt = DateTime.Now;

 

myCurve = zedGraphControl1.GraphPane.AddCurve("My Curve",

list, Color.DarkGreen, SymbolType.None);

 

this.zedGraphControl1.AxisChange();

this.zedGraphControl1.Refresh();

posted on 2020-04-12 12:45  qq1151219115  阅读(518)  评论(0编辑  收藏  举报