Ejemplo n.º 1
0
        private void OnMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var    mousePos = e.MouseDevice.GetPosition(TimetableGraph);
            double mouseX   = TimetableGraph.plt.CoordinateFromPixelX(mousePos.X);
            double mouseY   = TimetableGraph.plt.CoordinateFromPixelY(mousePos.Y);

            scatterHighLight.HighlightClear();
            var(x, y, index) = scatterHighLight.HighlightPointNearest(mouseX, mouseY);
            TimeGraphUIModel graph = highlightedTimeGraphUiModels[index];

            if (graph != null)
            {
                double[] xs = { x };
                double[] ys = { y };
                if (marker != null)
                {
                    marker.markerShape = MarkerShape.none;
                }

                marker = TimetableGraph.plt.PlotScatter(xs, ys, Color.Red,
                                                        markerShape: MarkerShape.openCircle, markerSize: 15);
                if (GraphModel.SelectedTimeGraph != null && GraphModel.SelectedTimeGraph.Plot != null)
                {
                    GraphModel.SelectedTimeGraph.Plot.lineWidth = 1;
                }
                graph.Plot.lineWidth         = 3;
                GraphModel.SelectedTimeGraph = graph;
                TimetableGraph.Render();
            }
            TimetableGraph.Render();
        }
Ejemplo n.º 2
0
 private void formsPlot1_MouseMove(object sender, MouseEventArgs e)
 {
     (double x, double y) = formsPlot1.GetMouseCoordinates();
     vline.position       = x;
     hline.position       = y;
     sph.HighlightClear();
     sph.HighlightPointNearest(x, y);
     formsPlot1.Render();
 }
Ejemplo n.º 3
0
        private void plotMouseDoubleClick(object sender, MouseEventArgs e)
        {
            (double mouseX, double mouseY) = MainPlot.GetMouseCoordinates();
            sph.HighlightClear();
            var(trackerX, trackerY, index) = sph.HighlightPointNearest(mouseX, mouseY);

            for (int i = 0; i < dtb.Rows.Count; i++)
            {
                DataTable curTable = (DataTable)DGrid.DataContext;
                DataRow   curRow   = curTable.Rows[i];

                string cellContent = String.Join(", ", curRow.ItemArray);

                if (cellContent.Contains(trackerX.ToString()) && cellContent.Contains(trackerY.ToString()))
                {
                    DGrid.ScrollIntoView(DGrid.Items[i]);
                    DGrid.SelectedIndex = i;
                    DGrid.UpdateLayout();
                }
            }
            MainPlot.Render();
        }