public ShellViewModel() { var model = new PlotModel { Title = "Example Tracker" }; var points = new List <CustomDataPoint> { new CustomDataPoint(0, 4, "point 1"), new CustomDataPoint(10, 13, "point 2"), new CustomDataPoint(20, 15, "point 3"), new CustomDataPoint(30, 16, "point 4"), new CustomDataPoint(40, 12, "point 5"), new CustomDataPoint(50, 12, "point 6") }; var seriesVisible = new OxyPlot.Series.LineSeries { Color = OxyColors.Blue, MarkerFill = OxyColors.Red, ItemsSource = points, TrackerFormatString = "X={2},\nY={4},\nAdditionalInfo={Description}", MarkerType = MarkerType.Circle, MarkerSize = 5 }; model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = Axes.AxisPosition.Bottom }); model.Axes.Add(new OxyPlot.Axes.LinearAxis { Position = Axes.AxisPosition.Left }); model.Series.Add(seriesVisible); MyModel = model; CustomPlotController = new PlotController(); CustomPlotController.UnbindAll(); CustomPlotController.BindTouchDown(PlotCommands.PointsOnlyTrackTouch); MyModel.InvalidatePlot(true); }
public static Example TrackerFiresDistance() { var model = new PlotModel { Title = "Specified distance of the tracker fires", Subtitle = "Press the left mouse button to test the tracker.", }; model.Series.Add(new FunctionSeries(Math.Sin, 0, 10, 100)); // create a new plot controller with default bindings var plotController = new PlotController(); // remove a tracker command to the mouse-left/touch down event by default plotController.Unbind(PlotCommands.SnapTrack); plotController.Unbind(PlotCommands.SnapTrackTouch); // add a tracker command to the mouse-left/touch down event with specified distance plotController.BindMouseDown( OxyMouseButton.Left, new DelegatePlotCommand <OxyMouseDownEventArgs>((view, controller, args) => controller.AddMouseManipulator( view, new TrackerManipulator(view) { Snap = true, PointsOnly = false }, args))); plotController.BindTouchDown( new DelegatePlotCommand <OxyTouchEventArgs>((view, controller, args) => controller.AddTouchManipulator( view, new TouchTrackerManipulator(view) { Snap = true, PointsOnly = false }, args))); return(new Example(model, plotController)); }