private void InitGraph() { // Set horizontal and vertical clip factor to different values. ViewportRestrictionCallback enlargeCallback = (proposedBound) => { if (proposedBound.IsEmpty) { return(proposedBound); } return(CoordinateUtilities.RectZoom(proposedBound, proposedBound.GetCenter(), 1, 1.05)); }; BpsChart.ViewportClipToBoundsEnlargeFactor = 1; PpsChart.ViewportClipToBoundsEnlargeFactor = 1; BpsChart.Viewport.FitToViewRestrictions .Add(new InjectionDelegateRestriction(BpsChart.Viewport, enlargeCallback)); PpsChart.Viewport.FitToViewRestrictions .Add(new InjectionDelegateRestriction(PpsChart.Viewport, enlargeCallback)); // Disable zoom and pan BpsChart.Children.Remove(BpsChart.MouseNavigation); BpsChart.Children.Remove(BpsChart.KeyboardNavigation); BpsChart.Children.Remove(BpsChart.HorizontalAxisNavigation); BpsChart.Children.Remove(BpsChart.VerticalAxisNavigation); BpsChart.DefaultContextMenu.RemoveFromPlotter(); PpsChart.Children.Remove(PpsChart.MouseNavigation); PpsChart.Children.Remove(PpsChart.KeyboardNavigation); PpsChart.Children.Remove(PpsChart.HorizontalAxisNavigation); PpsChart.Children.Remove(PpsChart.VerticalAxisNavigation); PpsChart.DefaultContextMenu.RemoveFromPlotter(); ResetLineChart(BpsChart); ResetLineChart(PpsChart); }
public InjectionDelegateRestriction(Viewport2D masterViewport, ViewportRestrictionCallback callback) { if (callback == null) throw new ArgumentNullException("callback"); if (masterViewport == null) throw new ArgumentNullException("masterViewport"); this.callback = callback; this.masterViewport = masterViewport; masterViewport.PropertyChanged += masterViewport_PropertyChanged; }
public InjectionDelegateRestriction(Viewport2D masterViewport, ViewportRestrictionCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); } if (masterViewport == null) { throw new ArgumentNullException("masterViewport"); } this.callback = callback; this.masterViewport = masterViewport; masterViewport.PropertyChanged += masterViewport_PropertyChanged; }