private void ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) { if (sender == zedGraphControl1) { newState.ApplyState(zedGraphControl2.GraphPane); zedGraphControl2.Invalidate(); zedGraphControl2.AxisChange(); } else { newState.ApplyState(zedGraphControl1.GraphPane); zedGraphControl1.Invalidate(); zedGraphControl1.AxisChange(); } }
protected void ZedGraphControlPrime_ZoomScaler(ZedGraphControl sender, ZoomState z1, ZoomState z2) { z2.ApplyState(this.GraphPane); double d = this.GraphPane.XAxis.Scale.Max - this.GraphPane.XAxis.Scale.Min; this.GraphPane.XAxis.Scale.Format = "yyyy"; if (d < 1000) { this.GraphPane.XAxis.Title.Text = "Year"; this.GraphPane.XAxis.Scale.Format = "yyyy-MM"; } if (d < 150) { this.GraphPane.XAxis.Title.Text = "Year"; this.GraphPane.XAxis.Scale.Format = "yyyy-MM-dd"; } if (d < 3) { this.GraphPane.XAxis.Title.Text = ((XDate)this.GraphPane.XAxis.Scale.Min).DateTime.Date.ToString("yyyy-MM-dd"); this.GraphPane.XAxis.Scale.Format = "HH"; } if (d < .3) { this.GraphPane.XAxis.Title.Text = ((XDate)this.GraphPane.XAxis.Scale.Min).DateTime.Date.ToString("yyyy-MM-dd"); this.GraphPane.XAxis.Scale.Format = "HH:mm"; } }
private void zgcScan_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState) { if (changing) { return; } changing = true; try { if (tvMRM.SelectedNode.Level == 1) { return; } foreach (GraphPane pane in zgcPeptide.MasterPane.PaneList) { newState.ApplyState(pane); } } finally { changing = false; } }
/// <summary> /// Restore the states of the GraphPanes to a previously saved condition (via /// <see cref="ZoomStateSave" />. This is essentially an "undo" for live /// pan and scroll actions. Restores a single /// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized /// (see <see cref="IsSynchronizeXAxes" /> and <see cref="IsSynchronizeYAxes" />), /// or save a list of states for all GraphPanes if the panes are synchronized. /// </summary> /// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations /// are taking place</param> private void ZoomStateRestore(GraphPane primaryPane) { if (_isSynchronizeXAxes || _isSynchronizeYAxes) { for (int i = 0; i < _masterPane._paneList.Count; i++) { if (i < _zoomStateStack.Count) { _zoomStateStack[i].ApplyState(_masterPane._paneList[i]); } } } else if (_zoomState != null) { _zoomState.ApplyState(primaryPane); } ZoomStateClear(); }
private MSGraphPane InsertMsGraphPane(MSGraphControl graphControl, int iInsert) { var pane = new MSGraphPane { Border = { IsVisible = false }, AllowCurveOverlap = true, }; ApplySettingsToGraphPane(pane); var primaryPane = graphControl.GraphPane; pane.CurrentItemType = primaryPane.CurrentItemType; pane.ZoomStack.AddRange(primaryPane.ZoomStack); var zoomState = new ZoomState(primaryPane, ZoomState.StateType.Zoom); zoomState.ApplyState(pane); pane.YAxis.Title.Text = primaryPane.YAxis.Title.Text; pane.XAxis.Title.Text = primaryPane.XAxis.Title.Text; graphControl.MasterPane.PaneList.Insert(iInsert, pane); return(pane); }
protected override void DoTest() { // IsPauseForScreenShots = true; RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("SplitGraphUnitTest.sky"))); CollectionAssert.AreEqual(new[] { "SplitGraph_rev1.clib" }, SkylineWindow.Document.Settings.PeptideSettings.Libraries.LibrarySpecs .Select(spec => Path.GetFileName(spec.FilePath)).ToArray()); WaitForDocumentLoaded(); // Test that AutoZoomNone and AutoZoomBestPeak work var graphChromatogram = Application.OpenForms.OfType <GraphChromatogram>().First(); var graphChromatogramGraphControl = AllControls(graphChromatogram).OfType <ZedGraphControl>().First(); RunUI(() => { // Select the first transition group SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 0); SkylineWindow.AutoZoomBestPeak(); // Make sure that we are zoomed in to approximately the best peak Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0); Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 14.0, 1.0); // Remember the zoom state so that we can pretend to manually zoom later var zoomStateAuto = new ZoomState(graphChromatogramGraphControl.GraphPane, ZoomState.StateType.Zoom); SkylineWindow.AutoZoomNone(); Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0); Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 35.0, 1.0); // Pretend to manually zoom zoomStateAuto.ApplyState(graphChromatogramGraphControl.GraphPane); Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0); // Select some other transition group: SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 1); SkylineWindow.ShowPeakAreaReplicateComparison(); }); WaitForGraphs(); // Ensure that we zoomed out when the selected transition group changed Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0); var peakAreaSummary = Application.OpenForms.OfType <GraphSummary>().First(); var graphLibraryMatch = Application.OpenForms.OfType <GraphSpectrum>().First(); var libraryMatchGraphControl = AllControls(graphLibraryMatch).OfType <ZedGraphControl>().First(); RunUI(() => { Assert.IsTrue(Settings.Default.ShowLibraryChromatograms); AssertCurveListsSame(graphChromatogram.CurveList, libraryMatchGraphControl.GraphPane.CurveList); AssertCurveListsSame(graphChromatogram.CurveList, peakAreaSummary.GraphControl.GraphPane.CurveList); Assert.AreEqual(9, graphChromatogram.CurveList.Count); Assert.AreEqual(1, graphChromatogramGraphControl.MasterPane.PaneList.Count); Assert.AreEqual(1, peakAreaSummary.GraphControl.MasterPane.PaneList.Count); SkylineWindow.ShowPrecursorTransitions(); Assert.AreEqual(3, graphChromatogram.CurveList.Count); // TODO(nicksh): Enable this when libraries filter based on precursor/product //AssertCurveListsSame(graphChromatogram.CurveList, libraryMatchGraphControl.GraphPane.CurveList); AssertCurveListsSame(graphChromatogram.CurveList, peakAreaSummary.GraphControl.GraphPane.CurveList); SkylineWindow.ShowProductTransitions(); Assert.AreEqual(6, graphChromatogram.CurveList.Count); // TODO(nicksh): Enable this when libraries filter based on precursor/product AssertCurveListsSame(graphChromatogram.CurveList, libraryMatchGraphControl.GraphPane.CurveList); AssertCurveListsSame(graphChromatogram.CurveList, peakAreaSummary.GraphControl.GraphPane.CurveList); SkylineWindow.ShowAllTransitions(); SkylineWindow.ShowSplitChromatogramGraph(true); }); WaitForGraphs(); Assert.AreEqual(2, graphChromatogramGraphControl.MasterPane.PaneList.Count); Assert.AreEqual(2, peakAreaSummary.GraphControl.MasterPane.PaneList.Count); AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[0]), peakAreaSummary.GraphControl.MasterPane.PaneList[0].CurveList); AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[1]), peakAreaSummary.GraphControl.MasterPane.PaneList[1].CurveList); }