Esempio n. 1
0
        private void MouseMove(object sender, PointerEventArgs e)
        {
            // determine point nearest the cursor
            (double mouseCoordX, double mouseCoordY) = avaPlot1.GetMouseCoordinates();
            double xyRatio = avaPlot1.Plot.XAxis.Dims.PxPerUnit / avaPlot1.Plot.YAxis.Dims.PxPerUnit;

            (double pointX, double pointY, int pointIndex) = MyScatterPlot.GetPointNearest(mouseCoordX, mouseCoordY, xyRatio);

            // place the highlight over the point of interest
            HighlightedPoint.Xs[0]     = pointX;
            HighlightedPoint.Ys[0]     = pointY;
            HighlightedPoint.IsVisible = true;

            // render if the highlighted point chnaged
            if (LastHighlightedIndex != pointIndex)
            {
                LastHighlightedIndex = pointIndex;
                avaPlot1.Render();
            }

            // update the GUI to describe the highlighted point
            (double mouseX, double mouseY)       = avaPlot1.GetMouseCoordinates();
            this.Find <TextBlock>("label1").Text = $"Closest point to ({mouseX:N0}, {mouseY:N0}) " +
                                                   $"is index {pointIndex} ({pointX:N2}, {pointY:N2})";
        }
Esempio n. 2
0
        private void MouseMove(object sender, PointerEventArgs e)
        {
            (double mouseX, double mouseY) = avaPlot1.GetMouseCoordinates();

            sph.HighlightClear();
            var(x, y, index) = sph.HighlightPointNearest(mouseX, mouseY);
            avaPlot1.Render();

            this.Find <TextBlock>("label1").Text = $"Closest point to ({mouseX:N2}, {mouseY:N2}) " +
                                                   $"is index {index} ({x:N2}, {y:N2})";
        }
Esempio n. 3
0
        private void OnMouseMove(object sender, PointerEventArgs e)
        {
            int pixelX = (int)e.GetPosition(avaPlot1).X;
            int pixelY = (int)e.GetPosition(avaPlot1).Y;

            (double coordinateX, double coordinateY) = avaPlot1.GetMouseCoordinates();

            this.Find <TextBlock>("XPixelLabel").Text = $"{pixelX:0.000}";
            this.Find <TextBlock>("YPixelLabel").Text = $"{pixelY:0.000}";

            this.Find <TextBlock>("XCoordinateLabel").Text = $"{avaPlot1.plt.GetCoordinateX(pixelX):0.00000000}";
            this.Find <TextBlock>("YCoordinateLabel").Text = $"{avaPlot1.plt.GetCoordinateY(pixelY):0.00000000}";

            vLine.position = coordinateX;
            hLine.position = coordinateY;

            avaPlot1.Render();
        }