/// <summary> /// AutoPopulateSPL is used to add/update a graph for the SPL magnitude and phase curves of a driver. /// The system graph is updated as well. /// This one uses the text in the filename box to auto-populate the driver files on session file read. /// </summary> /// <param name="systemZGC"></param> /// <param name="filename"></param> /// <returns></returns> public static bool AutoPopulateSPL(ZedGraphControl systemZGC, string filename, double[] frequencies) { Zed zedObject = new Zed(); // Created only for access to the methods //ColorSymbolRotator splColor = new ColorSymbolRotator(); if (!File.Exists(filename)) { return(false); } zedObject.ImportSPLData(filename, frequencies); // Read the data, convert to double and interpolate zedObject.filename = filename; if (zedObject.splInterpolated == null) { MessageBox.Show("No valid data found, cannot continue.\nTry another file.", filename); return(false); // Can't go further, but don't need to stop. User can try another file. } systemZGC.ZoomOutAll(systemZGC.GraphPane); // Invoke the method to add the curves to the graph. Curves.AddComplexCurves(systemZGC, zedObject.splInterpolated, currentColor, filename, "Mag", "Phase", false); currentColor = splColor.NextColor; return(true); }
/// <summary> /// Сброс масштаба отображения графических данных. /// </summary> /// <param name="zc"></param> public static void ResetZoom(ZedGraphControl zc) { zc.ZoomOutAll(zc.GraphPane); var ys = zc.GraphPane.YAxis.Scale; var xs = zc.GraphPane.XAxis.Scale; if (AutoScale) { xs.MinAuto = xs.MaxAuto = true; zc.IsEnableVPan = zc.IsEnableVZoom = false; } else { zc.GraphPane.ZoomStack.Clear(); xs.Min = Trend.X0; xs.MaxAuto = true; //xs.Max = Trend.X1; if (Y1 - Y0 > 0) { ys.Min = Trend.Y0; ys.Max = Trend.Y1; } else { ys.MinAuto = ys.MaxAuto = true; } } zc.AxisChange(); //zc.Invalidate(); OnScaleReset(); }
internal void Clear(bool undoZoom) { if (undoZoom) { chart1.ZoomOutAll(pane); } SetPaneVisible(false); pane.CurveList.Clear(); RefreshChart(chart1); }
public void Draw(RatingTable input) { ChartProcessor cpu = new ChartProcessor(input, chart1); cpu.AddPoints(); cpu.SetupAxis(); cpu.AddLogRegressionLine(); zedGraphControl1.ZoomOutAll(zedGraphControl1.GraphPane); RefreshGraph(); }
private void chart1_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) { if (mouseDownLoc.IsEmpty || mouseUpLoc.IsEmpty) { return; } // if zoom rectangle is drawn from right to left, clear all zooming if (mouseDownLoc.X > mouseUpLoc.X && mouseDownLoc.Y > mouseUpLoc.Y) { sender.ZoomOutAll(sender.GraphPane); RefreshChart(sender); } }
private void CreateGraph(ZedGraphControl zgc) { GraphPane myPane = zgc.GraphPane; myPane.CurveList.Clear(); zgc.ZoomOutAll(myPane); LineItem myCurve = myPane.AddCurve(Use[17], list1, color, SymbolType.None); // отрисовываем график LineItem myCurve2 = myPane.AddCurve(Use[34], list2, Color.Red, SymbolType.Star); // отрисовываем точку myPane.XAxis.MajorGrid.IsVisible = true; // Пунктирные линии Y myPane.XAxis.MajorGrid.DashOn = 15; // Длина штрихов равна 10 пикселям myPane.XAxis.MajorGrid.DashOff = 10; // затем 5 пикселей - пропуск zgc.AxisChange(); zgc.Refresh(); }