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);
            }
        }
        public override bool OnSignalDropped(IPlotView view, ScreenPoint point, ISignalViewModel signal)
        {
            base.OnSignalDropped(view, point, signal);

            Axis xAxis, yAxis;

            PlotModel.GetAxesFromPoint(point, out xAxis, out yAxis);

            if (xAxis != null && yAxis != null)
            {
                // Do nothing
            }
            else if (xAxis == null && yAxis != null)
            {
                // Dropped on y axis
                internalAddSignal(signal, yAxis);
            }
            else if (xAxis != null && yAxis == null)
            {
                // Dropped on x axis
                internalAddSignal(signal, xAxis);
            }

            return(true);
        }
示例#3
0
        public static DataPoint InverseTransform(this PlotModel plotModel, ScreenPoint screenPoint)
        {
            Axis axisX;
            Axis axisY;

            plotModel.GetAxesFromPoint(screenPoint, out axisX, out axisY);

            if (axisX == null || axisY == null)
            {
                return(DataPoint.Undefined);
            }
            var x = axisX.InverseTransform(screenPoint.X);
            var y = axisY.InverseTransform(screenPoint.Y);

            return(new DataPoint(x, y));
        }
        protected override void PlotModel_MouseDown(object sender, OxyMouseDownEventArgs e)
        {
            base.PlotModel_MouseDown(sender, e);

            Axis xAxis, yAxis;

            PlotModel.GetAxesFromPoint(e.Position, out xAxis, out yAxis);

            if (xAxis != null && yAxis != null)
            {
                SelectedSeries = null;
            }
            else if (xAxis == null && yAxis != null)
            {
                // A vertical axis was clicked
                if (e.ClickCount == 1)
                {
                    // Set selected series here!
                    foreach (OxyPlot.Series.LineSeries series in plotModel.Series)
                    {
                        if (series.YAxis.Key == yAxis.Key)
                        {
                            SelectedSeries = series;
                            return;
                        }
                    }
                }
                else if (e.ChangedButton == OxyMouseButton.Left && e.ClickCount > 1)
                {
                    ShowRangeDialog(yAxis);
                }
            }
            else if (xAxis != null && yAxis == null && e.ChangedButton == OxyMouseButton.Left && e.ClickCount > 1 && PlotModel.Series.Count > 0)
            {
                ShowRangeDialog(xAxis);
            }
        }
示例#5
0
 public void GetAxesFromPoint(ScreenPoint pt, out AxisBase xaxis, out AxisBase yaxis)
 {
     internalModel.GetAxesFromPoint(pt, out xaxis, out yaxis);
 }