예제 #1
0
        private void DoZoom(double factor)
        {
            if (masterPlot != null)
            {
                var rect = masterPlot.PlotRect;

                if (IsHorizontalNavigationEnabled)
                {
                    rect.X = rect.X.Zoom(factor);
                }
                if (IsVerticalNavigationEnabled)
                {
                    rect.Y = rect.Y.Zoom(factor);
                }

                if (IsZoomEnable(rect))
                {
                    masterPlot.SetPlotRect(rect);
                    masterPlot.IsAutoFitEnabled = false;
                }
            }
        }
예제 #2
0
        private void KeyboardNavigationKeyDown(object sender, KeyEventArgs e)
        {
            if (masterPlot != null)
            {
                if (e.Key == Key.Up && IsVerticalNavigationEnabled)
                {
                    var    rect = masterPlot.PlotRect;
                    double dy   = rect.Height / 200;

                    masterPlot.SetPlotRect(new DataRect(
                                               rect.XMin,
                                               rect.YMin - dy,
                                               rect.XMin + rect.Width,
                                               rect.YMin - dy + rect.Height));

                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Down && IsVerticalNavigationEnabled)
                {
                    var    rect = masterPlot.PlotRect;
                    double dy   = -rect.Height / 200;

                    masterPlot.SetPlotRect(new DataRect(
                                               rect.XMin,
                                               rect.YMin - dy,
                                               rect.XMin + rect.Width,
                                               rect.YMin - dy + rect.Height));

                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Right && IsHorizontalNavigationEnabled)
                {
                    var    rect = masterPlot.PlotRect;
                    double dx   = -rect.Width / 200;

                    masterPlot.SetPlotRect(new DataRect(
                                               rect.XMin + dx,
                                               rect.YMin,
                                               rect.XMin + dx + rect.Width,
                                               rect.YMin + rect.Height));

                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Left && IsHorizontalNavigationEnabled)
                {
                    var    rect = masterPlot.PlotRect;
                    double dx   = rect.Width / 200;

                    masterPlot.SetPlotRect(new DataRect(
                                               rect.XMin + dx,
                                               rect.YMin,
                                               rect.XMin + dx + rect.Width,
                                               rect.YMin + rect.Height));

                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Subtract)
                {
                    DoZoom(1.2);
                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Add)
                {
                    DoZoom(1 / 1.2);
                    masterPlot.IsAutoFitEnabled = false;
                    e.Handled = true;
                }
                if (e.Key == Key.Home)
                {
                    masterPlot.IsAutoFitEnabled = true;
                    e.Handled = true;
                }
            }
        }