private void InitialiseZedGraphPaneWithPositionData(GraphPane currentPane) { currentPane.Title.Text = "Position"; currentPane.XAxis.Title.Text = "Time (s)"; currentPane.YAxis.Title.Text = "Position (mm)"; currentPane.CurveList.Clear(); RollingPointPairList x0List = new RollingPointPairList(2000); RollingPointPairList x1List = new RollingPointPairList(2000); LineItem x0Curve = currentPane.AddCurve("Left Foot X", x0List, Color.Red, SymbolType.None); LineItem x1Curve = currentPane.AddCurve("Right Foot X", x1List, Color.Green, SymbolType.None); RollingPointPairList y0List = new RollingPointPairList(2000); RollingPointPairList y1List = new RollingPointPairList(2000); LineItem y0Curve = currentPane.AddCurve("Left Foot Y", y0List, Color.Orange, SymbolType.None); LineItem y1Curve = currentPane.AddCurve("Right Foot Y", y1List, Color.Blue, SymbolType.None); RollingPointPairList z0List = new RollingPointPairList(2000); RollingPointPairList z1List = new RollingPointPairList(2000); LineItem z0Curve = currentPane.AddCurve("Left Foot Z", z0List, Color.YellowGreen, SymbolType.None); LineItem z1Curve = currentPane.AddCurve("Right Foot Z", z1List, Color.Purple, SymbolType.None); ScaleGraphPaneProperties(currentPane, 0, 30, 1, 5); SetLineThickness(x0Curve); SetLineThickness(x1Curve); SetLineThickness(y0Curve); SetLineThickness(y1Curve); SetLineThickness(z0Curve); SetLineThickness(z1Curve); }
private void Form1_Load(object sender, EventArgs e) { // Khoa het cac Texbox va Button khi chua Connect cong COM PbStart.Enabled = false; GraphPane myPane = zed.GraphPane; myPane.Title.Text = "ANGLE"; myPane.XAxis.Title.Text = "Time,Seconds"; myPane.YAxis.Title.Text = "Angle"; RollingPointPairList list = new RollingPointPairList(60000); RollingPointPairList list1 = new RollingPointPairList(60000); RollingPointPairList list2 = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve("Diem zero", list, Color.Yellow, SymbolType.None); LineItem curve1 = myPane.AddCurve(" AngleKalman", list1, Color.Blue, SymbolType.None); LineItem curve2 = myPane.AddCurve("AngleCtrl or AngleComplem", list2, Color.Red, SymbolType.None); // timer1.Interval = 10; myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; zed.AxisChange(); TickStart = Environment.TickCount; }
private void Form1_Load(object sender, EventArgs e) { GraphPane myPane = zedGraphControl1.GraphPane; Lax = new RollingPointPairList(300); Kax = myPane.AddCurve("acc_roll", Lax, Color.Pink, SymbolType.None); Lay = new RollingPointPairList(300); Kay = myPane.AddCurve("acc_roll", Lay, Color.Blue, SymbolType.None); Laz = new RollingPointPairList(300); Kaz = myPane.AddCurve("acc_roll", Laz, Color.Purple, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; zedGraphControl1.AxisChange(); gui_settings = new GUI_settings(); comboBox3.SelectedIndex = gui_settings.iMapProviderSelectedIndex; gmap.MapProvider = mapProviders[gui_settings.iMapProviderSelectedIndex]; gmap.Zoom = 18; gmap.Invalidate(false); int w = gmap.Size.Width; gmap.Width = w + 1; gmap.Width = w; gmap.ShowCenter = false; }
/// <summary> /// ZedGraph 초기화 /// </summary> /// <param name="zed">ZedGraphControl</param> /// <param name="lineColor">Color</param> /// <param name="title">title</param> private void zedInit(ZedGraphControl zed, Color lineColor, string title) { zed.GraphPane.CurveList.Clear(); zed.GraphPane.GraphObjList.Clear(); zed.Refresh(); GraphPane myPane = zed.GraphPane; myPane.Title.Text = title; myPane.XAxis.Title.Text = "count"; myPane.YAxis.Title.Text = "weight"; myPane.XAxis.Title.IsVisible = false; myPane.YAxis.Title.IsVisible = false; myPane.XAxis.Scale.FontSpec.FontColor = Color.White; myPane.YAxis.Scale.FontSpec.FontColor = Color.White; myPane.Title.FontSpec.FontColor = Color.White; myPane.Border.Color = Color.White; myPane.Chart.Border.Color = Color.White; myPane.Fill = new Fill(Color.FromArgb(43, 30, 30)); myPane.Chart.Fill = new Fill(Color.FromArgb(43, 30, 30)); RollingPointPairList list = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve(title, list, lineColor, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; zed.AxisChange(); }
void ClearZedGraph() { zedGraphControl1.GraphPane.CurveList.Clear(); // Xóa đường zedGraphControl1.GraphPane.GraphObjList.Clear(); // Xóa đối tượng zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Đồ thị dữ liệu theo thời gian"; myPane.XAxis.Title.Text = "Thời gian (s)"; myPane.YAxis.Title.Text = "Dữ liệu"; RollingPointPairList list = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve("Dữ liệu", list, Color.Red, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = -100; myPane.YAxis.Scale.Max = 100; zedGraphControl1.AxisChange(); }
//曲线初始化 #region zedgragh_Init private void init_zedgragh() { int chartPoint = 200; zedGraphControl1.PanModifierKeys = Keys.None; //曲线可以左键拖拽 zedGraphControl1.ZoomStepFraction = 0.1; //(这是鼠标滚轮缩放的比例大小,值越大缩放就越灵敏) zedGraphControl1.IsShowHScrollBar = true; mGraphPane = zedGraphControl1.GraphPane; mGraphPane.Title.Text = "模拟采集曲线"; //添加两个Y轴,分别显示电压、电流 mGraphPane.XAxis.Title.Text = "时间"; mGraphPane.YAxis.Title.Text = "电压值"; mGraphPane.Y2Axis.IsVisible = false; mGraphPane.YAxis.Scale.FontSpec.FontColor = Color.Blue; mGraphPane.YAxis.Title.FontSpec.FontColor = Color.Blue; mGraphPane.XAxis.Scale.Min = 0; //X轴最小值0 mGraphPane.XAxis.Scale.Max = 50; //时间最大值30分钟 mGraphPane.XAxis.Scale.MinorStep = 1; //X轴小步长1,也就是小间隔 mGraphPane.XAxis.Scale.MajorStep = 10; //X轴大步长为5,也就是显示文字的大间隔 mGraphPane.YAxis.Scale.MinorStep = 1; //X轴小步长1,也就是小间隔(刻度线间隔) mGraphPane.YAxis.Scale.MajorStep = 1; //X轴大步长为5,也就是显示文字的大间隔(标识数字间隔) try { mGraphPane.YAxis.Scale.Min = Convert.ToDouble(textBox4.Text); //电压轴最小值0 mGraphPane.YAxis.Scale.Max = Convert.ToDouble(textBox3.Text); //电压最大值 mGraphPane.YAxis.Scale.MajorStep = Convert.ToDouble(textBox1.Text); //刻度线的距离 } catch { MessageBox.Show("参数错误!"); } // Display the Y axis grid lines mGraphPane.YAxis.MajorGrid.IsVisible = true; mGraphPane.YAxis.MinorGrid.IsVisible = true; // Fill the axis background with a color gradient mGraphPane.Chart.Fill = new Fill(Color.FromArgb(255, 255, 245), Color.FromArgb(255, 255, 190), 90F); mGraphPane.Fill = new Fill(Color.White, Color.FromArgb(220, 255, 255), 45.0f); //mGraphPane.CurveList.Clear(); //LineItem myCurve = mGraphPane.AddCurve("", list1, Color.Blue, SymbolType.None); //LineItem myCurve1 = mGraphPane.AddCurve("", list2, Color.Red, SymbolType.None); mGraphPane.CurveList.Clear(); RollingPointPairList[] lists = new RollingPointPairList[8]; mGraphPane.CurveList.Clear(); for (int i = 0; i < 8; i++) { lists[i] = new RollingPointPairList(chartPoint); LineItem myCurve = mGraphPane.AddCurve("", lists[i], CheckList[i].ForeColor, SymbolType.None); } }
private void addCurves() { RollingPointPairList list1 = new RollingPointPairList(DataShowCnt); RollingPointPairList list2 = new RollingPointPairList(DataShowCnt); RollingPointPairList list3 = new RollingPointPairList(DataShowCnt); RollingPointPairList list4 = new RollingPointPairList(DataShowCnt); //开始,增加的线是没有数据点的(也就是list为空) //★★★增加一条名称:Voltage,颜色Color.Bule,无符号,无数据的空线条 curve1 = myPane.AddCurve("", list1, Color.FromArgb(0, 255, 0), SymbolType.None); //curve.Line.IsSmooth = true; //平滑曲线 curve1.Line.SmoothTension = 0.6F; curve1.Line.Width = 2; //★★★第二条曲线 curve2 = myPane.AddCurve("", list2, Color.FromArgb(0, 255, 255), SymbolType.None); //curve2.Line.IsSmooth = true; //平滑曲线 curve2.Line.SmoothTension = 0.6F; curve2.Line.Width = 2; //★★★第三条曲线 curve3 = myPane.AddCurve("", list3, Color.FromArgb(255, 165, 0), SymbolType.None); //curve3.Line.IsSmooth = true; //平滑曲线 curve3.Line.SmoothTension = 0.6F; curve3.Line.Width = 2; //★★★第四条曲线 curve4 = myPane.AddCurve("", list4, Color.FromArgb(255, 255, 0), SymbolType.None); //curve4.Line.IsSmooth = true; //平滑曲线 curve4.Line.SmoothTension = 0.6F; curve4.Line.Width = 2; // *** END 四条曲线设置 *** }
private void zedGraphVibShow_Realtime() { int j; Color colour; GraphPane pane1 = graphShow1.GraphPane; pane1.Title.Text = "应变数据"; pane1.YAxis.Title.Text = "应变(ue)"; pane1.XAxis.Title.Text = "时间(s)"; pane1.XAxis.Scale.Min = 0; //X轴最小值0 pane1.XAxis.Scale.Max = _XScaleMax; //pane1.XAxis.Scale.MinorStep = _XScaleMax / 100;//X轴小步长1,也就是小间隔 pane1.XAxis.Scale.MajorStep = _XScaleMax / 20;//X轴大步长为5,也就是显示文字的大间隔 pane1.YAxis.MajorGrid.DashOff = 0; pane1.YAxis.MinorGrid.DashOff = 0; pane1.YAxis.MajorGrid.IsZeroLine = false; graphShow1.IsShowPointValues = false; graphShow1.IsShowHScrollBar = false; graphShow1.IsAutoScrollRange = false; graphShow1.IsShowPointValues = true; graphShow1.AxisChange(); graphShow1.Refresh(); for (j = 0; j < 8; j++) { colour = GetColor(j); voltLine[j] = new RollingPointPairList(1000); voltCurve[j] = pane1.AddCurve("电压" + j.ToString(), voltLine[j], colour, SymbolType.Diamond); } graphShow1.AxisChange(); graphShow1.Refresh(); }
// private void Form1_Load(object sender, EventArgs e) { string[] ports = SerialPort.GetPortNames(); cboxCom.Items.AddRange(ports); // khoi tao zedgraph GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Đồ thị dữ liệu theo thời gian"; myPane.XAxis.Title.Text = "Thời gian (s)"; myPane.YAxis.Title.Text = "Dữ Liệu"; RollingPointPairList list = new RollingPointPairList(60000); timer1.Interval = 1; // 1ms gửi lên 1 lần timer1.Start(); // chayj timer 1 LineItem curve = myPane.AddCurve("Dữ liệu", list, Color.Blue, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = -100; myPane.YAxis.Scale.Max = 100; curve.Line.Width = 3; myPane.AxisChange(); // gọi hàm xác định cỡ trục tickStart = Environment.TickCount; // khởi động timer vể vị trí ban đầu }
private void FormSerialPort_Load(object sender, EventArgs e) { string[] port = SerialPort.GetPortNames(); cBoxPortName.Items.AddRange(port); // Khởi tạo ZedGraph GraphPane myPane = zGrphPlotData.GraphPane; //Tác động các thành phần của Control, (GraphPane) myPane.Title.Text = "Đồ thị dữ liệu theo thời gian"; myPane.XAxis.Title.Text = "Thời gian (s)"; myPane.YAxis.Title.Text = "Dữ liệu"; RollingPointPairList list = new RollingPointPairList(60000); //Tạo mới danh sách dữ liệu 60000 phần tử, có khả năng cuốn chiếu LineItem curve = myPane.AddCurve("Giá trị đặt", list, Color.Red, SymbolType.None); //Tạo mới đường cong của đồ thị trên GraphPane dựa vào danh sách dữ liệu RollingPointPairList list2 = new RollingPointPairList(60000); LineItem curve2 = myPane.AddCurve("Giá trị đo", list2, Color.MediumSlateBlue, SymbolType.None); myPane.XAxis.Scale.Min = 0; //Đặt giới hạn đồ thị myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; //Đặt các bước độ chia myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = -100; //Tương tự cho trục y myPane.YAxis.Scale.Max = 100; myPane.AxisChange(); }
private void graphInit() { GraphPane graph = zedgraph.GraphPane; graph.Title.Text = "温度&光强实时动态图"; graph.Title.FontSpec.Size = 30; graph.XAxis.Title.Text = "时间"; graph.XAxis.Title.FontSpec.Size = 20; graph.YAxis.Title.Text = "数值"; graph.YAxis.Title.FontSpec.Size = 20; RollingPointPairList list1 = new RollingPointPairList(1200); RollingPointPairList list2 = new RollingPointPairList(1200); LineItem tempre = graph.AddCurve("温度", list1, System.Drawing.Color.Yellow, SymbolType.None); LineItem light = graph.AddCurve("光强", list2, System.Drawing.Color.Black, SymbolType.None); graph.XAxis.Scale.Min = 0; graph.XAxis.Scale.MaxGrace = 0.01; graph.XAxis.Scale.MaxGrace = 0.01; graph.XAxis.Scale.Max = 30; graph.XAxis.Scale.MinorStep = 1; graph.XAxis.Scale.MajorStep = 5; tickStart = Environment.TickCount; zedgraph.AxisChange(); }
/*Other methods ---------------------------------------------------------------------------------------------------------------------------*/ private void clearGraph() { zGrphPlotData.GraphPane.CurveList.Clear(); // Xóa đường zGrphPlotData.GraphPane.GraphObjList.Clear(); // Xóa đối tượng zGrphPlotData.AxisChange(); zGrphPlotData.Invalidate(); realtime = 0; setpoint = 0; measure = 0; // Khởi tạo ZedGraph GraphPane myPane = zGrphPlotData.GraphPane; //Tác động các thành phần của Control, (GraphPane) myPane.Title.Text = "Đồ thị dữ liệu theo thời gian"; myPane.XAxis.Title.Text = "Thời gian (s)"; myPane.YAxis.Title.Text = "Dữ liệu"; RollingPointPairList list = new RollingPointPairList(60000); //Tạo mới danh sách dữ liệu 60000 phần tử, có khả năng cuốn chiếu LineItem curve = myPane.AddCurve("Giá trị đặt", list, Color.Red, SymbolType.None); //Tạo mới đường cong của đồ thị trên GraphPane dựa vào danh sách dữ liệu RollingPointPairList list2 = new RollingPointPairList(60000); LineItem curve2 = myPane.AddCurve("Giá trị đo", list2, Color.MediumSlateBlue, SymbolType.None); myPane.XAxis.Scale.Min = 0; //Đặt giới hạn đồ thị myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; //Đặt các bước độ chia myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = -100; //Tương tự cho trục y myPane.YAxis.Scale.Max = 100; myPane.AxisChange(); }
public frmVWMACDV2(Listeler listeler, int capacity = 610) { signalList = new RollingPointPairList(capacity); histList = new RollingPointPairList(capacity); vwmacdList = new RollingPointPairList(capacity); InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { btDisconnect.Enabled = false; gbRxData.Enabled = false; timer1.Enabled = true; btPause.Enabled = false; GraphPane MyPane = Graph.GraphPane; MyPane.Title.Text = "Display Graphic of DAC"; MyPane.XAxis.Title.Text = "Time(s)"; MyPane.YAxis.Title.Text = "Value(V)"; RollingPointPairList list = new RollingPointPairList(60000); LineItem curve = MyPane.AddCurve("Voltage", list, Color.Blue, SymbolType.None); MyPane.XAxis.Scale.Max = 30; MyPane.XAxis.Scale.Min = 0; MyPane.XAxis.Scale.MinorStep = 1; MyPane.XAxis.Scale.MajorStep = 5; Graph.AxisChange(); TickStart = Environment.TickCount; }
private void Form1_Load(object sender, EventArgs e) { button1.Enabled = false; button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; button8.Enabled = false; // initial Zedgraph GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Motor DC Control"; myPane.XAxis.Title.Text = "Time(s)"; myPane.YAxis.Title.Text = "Speed"; RollingPointPairList list1 = new RollingPointPairList(1200); RollingPointPairList list2 = new RollingPointPairList(1200); LineItem curve1 = myPane.AddCurve("SetPoint", list1, Color.Red, SymbolType.None); LineItem curve2 = myPane.AddCurve("Speed", list2, Color.Blue, SymbolType.None); timer1.Interval = 50; //50ms myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; zedGraphControl1.AxisChange(); tickStart = Environment.TickCount; }
private void MainForm_Load(object sender, EventArgs e) { InitSpectrometer(); // Debug.WriteLine($"DEBUG ZEDGRAPH ---------------- {zed.GraphPane.CurveList.Count}"); GraphPane myPane = zed.GraphPane; myPane.Title.Text = "Test"; myPane.XAxis.Title.Text = "Time(sec)"; myPane.YAxis.Title.Text = "Intensity (max value)"; myPane.XAxis.Title.FontSpec.Size = 17; myPane.YAxis.Title.FontSpec.Size = 17; RollingPointPairList list = new RollingPointPairList(60000); RollingPointPairList list1 = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve("Value1", list, Color.Red, SymbolType.None); //LineItem curve2 = myPane.AddCurve("Value2", list1, Color.Blue, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 10; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = 800; myPane.YAxis.Scale.Max = 850; zed.AxisChange(); TickStart = Environment.TickCount; //try //{ // if (!serialPort1.IsOpen) serialPort1.Open(); //} //catch (Exception ex) //{ //} }
public RasterPointList(int capacity, Axis axis, StateVisualizer visualizer) { cap = capacity; scale = axis.Scale; list = new RollingPointPairList(500); owner = visualizer; }
private void Form1_Load(object sender, EventArgs e) { GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Phase Graph"; myPane.XAxis.Title.Text = "Time (centisecond)"; myPane.YAxis.Title.Text = "Phase"; RollingPointPairList siji = new RollingPointPairList(60000); RollingPointPairList loro = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve("Phase 1", siji, Color.Red, SymbolType.None); LineItem curve1 = myPane.AddCurve("Phase 2", loro, Color.Blue, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 50; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = -300; myPane.YAxis.Scale.Max = 300; zedGraphControl1.AxisChange(); TickStart = Environment.TickCount; }
public void AddCurve(GraphPane pane, string name, string measure, Color color, SymbolType sType, int capacity) { _dataPointList = new RollingPointPairList(capacity); // Добавим кривую пока еще без каких-либо точек _myCurve = pane.AddCurve(string.Format("{0} ({1})", name, measure), _dataPointList, color, sType); }
// Build the Chart private void CreateGraph(ZedGraphControl zgc) { GraphPane Grafico = zgc.GraphPane; Grafico.Title.Text = "Diagrama Dinamico De Procesadores"; Grafico.Title.Text = "Datos"; Grafico.XAxis.Title.Text = "Puntos"; Grafico.YAxis.Title.Text = "Valores de X"; RollingPointPairList Lista = new RollingPointPairList(1200); LineItem curva = Grafico.AddCurve("Valores de X", Lista, Color.Blue, SymbolType.None); Grafico.XAxis.Scale.Min = 0; Grafico.XAxis.Scale.Max = 30; Grafico.XAxis.Scale.MinorStep = 1; Grafico.XAxis.Scale.MajorStep = 5; zgc.AxisChange(); }
private void InitGraph(string title, string xAxisTitle, string y1AxisTitle, string y2AxisTitle, TimeSeriesDataSource[] dataSourceArray) { _graphPane = zed.GraphPane; _graphPane.Title.Text = title; _graphPane.XAxis.Title.Text = xAxisTitle; _graphPane.XAxis.MajorGrid.IsVisible = true; _graphPane.YAxis.Title.Text = y1AxisTitle; _graphPane.YAxis.MajorGrid.IsVisible = true; _graphPane.Y2Axis.Title.Text = y2AxisTitle; _graphPane.Y2Axis.MajorGrid.IsVisible = false; // Create point-pair lists and bind them to the graph control. int sourceCount = dataSourceArray.Length; _pointPlotArray = new RollingPointPairList[sourceCount]; for(int i=0; i<sourceCount; i++) { TimeSeriesDataSource ds = dataSourceArray[i]; _pointPlotArray[i] = new RollingPointPairList(ds.HistoryLength); LineItem lineItem = _graphPane.AddCurve(ds.Name, _pointPlotArray[i], ds.Color, SymbolType.None); lineItem.IsY2Axis = (ds.YAxis == 1); } }
public void AddCurve(GraphPane pane, string name, Color color, int capacity = 8192) { _dataPointList = new RollingPointPairList(capacity); // Добавим кривую пока еще без каких-либо точек pane.AddCurve(name, _dataPointList, color, SymbolType.None); }
private void GraphInit(ZedGraphControl DoThi) { GraphPane myPane1 = DoThi.GraphPane; // Khai báo sửa dụng Graph loại GraphPane; myPane1.Title.Text = "Đồ thị dự đoán giá Close Mã GD: KCZ13"; myPane1.XAxis.Title.Text = "Ngày dự đoán"; myPane1.YAxis.Title.Text = "Giá trị dự đoán"; // Định nghĩa list để vẽ đồ thị. Để các bạn hiểu rõ cơ chế làm việc ở đây khai báo 2 list điểm <=> 2 đường đồ thị RollingPointPairList list6_1 = new RollingPointPairList(1000); RollingPointPairList list6_2 = new RollingPointPairList(1000); // dòng dưới là định nghĩa curve để vẽ. myPane1.AddCurve("Giá trị thực đo", list6_1, Color.Red, SymbolType.Diamond); myPane1.AddCurve("Giá trị tính toán bởi mạng", list6_2, Color.Blue, SymbolType.Star); // Định hiện thị cho trục thời gian (Trục X) //myPane1.XAxis.Scale.Min = 0; //myPane1.XAxis.Scale.Max = 10; //myPane1.XAxis.Scale.MinorStep = 1; //myPane1.XAxis.Scale.MajorStep = 1; myPane1.XAxis.Type = AxisType.Date; myPane1.XAxis.Scale.Min = new XDate(_predictFrom); // We want to use time from now myPane1.XAxis.Scale.Max = new XDate(_predictTo); // to 5 minutes per default myPane1.XAxis.Scale.MinorUnit = DateUnit.Day; // set the minimum x unit to time/seconds myPane1.XAxis.Scale.MajorUnit = DateUnit.Day; // set the maximum x unit to time/minutes myPane1.XAxis.Scale.Format = "MM/dd/yyyy"; // Gọi hàm xác định cỡ trục myPane1.AxisChange(); }
private void Form1_Load(object sender, EventArgs e) { _currentTime = new XDate(DateTime.Now); _timePart = 1 / 5000.0; _sinPart = 2 * Math.PI / 5000.0; _i = 0; zedGraphControl1.IsShowHScrollBar = true; zedGraphControl1.IsAutoScrollRange = true; _myPane = zedGraphControl1.GraphPane; _myPane.Title.Text = "Live Data"; _myPane.XAxis.Title.Text = "Time"; _myPane.YAxis.Title.Text = "Value"; _myPane.YAxis.Scale.Min = -1.2; _myPane.YAxis.Scale.Max = 1.2; _myPane.YAxis.Scale.MajorStep = 1; _myPane.YAxis.Scale.MinorStep = 1; _myPane.XAxis.Type = AxisType.Date; _myPane.XAxis.Scale.Format = "mm:ss:fff"; _myPane.XAxis.Scale.FontSpec.Angle = 60; _myPane.XAxis.Scale.FontSpec.Size = 12; _myPane.XAxis.Scale.MajorUnit = DateUnit.Millisecond; _myPane.XAxis.Scale.MajorStep = 500; _myPane.XAxis.Scale.MinorUnit = DateUnit.Millisecond; _myPane.XAxis.Scale.MinorStep = 250; _points = new RollingPointPairList(15000); _myPane.AddCurve("Sine Wave", _points, Color.Blue, SymbolType.None); }
public MainForm() { InitializeComponent(); progState = new ProgramState(); progState.CurrentPUnits = PressureUnits.KGS; progState.CurrentBarometricP = 1.05; progState.CurrentSetptPrecision = 0.02 / 100; progState.ReadPInterval = 1; progState.SetptDelay = 10; progState.TimeLength = 60; progState.PIsAbsolute = true; progState.RoundDefine(); FoundDPIs = false; CurrentP = 1.00; CurrentSetpt = 1.00; CurrentDPI = null; GraphPoints = new RollingPointPairList(progState.TimeLength / progState.ReadPInterval); var myPane = zgGraph.GraphPane; myPane.XAxis.Scale.MaxAuto = true; ticker.Interval = progState.ReadPInterval * 1000; }
public void Init() { // Clear ZedGraph zedGraphControl.GraphPane.CurveList.Clear(); zedGraphControl.GraphPane.GraphObjList.Clear();; zedGraphControl.Invalidate(); // Init ZedGraph GraphPane myPane = zedGraphControl.GraphPane; myPane.Title.Text = "Check 03 Voltage of System (Volt)"; myPane.XAxis.Title.Text = "Time (s)"; myPane.YAxis.Title.Text = "Voltage (Volt)"; RollingPointPairList list = new RollingPointPairList(60000); RollingPointPairList list1 = new RollingPointPairList(600000); RollingPointPairList list2 = new RollingPointPairList(600000); LineItem curve = myPane.AddCurve("Volt 1", list, Color.Red, SymbolType.None); LineItem curve1 = myPane.AddCurve("Volt 2", list1, Color.Blue, SymbolType.None); LineItem curve2 = myPane.AddCurve("Volt 3", list2, Color.Green, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; myPane.YAxis.Scale.Min = 0; myPane.YAxis.Scale.Max = 15; myPane.AxisChange(); // Save the beginning time for reference TickStart = Environment.TickCount; }
// some default settings are loaded private void FormMain_Load(object sender, EventArgs e) { #region Graph Settings GraphPane myPane = zg1.GraphPane; myPane.Title.Text = "Test of Dynamic Data Update with ZedGraph\n" + "(After 25 seconds the graph scrolls)"; myPane.XAxis.Title.Text = "Time, Seconds"; myPane.YAxis.Title.Text = "Pressure, kPa"; ///allows the zedgraph function RollingPointPairList to know how many data points ///we are interested in having ///GrphDataPts allows the user to choose how many points to graph based on ///sample rate and data buffer RollingPointPairList list = new RollingPointPairList(Convert.ToInt16(GrphDataPts())); // Initially, a curve is added with no data points (list is empty) // Color is blue, and there will be no symbols LineItem curve = myPane.AddCurve("Pressure", list, Color.Blue, SymbolType.None); // Just manually control the X axis range so it scrolls continuously // instead of discrete step-sized jumps myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 30; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; // Scale the axes zg1.AxisChange(); #endregion }
private void Form2_Load(object sender, EventArgs e) { Control.CheckForIllegalCrossThreadCalls = false; _Khoitao(); this.UART.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.UART_DataReceived); //chart1.ChartAreas[0].AxisX.Minimum = 0; //chart1.ChartAreas[0].AxisX.Interval = 1; //chart1.ChartAreas[0].AxisX.Maximum = 10; //chart1.ChartAreas[0].AxisY.Maximum = 120; GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "ĐỒ THỊ KHOẢNG CÁCH SRF05"; myPane.XAxis.Title.Text = "Thời Gian"; myPane.YAxis.Title.Text = "Khoảng Cách"; RollingPointPairList list1 = new RollingPointPairList(2000); RollingPointPairList list2 = new RollingPointPairList(2000); LineItem curve1 = myPane.AddCurve("Khoảng Cách 1", list1, Color.Red, SymbolType.None); //LineItem curve2 = myPane.AddCurve("Current", list2, Color.Blue, SymbolType.None); myPane.XAxis.Scale.Min = 0; // Min = 0; myPane.XAxis.Scale.Max = 30; // Max = 30; myPane.XAxis.Scale.MinorStep = 1; // Đơn vị chia nhỏ nhất 1 myPane.XAxis.Scale.MajorStep = 5; // Đơn vị chia lớn 5 //scale the axes zedGraphControl1.AxisChange(); //save the beginning time for reference //tickStart = Environment.TickCount; }
private void MainForm_Load(object sender, EventArgs e) { InitSpectrometer(); DoubleBuffered = true; SetStyle(ControlStyles.OptimizedDoubleBuffer, true); GraphPane myPane = zed.GraphPane; myPane.Title.Text = "Test"; myPane.XAxis.Title.Text = "Time(sec)"; myPane.YAxis.Title.Text = "Intensity (max value)"; myPane.XAxis.Title.FontSpec.Size = 17; myPane.YAxis.Title.FontSpec.Size = 17; RollingPointPairList list = new RollingPointPairList(60000); RollingPointPairList list1 = new RollingPointPairList(60000); LineItem curve = myPane.AddCurve("Value1", list, Color.Red, SymbolType.None); LineItem curve2 = myPane.AddCurve("Value2", list1, Color.Blue, SymbolType.None); myPane.XAxis.Scale.Min = 0; myPane.XAxis.Scale.Max = 10; myPane.XAxis.Scale.MinorStep = 1; myPane.XAxis.Scale.MajorStep = 5; //myPane.YAxis.Scale.Min = (double)numericUpDown1.Value-15; //myPane.YAxis.Scale.Max = (double)numericUpDown4.Value +10; myPane.YAxis.Scale.Min = 840; myPane.YAxis.Scale.Max = 850; zed.AxisChange(); TickStart = Environment.TickCount; }
void listeyeEkle(RollingPointPairList rollingPoint, ZedGraphControl zedGraph, double x, double y) { //x1++; c++; rollingPoint.Add(x, y); zedGraph.AxisChange(); zedGraph.Invalidate(); }