private void Plot_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Left) { MouseMoveState = MoveState.None; } if (!CanCreateRanges || e.ChangedButton != OxyMouseButton.Left || SetRanges.Count == RangeLimit) { return; } _clickStartX = PlotSeries.InverseTransform(e.Position).X; if (Ranges.Count <= SetRanges.Count) { _activeRange = CreateRange(); } else { _activeRange = Ranges[SetRanges.Count]; } SetRanges.Add(_activeRange); _activeRange.MinimumX = _clickStartX; _activeRange.MaximumX = _clickStartX; Model.InvalidatePlot(false); e.Handled = true; MouseMoveState = MoveState.CreatingRange; }
private void AnnotationOnMouseDown(int chartIndex, object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton != OxyMouseButton.Left) { return; } Mouse.OverrideCursor = Cursors.Hand; SetLineAndPointAnnotation(sender, chartIndex, out var lineAnnotation, out var pointAnnotation); pointAnnotation.Fill = OxyColor.FromRgb(97, 149, 250); if (sender is LineAnnotation) { var cursorCoords = lineAnnotation.InverseTransform(e.Position); if (cursorCoords.Y >= lineAnnotation.MinimumY && cursorCoords.Y <= lineAnnotation.MaximumY) { pointAnnotation.Y = cursorCoords.Y; } else if (cursorCoords.Y > lineAnnotation.MaximumY) { pointAnnotation.Y = lineAnnotation.MaximumY; } else { pointAnnotation.Y = lineAnnotation.MinimumY; } // initializing new datapoint, because it doesn't have a setter var linePoints = GetPlotLinePoints(PlotModels[chartIndex]); linePoints[linePoints.FindIndex(point => point.X == pointAnnotation.X)] = new DataPoint(pointAnnotation.X, pointAnnotation.Y); } GenerateDraggablePointTooltip(chartIndex, pointAnnotation); PlotEventHandler(chartIndex, e); }
private void Range_MouseDown(object sender, OxyMouseDownEventArgs e) { _clickedRange = (RectangleAnnotation)sender; if (e.ChangedButton == OxyMouseButton.Left && e.IsControlDown) { RemoveRange(_clickedRange); MouseMoveState = MoveState.None; e.Handled = true; return; } if (!CanChangeRanges || e.ChangedButton != OxyMouseButton.Left) { return; } var x = PlotSeries.InverseTransform(e.Position).X; _moveStartX = _clickedRange.MinimumX; _clickStartXOffset = -(x - _clickedRange.MinimumX); e.Handled = true; MouseMoveState = MoveState.MovingRange; }
private void OnPlotEdit(IView view, IController controller, OxyMouseDownEventArgs mouseDownArgs) { var result = series.GetNearestPoint(mouseDownArgs.Position, false); if (result == null || result.Position.DistanceTo(mouseDownArgs.Position) > 20) { return; } var evt = ((EventBasedIntervalBarItem)result.Item).Event; EditEventRequest.Raise(new Confirmation { Title = "Edit Event", Content = evt }, confirmation => { if (confirmation.Confirmed) { Events.Remove(evt); if (confirmation.Content is Event updatedEvent) { Events.Add(updatedEvent); RebuildPlotData(); } } }); }
private void plotView_MouseDown(object sender, OxyMouseDownEventArgs e) { ElementCollection <Axis> axisList = plotView.Model.Axes; Axis X_Axis = null; Axis Y_Axis = null; foreach (Axis axis in axisList) { if (axis.Position == AxisPosition.Bottom) { X_Axis = axis; } else if (axis.Position == AxisPosition.Left) { Y_Axis = axis; } } DataPoint datapoint = Axis.InverseTransform(e.Position, X_Axis, Y_Axis); matrix.AddPoint(datapoint); LineSeries lineSeries = new LineSeries(); lineSeries.Color = OxyColors.LightBlue; lineSeries.MarkerFill = OxyColors.Blue; lineSeries.MarkerType = MarkerType.Circle; lineSeries.LineStyle = LineStyle.None; lineSeries.Points.Add(datapoint); lineSeries.Points.Add(new DataPoint()); PlotGraph(lineSeries); }
private void Stage_MouseDown(object sender, OxyMouseDownEventArgs e) { if (DelingStage) { if (e.ChangedButton == OxyMouseButton.Left) { if (MessageBox.Show("Вы точно хотите удалить этап?", "Внимание", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Annotation an = sender as Annotation; for (int i = 0; i < stages.Count;) { if (stages[i].ID == Convert.ToInt32(an.Tag)) { stages.Remove(stages[i]); } else { i++; } } model.Annotations.Remove(an); //plotter.InvalidatePlot(false); DelingStage = false; RenderAnno(); } } } }
private void Model_MouseDown(object sender, OxyMouseDownEventArgs e) { if (IsLeftMousePressed()) { X = (int)(OxyPlot.Axes.Axis.InverseTransform(e.Position, Model.Axes[0], Model.Axes[1]).X); if (RectangleUI != null) { if (X > RectangleUI.X0 && X < RectangleUI.X1) { isPanBar = true; LastX = X; } } if (!isPanBar) { isSelected = true; SelectedData.Clear(); if (RectangleUI != null) { ClearBar(); } } } }
/// <summary> /// 定义鼠标点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SelectableLineSeries_MouseDown(object sender, OxyMouseDownEventArgs e) { if (IsDataPointSelectable) { var activeSeries = (sender as OxyPlot.Series.Series); var currentPlotModel = activeSeries.PlotModel; var nearestPoint = activeSeries.GetNearestPoint(e.Position, false); point = (StressLogPoint)nearestPoint.Item; CurrentSelection = point; currentPlotModel = ClearCurrentSelection(currentPlotModel); List <StressLogPoint> items = new List <StressLogPoint>(); items.Add(point); var selectedSeries = new SelectedScatterSeries { MarkerSize = MarkerSize + 2, MarkerFill = SelectedDataPointColor, MarkerType = MarkerType, ItemsSource = items, TrackerFormatString = "序号: {X}\n测量时间: {TestTime}\n轴力: {Y} MPa\n时延: {timeDelay} ns\n相似度: {MaxXcorr}" }; currentPlotModel.Series.Add(selectedSeries); currentPlotModel.InvalidatePlot(true); } }
private void DrawRectangle_OnMouseDown(object sender, OxyMouseDownEventArgs args) { if (args.ChangedButton != OxyMouseButton.Left) return; _tempAnnot = new RectangleAnnotation { Fill = HoverColor, Layer = AnnotationLayer.AboveSeries }; Axis xAxis = ChartModel.Axes.First(a => a.IsHorizontal()); Axis yAxis = ChartModel.Axes.First(a => a.IsVertical()); var type = (LimitType) uiSetTypeComboBox.SelectedItem; var annot = _tempAnnot as RectangleAnnotation; if (type == LimitType.None || type == LimitType.Vertical) { annot.MinimumX = xAxis.InverseTransform(args.Position.X); annot.MaximumX = xAxis.InverseTransform(args.Position.X); } if (type == LimitType.None || type == LimitType.Horizontal) { annot.MinimumY = yAxis.InverseTransform(args.Position.Y); annot.MaximumY = yAxis.InverseTransform(args.Position.Y); } ChartModel.Annotations.Add(_tempAnnot); ChartModel.InvalidatePlot(false); args.Handled = true; }
private void Plot_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Left && AddingDotsMode.IsChecked == true) { var plot = model as PlotModel; var axisList = plot.Axes.ToList(); OxyPlot.Axes.Axis x = null, y = null; foreach (var ax in axisList) { if (ax.Position == AxisPosition.Bottom) { x = ax; } else if (ax.Position == AxisPosition.Left) { y = ax; } } var point = OxyPlot.Axes.Axis.InverseTransform(e.Position, x, y); this.operatingDataSet.Add(new Point(point.X, point.Y)); this.DrawFunctions(); } if (e.ChangedButton == OxyMouseButton.Right) { isMouseRightButtonDown = true; } }
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); } }
private void CommutatorEnergyScalePlot_MouseDown(object sender, OxyMouseDownEventArgs e) { int scale_index = EnergyScalePlot_MouseDown_Base(EnergyScale_Commutator_Plot, e); // Eigen Vectors PointsPlot_Wiring.PointsPlot_Vectorizing(output_Variables.Commutator_Orthonormal_Transformation_Real, output_Variables.Commutator_Orthonormal_Transformation_Imag, scale_index, Selected_Index); }
private void EnergyScalePlot_MouseDown(object sender, OxyMouseDownEventArgs e) { int scale_index = EnergyScalePlot_MouseDown_Base(EnergyScale_Plot, e); // Eigen Vectors PointsPlot_Wiring.PointsPlot_Coloring(output_Variables.Energy_Orthonormal_Transformation, scale_index, Selected_Index); }
private void Plot_model_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Right) { mouse_point = new DataPoint(e.Position.X, e.Position.Y); } }
private void plot_MouseDown(object sender, OxyMouseDownEventArgs e) { OxyPlot.ElementCollection <OxyPlot.Axes.Axis> axisList = myModel.Axes; OxyPlot.Axes.Axis X_Axis = null, Y_Axis = null; foreach (OxyPlot.Axes.Axis ax in axisList) { if (ax.Position == OxyPlot.Axes.AxisPosition.Bottom) { X_Axis = ax; } else if (ax.Position == OxyPlot.Axes.AxisPosition.Left) { Y_Axis = ax; } } DataPoint p = OxyPlot.Axes.Axis.InverseTransform(e.Position, X_Axis, Y_Axis); polynomialPoints?.Add(p); string toAddToListView = string.Empty; toAddToListView += "X: " + (int)p.X + " ; Y: " + (int)p.Y; toAddToListView += Environment.NewLine; polynomialPointsListView.Items.Add(toAddToListView); }
private void HandleMouseDown(object sender, OxyMouseDownEventArgs e) { CallCompletedAndUnhookEvents(); // Since we're not setting e.Handled to true here, this click will have its regular effect in // addition to closing the tracker; e.g. it could open the tracker again at the new position. // Modify this code if that's not what you want. }
private void PlotModel_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton.ToString() == "Left") { viewModel.RedrawArrow(CursorPosition, CursorPosition + 2 * V / V.Abs, V, CanonicalDomain.Zone); PlotRefresh(); } }
public void pm_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Left && this.coupling_isEnabled) { this.coupling_start = new DataPoint(this.getActivePlotView().Model.Axes[0].InverseTransform(e.Position.X), this.getActivePlotView().Model.Axes[1].InverseTransform(e.Position.Y)); this.coupling_isMeasure = true; } }
private void OnSeriesClicked(object s, OxyMouseDownEventArgs e) { var series = s as LineSeries; var x = series.InverseTransform(e.Position).X; var y = series.InverseTransform(e.Position).Y; Plotter.MarkPeak(x, y, "Peaks"); }
public void PlotMouseDown(LineSeries lb, MapStatistics ms, OxyMouseDownEventArgs e) { if (lb.Points.Count != 0) { //DataPoint dd = new DataPoint(lb.InverseTransform(e.Position).X, lb.InverseTransform(e.Position).Y); ms._startPoint1 = lb.InverseTransform(e.Position); } }
private void PlotMouseDown(object sender, OxyMouseDownEventArgs e) { if (_cs.Items.Count != 0) { DataPoint dd = new DataPoint(_cs.InverseTransform(e.Position).X, _cs.InverseTransform(e.Position).Y); _startPoint1 = dd; } }
private void Ps_MouseDown(object sender, OxyMouseDownEventArgs e) { min = 0; max = 0; level = 0; e.Handled = true; //Debug.WriteLine("calibration mousedown event..."); }
private void DeleteAnnot_OnMouseDown(object sender, OxyMouseDownEventArgs args) { if (args.ChangedButton != OxyMouseButton.Left) return; ChartModel.Annotations.Remove((Annotation) sender); ChartModel.InvalidatePlot(false); args.Handled = true; }
private void SelectAnnot_OnMouseDown(object sender, OxyMouseDownEventArgs args) { if (((Annotation) sender).IsSelected()) ((Annotation) sender).Unselect(); else ((Annotation) sender).Select(); ChartModel.InvalidatePlot(false); args.Handled = true; }
private void Menu_button_MouseDown(object sender, OxyMouseDownEventArgs e) { if (sender != null) { menu_button.Background = OxyColor.Parse("#FF5500"); } owner.mediator.RedrawControlPanel(false); e.Handled = true; }
private void PlotModel_MouseDown(object sender, OxyMouseDownEventArgs e) { #if !HELP_FOR_GROUP_LEADER if (e.ChangedButton.ToString() == "Left" && w.f is Hydrodynamics_Sources.Conformal_Maps.IdentityTransform) { viewModel.RedrawArrow(CursorPosition, CursorPosition + 2 * V / V.Abs, V, CanonicalDomain.Circular, w); PlotRefresh(); } #endif }
private void Model_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.IsControlDown || drawingline) { var startpos = e.Position; drawingline = true; var datapoint = Axis.InverseTransform(startpos, XAxis, YAxis); StartPoint = datapoint; } }
private void PlotMouseDown(object sender, OxyMouseDownEventArgs e) { //if (_lb.Points.Count != 0) //{ // DataPoint dd = new DataPoint(_lb.InverseTransform(e.Position).X, _lb.InverseTransform(e.Position).Y); // _ms._startPoint1 = dd; //} _ms.PlotMouseDown(_lb, _ms, e); }
private void myModel_MouseDown(object sender, OxyMouseDownEventArgs ex) { if (StartROISet && ex.ChangedButton == OxyMouseButton.Left) { PlotMouseDown = true; double dataTmp = xValueAxis.InverseTransform(ex.Position.X); if (ROIState == 0) { ROI1.Points.Add(new DataPoint(dataTmp, -100000)); ROI1.Points.Add(new DataPoint(dataTmp, 100000)); ROIX[0] = dataTmp; ROI1.Color = OxyColors.Gray; ROI1.StrokeThickness = 0.5; myModel.InvalidatePlot(true); } else if (ROIState == 1) { ROIX[1] = dataTmp; ROI2.Points.Add(new DataPoint(ROIX[1], -100000)); ROI2.Points.Add(new DataPoint(ROIX[1], 100000)); ROI2.Color = OxyColors.Gray; ROI2.StrokeThickness = 0.5; myModel.InvalidatePlot(true); } else { if (System.Math.Abs(dataTmp - ROIX[0]) < 2) { ROI1.Points.Clear(); ROIX[0] = dataTmp; ROI1.Points.Add(new DataPoint(ROIX[0], -100000)); ROI1.Points.Add(new DataPoint(ROIX[0], 100000)); ROI1.Color = OxyColors.Gray; ROI1.StrokeThickness = 0.5; myModel.InvalidatePlot(true); ROIState = 2; } else if (System.Math.Abs(dataTmp - ROIX[1]) < 2) { ROI2.Points.Clear(); ROIX[1] = dataTmp; ROI2.Points.Add(new DataPoint(ROIX[1], -100000)); ROI2.Points.Add(new DataPoint(ROIX[1], 100000)); ROI2.Color = OxyColors.Gray; ROI2.StrokeThickness = 0.5; myModel.InvalidatePlot(true); ROIState = 3; } } } }
private void OnModelOnMouseDown(object s, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Left) { DisplaySelection(); _startx = _range.InverseTransform(e.Position).X; _range.MinimumX = _startx; _range.MaximumX = _startx; _model.InvalidatePlot(true); e.Handled = true; } }