ZedGraph 第三方控件画图功能
1 ZedGraph. LineItem curveCurrent ; 2 3 ZedGraph. PointPairList listCurrent= new ZedGraph.PointPairList(); 4 5 ZedGraph.ZedGraphControl zedControlCurrent = new ZedGraph.ZedGraphControl ();//定义 6 7 zedControlCurrent.GraphPane.Title.Text = "图像标题" ;//图像名称 8 9 zedControlCurrent.GraphPane.XAxis.Title.Text = DateTime.Now.ToShortDateString();//x轴坐标 10 11 zedControlCurrent.GraphPane.YAxis.Title.Text = "y轴" ;//y轴 12 13 this.zedControlCurrent.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal; 14 15 curveCurrent =zedControlCurrent.GraphPane.AddCurve( "x轴", 16 17 listCurrent, Color.DarkOrange, ZedGraph.SymbolType .None); 18 19 this.zedControlCurrent.GraphPane.XAxis.Scale.Format = "HH:mm:ss";//24小时制,hh:mm:ss 为12小时制 20 21 this.zedControlCurrent.AxisChange(); 22 this.zedControlCurrent.Refresh(); 23 listCurrent.Add(time, 3.2);//往其中添加数据 24 25 this.zedControlCurrent.AxisChange(); 26 27 zedControlCurrent.SaveAsBitmap(AppDomain.CurrentDomain.BaseDirectory + @"文件夹名称\" + zedControlCurrent.GraphPane.Title.Text + ".jpeg");//将曲线图保存为jpeg格式 28 29 this.zedControlCurrent.Refresh();
一分辛苦一分才