Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TrackerManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public TrackerManipulator(IPlotView plotView)
     : base(plotView)
 {
     this.Snap = true;
     this.PointsOnly = false;
     this.LockToInitialSeries = true;
 }
Exemplo n.º 2
0
        private void HandleZoomByWheelAndCtrl(IPlotView view, OxyMouseWheelEventArgs args, double factor = 1)
        {
            var m = new CustomZoomStepManipulator(view, EAxisDescription.Y)
            {
                Step = args.Delta * 0.001 * factor
            };

            m.Started(args);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Zooms the view by the specified factor at the position specified in the <see cref="OxyMouseEventArgs" />.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
        /// <param name="delta">The zoom factor.</param>
        private static void HandleZoomAt(IPlotView view, OxyMouseEventArgs args, double delta)
        {
            var m = new ZoomStepManipulator(view)
            {
                Step = delta, FineControl = args.IsControlDown
            };

            m.Started(args);
        }
        /// <summary>
        /// Zooms the view by the mouse wheel delta in the specified <see cref="OxyKeyEventArgs" />.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
        /// <param name="factor">The zoom speed factor. Default value is 1.</param>
        private static void HandleZoomByWheel(IPlotView view, OxyMouseWheelEventArgs args, double factor = 1)
        {
            var m = new ZoomStepManipulator(view)
            {
                Step = args.Delta * 0.001 * factor, FineControl = args.IsControlDown
            };

            m.Started(args);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TouchTrackerManipulator" /> class.
        /// </summary>
        /// <param name="plotView">The plot view.</param>
        public TouchTrackerManipulator(IPlotView plotView)
            : base(plotView)
        {
            this.Snap                = true;
            this.PointsOnly          = false;
            this.LockToInitialSeries = true;

            // Note: the tracker manipulator should not handle pan or zoom
            this.SetHandledForPanOrZoom = false;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add chart plot view object.
        /// </summary>
        /// <param name="view">Chart plot view object.</param>
        protected virtual void AddPlotViewLayer(IPlotView view)
        {
            if (this.PlotViewContainer != null)
            {
                view.Bounds = this.PlotViewContainer.ClientBounds;
                this.PlotViewContainer.Children.Add(view);
            }

            this.Invalidate();
        }
        private void CopyChart_OnKeyDown(
            IPlotView view,
            IController controller,
            OxyKeyEventArgs args)
        {
            var chartCopy = new Bitmap(uiPlotView.Width, uiPlotView.Height);

            uiPlotView.DrawToBitmap(chartCopy,
                                    new Rectangle(0, 0, uiPlotView.Width, uiPlotView.Height));
            Clipboard.SetImage(chartCopy);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Performs the copy operation.
        /// </summary>
        private void DoCopy(IPlotView view, OxyInputEventArgs args)
        {
            var exporter = new PngExporter
            {
                Width  = this.ClientRectangle.Width,
                Height = this.ClientRectangle.Height,
            };

            var bitmap = exporter.ExportToBitmap(this.ActualModel);

            Clipboard.SetImage(bitmap);
        }
Exemplo n.º 9
0
            public StayOpenTrackerManipulator(IPlotView plot)
                : base(plot)
            {
                _plotModel = plot != null ? plot.ActualModel : null;
                if (_plotModel == null)
                {
                    throw new ArgumentException("Plot has no model", "plot");
                }

                Snap       = true;
                PointsOnly = false;
            }
Exemplo n.º 10
0
        /// <summary>
        /// Attaches this model to the specified plot view.
        /// </summary>
        /// <param name="plotView">The plot view.</param>
        /// <remarks>Only one plot view can be attached to the plot model.
        /// The plot model contains data (e.g. axis scaling) that is only relevant to the current plot view.</remarks>
        void IPlotModel.AttachPlotView(IPlotView plotView)
        {
            var currentPlotView = this.PlotView;

            if (!object.ReferenceEquals(currentPlotView, null) &&
                !object.ReferenceEquals(plotView, null) &&
                !object.ReferenceEquals(currentPlotView, plotView))
            {
                throw new InvalidOperationException(
                          "This PlotModel is already in use by some other PlotView control.");
            }

            this.plotViewReference = (plotView == null) ? null : new WeakReference(plotView);
        }
Exemplo n.º 11
0
 void IPlotModel.AttachPlotView(IPlotView plotView)
 {
     //because of issue https://github.com/oxyplot/oxyplot/issues/497
     //only one view can ever be attached to one plotmodel
     //we have to force detach previous view and then attach new one
     if (plotView != null && PlotView != null && !Equals(plotView, PlotView))
     {
         BaseAttachMethod.Invoke(this, new object[] { null });
         BaseAttachMethod.Invoke(this, new object[] { plotView });
     }
     else
     {
         BaseAttachMethod.Invoke(this, new object[] { plotView });
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Performs the copy operation.
        /// </summary>
        private void DoCopy(IPlotView view, OxyInputEventArgs args)
        {
            var background = this.ActualModel.Background.IsVisible() ? this.ActualModel.Background : this.ActualModel.Background;

            if (background.IsInvisible())
            {
                background = OxyColors.White;
            }

            var exporter = new PngExporter
            {
                Width      = this.ClientRectangle.Width,
                Height     = this.ClientRectangle.Height,
                Background = background
            };

            var bitmap = exporter.ExportToBitmap(this.ActualModel);

            Clipboard.SetImage(bitmap);
        }
Exemplo n.º 13
0
        public void Append(IPlotView plot, dynamic j)
        {
            if (j.Flag == 1)
            {
                System.Diagnostics.Debugger.Break();
            }
            // the first message (with data) sets the keys to plot
            if (Series.Count == 0)
            {
                List <string> keys = Util.GetMemberNames(j, true);
                keys.Remove("T");
                keys.Remove("Time");
                keys.Remove("Flag");
                foreach (string k in keys)
                {
                    Series.Add(new LineSeries {
                        Title = k
                    });
                }
            }

            foreach (LineSeries ls in Series)
            {
                while (ls.Points.Count > pointLimit)
                {
                    ls.Points.RemoveAt(0);
                }
                try
                {
                    ls.Points.Add(new DataPoint((double)j.Time, (double)j[ls.Title]));
                }
                catch (Exception)
                {
                    Series.Remove(ls);
                    break;
                }
            }
            plot.InvalidatePlot();
        }
Exemplo n.º 14
0
 /// <summary>
 /// Handles the reset event.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 private static void HandleReset(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoomStepManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public ZoomStepManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, double delta)
 {
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
Exemplo n.º 17
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, OxyInputEventArgs args, double delta)
 {
     args.Handled = true;
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Zooms the view by the specified factor at the position specified in the <see cref="OxyMouseEventArgs" />.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor.</param>
 private static void HandleZoomAt(IPlotView view, OxyMouseEventArgs args, double delta)
 {
     var m = new ZoomStepManipulator(view) { Step = delta, FineControl = args.IsControlDown };
     m.Started(args);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Pans the view by the key in the specified vector.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="dx">The horizontal delta (percentage of plot area width).</param>
 /// <param name="dy">The vertical delta (percentage of plot area height).</param>
 private static void HandlePan(IPlotView view, OxyInputEventArgs args, double dx, double dy)
 {
     args.Handled = true;
     dx *= view.ActualModel.PlotArea.Width;
     dy *= view.ActualModel.PlotArea.Height;
     view.ActualModel.PanAllAxes(dx, dy);
     view.InvalidatePlot(false);
 }
Exemplo n.º 20
0
 public void AttachPlotView(IPlotView plotView)
 {
 }
Exemplo n.º 21
0
 /// <summary>
 /// Pans the view by the key in the specified vector.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="dx">The horizontal delta (percentage of plot area width).</param>
 /// <param name="dy">The vertical delta (percentage of plot area height).</param>
 private static void HandlePan(IPlotView view, double dx, double dy)
 {
     dx *= view.ActualModel.PlotArea.Width;
     dy *= view.ActualModel.PlotArea.Height;
     view.ActualModel.PanAllAxes(dx, dy);
     view.InvalidatePlot(false);
 }
Exemplo n.º 22
0
 public virtual bool OnSignalDropped(IPlotView view, ScreenPoint point, ISignalViewModel signal)
 {
     return(true);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Attaches this model to the specified plot view.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 /// <remarks>Only one plot view can be attached to the plot model.
 /// The plot model contains data (e.g. axis scaling) that is only relevant to the current plot view.</remarks>
 void IPlotModel.AttachPlotView(IPlotView plotView)
 {
     this.plotViewReference = (plotView == null) ? null : new WeakReference(plotView);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PanManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public PanManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 25
0
 public TapTouchManipulator(IPlotView plotView, ICommand tapCommand) : base(plotView)
 {
     this.tapCommand = tapCommand;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Handles the copy code event.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
 private static void HandleCopyCode(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     var code = view.ActualModel.ToCode();
     view.SetClipboardText(code);
 }
Exemplo n.º 27
0
 /// <summary>
 /// Handles the copy text report event.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
 private static void HandleCopyTextReport(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     var text = view.ActualModel.CreateTextReport();
     view.SetClipboardText(text);
 }
Exemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlotManipulator{T}" /> class.
 /// </summary>
 /// <param name="view">The plot view.</param>
 protected PlotManipulator(IPlotView view)
     : base(view)
 {
     this.PlotView = view;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Handles the reset event.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 private static void HandleReset(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, double delta)
 {
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
Exemplo n.º 31
0
 /// <summary>
 /// Zooms the view by the mouse wheel delta in the specified <see cref="OxyKeyEventArgs" />.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyMouseWheelEventArgs" /> instance containing the event data.</param>
 /// <param name="factor">The zoom speed factor. Default value is 1.</param>
 private static void HandleZoomByWheel(IPlotView view, OxyMouseWheelEventArgs args, double factor = 1)
 {
     var m = new ZoomStepManipulator(view) { Step = args.Delta * 0.001 * factor, FineControl = args.IsControlDown };
     m.Started(args);
 }
Exemplo n.º 32
0
        /// <summary>
        /// Attaches this model to the specified plot view.
        /// </summary>
        /// <param name="plotView">The plot view.</param>
        /// <remarks>Only one plot view can be attached to the plot model.
        /// The plot model contains data (e.g. axis scaling) that is only relevant to the current plot view.</remarks>
        void IPlotModel.AttachPlotView(IPlotView plotView)
        {
            var currentPlotView = this.PlotView;
            if (!object.ReferenceEquals(currentPlotView, null) &&
                !object.ReferenceEquals(plotView, null) &&
                !object.ReferenceEquals(currentPlotView, plotView))
            {
                throw new InvalidOperationException(
                    "This PlotModel is already in use by some other PlotView control.");
            }

            this.plotViewReference = (plotView == null) ? null : new WeakReference(plotView);
        }
Exemplo n.º 33
0
 /// <summary>
 /// Handles the reset events.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 private static void HandleReset(IPlotView view)
 {
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
Exemplo n.º 34
0
 /// <summary>
 /// Handles the reset events.
 /// </summary>
 /// <param name="view">The view to reset.</param>
 private static void HandleReset(IPlotView view)
 {
     view.ActualModel.ResetAllAxes();
     view.InvalidatePlot(false);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PanManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public PanManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 36
0
 /// <summary>
 /// Handles the copy text report event.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs"/> instance containing the event data.</param>
 private static void HandleCopyTextReport(IPlotView view, OxyInputEventArgs args)
 {
     args.Handled = true;
     //    var text = view.ActualModel.CreateTextReport();
     //view.SetClipboardText(text);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TouchManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public TouchManipulator(IPlotView plotView)
     : base(plotView)
 {
     SetHandledForPanOrZoom = true;
 }
Exemplo n.º 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TouchManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public TouchManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 39
0
 /// <summary>
 /// Zooms the view by the key in the specified factor.
 /// </summary>
 /// <param name="view">The view.</param>
 /// <param name="args">The <see cref="OxyInputEventArgs" /> instance containing the event data.</param>
 /// <param name="delta">The zoom factor (positive zoom in, negative zoom out).</param>
 private static void HandleZoomCenter(IPlotView view, OxyInputEventArgs args, double delta)
 {
     args.Handled = true;
     view.ActualModel.ZoomAllAxes(1 + (delta * 0.12));
     view.InvalidatePlot(false);
 }
 public StaysOpenTrackerManipulator(IPlotView plotView) : base(plotView)
 {
     Snap       = true;
     PointsOnly = true;
 }
Exemplo n.º 41
0
 public CustomPanManipulator(IPlotView plotView, EAxisDescription axisDescription)
     : base(plotView)
 {
     AxisDescription = axisDescription;
 }
Exemplo n.º 42
0
 private static void AddStayOpenTrackerManipulator(IPlotView view, IController controller,
                                                   OxyMouseDownEventArgs e)
 {
     controller.AddMouseManipulator(view, new StayOpenTrackerManipulator(view), e);
 }
Exemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 protected MouseManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoomRectangleManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public ZoomRectangleManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoomRectangleManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public ZoomRectangleManipulator(IPlotView plotView)
     : base(plotView)
 {
 }
Exemplo n.º 46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZoomStepManipulator" /> class.
 /// </summary>
 /// <param name="plotView">The plot view.</param>
 public ZoomStepManipulator(IPlotView plotView)
     : base(plotView)
 {
 }