Example #1
0
        private static IEnumerable <Model> CreateModels()
        {
            for (var i = 0; i < 3; i++)
            {
                var pm = new PlotModel {
                    Title = string.Format("Plot {0}", i + 1)
                };

                var series = new LineSeries();
                for (var j = 0; j < 10; j++)
                {
                    series.Points.Add(new DataPoint(j, r.NextDouble()));
                }

                pm.Series.Add(series);

                var pc = new PlotController();
                pc.UnbindAll();
                pc.BindKeyDown(OxyKey.Left, PlotCommands.PanRight);
                pc.BindKeyDown(OxyKey.Right, PlotCommands.PanLeft);

                yield return(new Model {
                    PlotModel = pm, PlotController = pc
                });
            }
        }
Example #2
0
        public MainWindow() : base(Gtk.WindowType.Toplevel)
        {
            Build();

            DateStartEntry.Text   = Fetcher.StartAt.ToString(DateStringFormat);
            DateStartEntry.Xalign = 0.5F;
            DateEndEntry.Text     = Fetcher.EndAt.ToString(DateStringFormat);
            DateEndEntry.Xalign   = 0.5F;

            foreach (Currencies currency in Enum.GetValues(typeof(Currencies)))
            {
                CurrencyBaseSelection.AppendText(currency.ToString() + " - " + currency.GetStringValue());
            }
            CurrencyBaseSelection.Active = (int)Fetcher.Base;

            MainPlotController.UnbindKeyDown(OxyKey.A);
            MainPlotController.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            MainPlotController.BindMouseDown(OxyMouseButton.Right, PlotCommands.PointsOnlyTrack);
            MainPlotController.BindKeyDown(OxyKey.Add, PlotCommands.ZoomInFine);
            MainPlotController.BindKeyDown(OxyKey.Subtract, PlotCommands.ZoomOutFine);
            MainPlotController.BindKeyDown(OxyKey.Up, PlotCommands.PanDownFine);
            MainPlotController.BindKeyDown(OxyKey.W, PlotCommands.PanDown);
            MainPlotController.BindKeyDown(OxyKey.Down, PlotCommands.PanUpFine);
            MainPlotController.BindKeyDown(OxyKey.S, PlotCommands.PanUp);
            MainPlotController.BindKeyDown(OxyKey.Left, PlotCommands.PanRightFine);
            MainPlotController.BindKeyDown(OxyKey.A, PlotCommands.PanRight);
            MainPlotController.BindKeyDown(OxyKey.Right, PlotCommands.PanLeftFine);
            MainPlotController.BindKeyDown(OxyKey.D, PlotCommands.PanLeft);

            MainPlotModel = new PlotModel();
            MainPlotModel.Axes.Add(new DateTimeAxis
            {
                Position           = AxisPosition.Bottom,
                IntervalType       = DateTimeIntervalType.Days,
                StringFormat       = "dd-MM\nyyyy",
                MajorGridlineStyle = LineStyle.Solid,
                MinimumMajorStep   = 1
            });
            MainPlotModel.Axes.Add(new LinearAxis
            {
                Position           = AxisPosition.Left,
                MajorGridlineStyle = LineStyle.Solid,
                MinorGridlineStyle = LineStyle.Dot,
                TickStyle          = TickStyle.Outside
            });

            MainPlotView = new PlotView {
                Model = MainPlotModel, Controller = MainPlotController
            };
            MainPlotAlignment.Add(MainPlotView);
            MainPlotView.Show();

            ChangeStatus(ReadyStatusText);
        }
Example #3
0
        public MainWindow()
        {
            InitializeComponent();

            PointsTable.ItemsSource = operatingDataSet;

            model = Plot.ActualModel;

            Type[]        typelist          = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.Namespace == "EstimationsAndPlots").ToArray();
            List <string> functionNamesList = new List <string>();

            foreach (Type type in typelist)
            {
                if (type.BaseType == Type.GetType("EstimationsAndPlots.Function"))
                {
                    functionNamesList.Add(type.Name);
                }
            }
            FunctionChoice.ItemsSource = functionNamesList;

            var myController = new PlotController();

            Plot.Controller = myController;

            myController.BindKeyDown(OxyKey.Right, OxyPlot.PlotCommands.PanLeft);
            myController.BindKeyDown(OxyKey.Left, OxyPlot.PlotCommands.PanRight);
            myController.BindKeyDown(OxyKey.Up, OxyPlot.PlotCommands.PanDown);
            myController.BindKeyDown(OxyKey.Down, OxyPlot.PlotCommands.PanUp);

            myController.UnbindMouseWheel();

            parametersTextBoxes.Add(P1);
            parametersTextBoxes.Add(P2);
            parametersTextBoxes.Add(P3);
            parametersTextBoxes.Add(P4);
            parametersTextBoxes.Add(P5);
            parametersTextBoxes.Add(P6);

            parametersTextBlocks.Add(T1);
            parametersTextBlocks.Add(T2);
            parametersTextBlocks.Add(T3);
            parametersTextBlocks.Add(T4);
            parametersTextBlocks.Add(T5);
            parametersTextBlocks.Add(T6);

            Maxiter.Text = maxiter.ToString();
            Eps.Text     = eps.ToString();

            this.model.MouseDown += (s, e) => this.Plot_MouseDown(s, e);
        }
Example #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            spark = (SparkWindow)this.Owner;
            if (graphSetting == null)
            {
                graphSetting = spark.settingCommon.graphSetting;
            }
            DirectoryInfo folder = new DirectoryInfo(Core.Work.EnvPath);

            FileInfo[] files     = folder.GetFiles("*.sqlite");
            string[]   filesName = new string[files.Length];
            for (int i = 0; i < files.Length; i++)
            {
                filesName[i] = Path.GetFileNameWithoutExtension(files[i].FullName);
            }
            lbDataBases.ItemsSource = filesName;
            timerEmul.Elapsed      += TimerEmul_Elapsed;

            var controller = new PlotController();

            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.ZoomRectangle);
            controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Alt, PlotCommands.PointsOnlyTrack);
            controller.BindMouseWheel(PlotCommands.ZoomWheel);
            controller.BindKeyDown(OxyKey.R, PlotCommands.Reset);
            plotter.Controller = controller;
        }
Example #5
0
        private void InitGraph()
        {
            Model = new PlotModel();
            DateTimeAxis axisX = new DateTimeAxis()
            {
                Title        = "Время",
                Position     = AxisPosition.Bottom,
                StringFormat = "HH:mm:ss",
            };

            axisX.MajorGridlineStyle     = LineStyle.Solid;
            axisX.MajorGridlineThickness = 1;
            Model.Axes.Add(axisX);

            int pos = 0;

            foreach (DataParam param in DataParams)
            {
                LinearAxis axisY = new LinearAxis()
                {
                    Title        = param.Title + ", " + param.ParamUnit.Title,
                    Key          = param.Title,
                    Position     = AxisPosition.Left,
                    PositionTier = pos++
                };
                if (pos == 1)
                {
                    axisY.AxisChanged           += AxeY_AxisChanged;
                    axisY.MajorGridlineStyle     = LineStyle.Solid;
                    axisY.MajorGridlineThickness = 1;
                }
                Model.Axes.Add(axisY);
                LineSeries series = new LineSeries()
                {
                    Title    = param.Title,
                    YAxisKey = param.Title
                };
                Model.Series.Add(series);
            }

            var controller = new PlotController();

            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Left, PlotCommands.PanAt);
            controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Control, PlotCommands.ZoomRectangle);
            controller.BindMouseDown(OxyMouseButton.Left, OxyModifierKeys.Alt, PlotCommands.PointsOnlyTrack);
            controller.BindMouseWheel(PlotCommands.ZoomWheel);
            controller.BindKeyDown(OxyKey.R, PlotCommands.Reset);
            plotter.Controller = controller;

            plotter.Model = Model;
        }
Example #6
0
        public MainWindow()
        {
            InitializeComponent();

            PointsTable.ItemsSource     = operatingDataSet;
            ParametersTable.ItemsSource = operatingFunctionParameters;

            model = Plot.ActualModel;

            var typeNameList = dictionaryFunction.Keys;

            FunctionChoice.ItemsSource = typeNameList;

            typeNameList = dictionaryMetrics.Keys;
            MetricsChoice.ItemsSource = typeNameList;

            typeNameList = dictionaryMinimizer.Keys;
            MinimizerChoice.ItemsSource = typeNameList;

            var myController = new PlotController();

            Plot.Controller = myController;

            myController.BindKeyDown(OxyKey.Right, OxyPlot.PlotCommands.PanLeft);
            myController.BindKeyDown(OxyKey.Left, OxyPlot.PlotCommands.PanRight);
            myController.BindKeyDown(OxyKey.Up, OxyPlot.PlotCommands.PanDown);
            myController.BindKeyDown(OxyKey.Down, OxyPlot.PlotCommands.PanUp);

            myController.UnbindMouseWheel();

            MaxiterValue.Text = maxiter.ToString();
            EpsValue.Text     = eps.ToString();

            this.model.MouseDown += (s, e) => this.Plot_MouseDown(s, e);
            model.KeyDown        += (s, e) => Plot_KeyDown(s, e);
            model.MouseMove      += (s, e) => this.Plot_MouseMove(s, e);
            model.MouseUp        += (s, e) => this.Plot_MouseUp(s, e);
        }
Example #7
0
        private PlotController GetCustomController()
        {
            var myController = new PlotController();

            //  Customizing the bindings
            myController.UnbindMouseDown(OxyMouseButton.Right);
            //Mouse

            myController.BindMouseDown(OxyMouseButton.Left, OxyPlot.PlotCommands.ZoomRectangle);

            myController.BindMouseDown(OxyMouseButton.Right, OxyPlot.PlotCommands.Track);

            //Keyboard

            myController.BindKeyDown(OxyKey.R, OxyPlot.PlotCommands.Reset);

            myController.BindKeyDown(OxyKey.W, OxyPlot.PlotCommands.PanDown);
            myController.BindKeyDown(OxyKey.A, OxyPlot.PlotCommands.PanRight);
            myController.BindKeyDown(OxyKey.S, OxyPlot.PlotCommands.PanUp);
            myController.BindKeyDown(OxyKey.D, OxyPlot.PlotCommands.PanLeft);

            return(myController);
        }
Example #8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            GS_SPA = (GS_SPAvWindow)this.Owner;
            WorkInfo[] listWork = GS_SPA.Core.Archive.GetListWorks();
            lvArchives.ItemsSource = listWork;

            controller.UnbindAll();
            controller.BindMouseDown(OxyMouseButton.Right, PlotCommands.PanAt);
            controller.BindMouseWheel(PlotCommands.ZoomWheel);
            controller.BindKeyDown(OxyKey.R, PlotCommands.Reset);

            controller.BindMouseDown(OxyMouseButton.Left, new DelegatePlotCommand <OxyMouseDownEventArgs>(
                                         (view, controller, args) =>
                                         controller.AddMouseManipulator(view, new WpbTrackerManipulator(view), args)));

            plotter.Controller = controller;
        }
Example #9
0
        public MainWindow()
        {
            DataPoints[0] = new DataPoint(-1.41, 0);
            DataPoints[1] = new DataPoint(0, -2);
            DataPoints[2] = new DataPoint(1.41, 0);
            DataPoints[3] = new DataPoint(4, 14);

            LineSeries startSeries = new LineSeries();

            startSeries.Color = OxyColors.Gray;
            startSeries.Points.AddRange(DataPoints);


            ab_Line       = new LineSeries();
            ab_Line.Color = OxyColors.Orange;
            ab_Line.Points.Add(DataPoints[0]);
            ab_Line.Points.Add(DataPoints[1]);

            bc_Line       = new LineSeries();
            bc_Line.Color = OxyColors.Orange;
            bc_Line.Points.Add(DataPoints[1]);
            bc_Line.Points.Add(DataPoints[2]);

            de_Line.Color = OxyColors.Red;

            end_Line.Color      = OxyColors.Purple;
            end_Line.MarkerSize = 5;

            pointSeries_abcdef = CreateLineseries(OxyColors.Green);
            abcdefPoints       = new DataPoint[] { DataPoints[0], DataPoints[1], DataPoints[2], DataPoints[0], DataPoints[1], DataPoints[0] };
            pointSeries_abcdef.Points.AddRange(abcdefPoints);

            plt_model.Series.Add(startSeries);
            plt_model.Series.Add(pointSeries_abcdef);
            plt_model.Series.Add(ab_Line);
            plt_model.Series.Add(bc_Line);
            plt_model.Series.Add(de_Line);
            plt_model.Series.Add(end_Line);

            InitializeComponent();

            var myController = new PlotController();

            plt_end.Controller = myController;

            //  Customizing the bindings
            myController.UnbindMouseDown(OxyMouseButton.Right);
            //Mouse

            myController.BindMouseDown(OxyMouseButton.Left, OxyPlot.PlotCommands.ZoomRectangle);

            myController.BindMouseDown(OxyMouseButton.Right, OxyPlot.PlotCommands.Track);

            //Keyboard

            myController.BindKeyDown(OxyKey.R, OxyPlot.PlotCommands.Reset);

            myController.BindKeyDown(OxyKey.W, OxyPlot.PlotCommands.PanDown);
            myController.BindKeyDown(OxyKey.A, OxyPlot.PlotCommands.PanRight);
            myController.BindKeyDown(OxyKey.S, OxyPlot.PlotCommands.PanUp);
            myController.BindKeyDown(OxyKey.D, OxyPlot.PlotCommands.PanLeft);

            plt_end.Model = plt_model;
        }