private void resetZoom() { using (plot.SuspendEvents()) { plot.XAxis.ZoomedMinimum = null; plot.XAxis.ZoomedMaximum = null; foreach (KeyValuePair <string, NumericYAxis> kv in plot.YAxes) { NumericYAxis y = kv.Value; y.ZoomedMinimum = y.ZoomedMaximum = null; } } }
private void ResetPaintHandler(object sender, PaintEventArgs e) { ToolStripMenuItem zoomReset = sender as ToolStripMenuItem; bool enabled = false; if (plot != null) { enabled = enabled || plot.XAxis.ZoomedMinimum.HasValue || plot.XAxis.ZoomedMaximum.HasValue; foreach (KeyValuePair <string, NumericYAxis> kv in plot.YAxes) { NumericYAxis y = kv.Value; enabled = enabled || y.ZoomedMinimum.HasValue || y.ZoomedMaximum.HasValue; } } zoomReset.Enabled = enabled; }
private void finishMouseDragging() { if (!mouseDragging) { return; } using (plot.SuspendEvents()) { AdvancedRect dataArea = plot.DataArea; if (zoomingPlotArea || zoomingXAxis) { double newMin = plot.XAxis.CoordinateToData(selectionRect.TopLeft.X, dataArea); double newMax = plot.XAxis.CoordinateToData(selectionRect.BottomRight.X, dataArea); plot.XAxis.ZoomedMinimum = newMin; plot.XAxis.ZoomedMaximum = newMax; if (zoomingPlotArea) { foreach (KeyValuePair <string, NumericYAxis> kv in plot.YAxes) { NumericYAxis y = kv.Value; newMax = y.CoordinateToData(selectionRect.TopLeft.Y, dataArea); newMin = y.CoordinateToData(selectionRect.BottomRight.Y, dataArea); y.ZoomedMinimum = newMin; y.ZoomedMaximum = newMax; } } } else if (zoomingYAxis != null) { double newMax = zoomingYAxis.CoordinateToData(selectionRect.TopLeft.Y, dataArea); double newMin = zoomingYAxis.CoordinateToData(selectionRect.BottomRight.Y, dataArea); zoomingYAxis.ZoomedMinimum = newMin; zoomingYAxis.ZoomedMaximum = newMax; } selectionBr.Dispose(); selectionBr = null; mouseDragging = false; disableZoom(); } }