protected override void PlotModel_MouseDown(object sender, OxyMouseDownEventArgs e) { base.PlotModel_MouseDown(sender, e); if (e.Handled) { return; } if (e.ClickCount == 1) { OxyPlot.Series.Series ser = PlotModel.GetSeriesFromPoint(e.Position, 20); SelectedSeries = ser; } Axis xAxis, yAxis; PlotModel.GetAxesFromPoint(e.Position, out xAxis, out yAxis); if (xAxis != null && yAxis != null) { SelectedSeries = null; } else if (xAxis == null && yAxis != null && e.ChangedButton == OxyMouseButton.Left && e.ClickCount > 1 && PlotModel.Series.Count > 0) { ShowRangeDialog(yAxis); } else if (xAxis != null && yAxis == null && e.ChangedButton == OxyMouseButton.Left && e.ClickCount > 1 && PlotModel.Series.Count > 0) { ShowRangeDialog(xAxis); } }
protected virtual void Execute_AddMarkerCommand() { var pos = PlotModel.GetSeriesFromPoint(this.SelectedPosition, 20); var point = pos.GetNearestPoint(this.SelectedPosition, false); var dp = (XYPlotPaneViewModel.DataPoint)point.Item; this.ProjectViewModel.AddMarkerCommand.Execute(dp.T); }
/// <summary> /// Gets the series that is nearest the specified point (in screen coordinates). /// </summary> /// <param name="pt">The point.</param> /// <param name="limit">The maximum distance, if this is exceeded the method will return null.</param> /// <returns>The closest DataSeries</returns> public OxyPlot.DataSeries GetSeriesFromPoint(ScreenPoint pt, double limit = 100) { return(internalModel.GetSeriesFromPoint(pt, limit)); }