Exemplo n.º 1
0
        public Test()
        {
            //PlotController cont = new PlotController();
            //cont.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);

            InitializeComponent();

            DataManager.Init();
            CurrentUnit = ReadingCell.ReadingUnitType.Fahrenheit;

            model = ChartModel;

            model.TouchStarted += Model_TouchStarted;

            Temp_LineColor  = OxyColors.Blue;
            Humid_LineColor = OxyColors.Red;
            SP_LineColor    = OxyColors.Orange;

            Init(30);

            model.Axes.Add(Horizontal_Axis);
            model.Axes.Add(Vertical_Axis);

            DataManager.Get_Current_Day(CurrentUnit);
            Get_Series();

            model.Series.Add(temp1);
            model.Series.Add(temp2);
            model.Series.Add(temp3);

            chart1.Model = model;

            PlotTouch.Set_Margins(chart1.Model.PlotMargins.Left, 15, chart1.Model.PlotMargins.Right);
        }
Exemplo n.º 2
0
        public App()
        {
            InitializeComponent();

            PlotTouch.Init();

            MainPage = new NavigationPage(new Test());
        }
Exemplo n.º 3
0
        private void Chart1_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:

                PlotTouch.Panning = true;
                PlotTouch.Running_Touch.X_Location = e.TotalX + PlotTouch.Initial_Touch.X_Location;
                PlotTouch.Running_Touch.X_Change   = e.TotalX;

                int index = PlotTouch.Index;

                break;

            case GestureStatus.Completed:

                PlotTouch.Panning = false;
                PlotTouch.Final_Touch.Start_Time = DateTime.UtcNow;
                PlotTouch.Final_Touch.X_Location = PlotTouch.Running_Touch.X_Location;
                PlotTouch.Final_Touch.X_Change   = PlotTouch.Running_Touch.X_Change;

                if (PlotTouch.Is_Swipe())
                {
                    // Swipped left <= Increase view
                    if (PlotTouch.Final_Touch.X_Change < 0)
                    {
                        // Increase the day, week, month
                        switch (PlotTouch.Current_Interval)
                        {
                        case PlotTouch.IntervalType.Hour:

                            DataManager.Move_Day(true);

                            chart1.Model.Title = DataManager.Get_Current_Day_DateTime().ToString("MMMM d, yyyy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Day(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;

                        case PlotTouch.IntervalType.Week:

                            DataManager.Move_Week(true);

                            DateTime start = DataManager.Get_Current_Week_DateTime();
                            DateTime end   = start.AddDays(7);

                            chart1.Model.Title = start.ToString("M/d/yy") + " - " + end.ToString("M/d/yy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Week(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;

                        case PlotTouch.IntervalType.Month:

                            DataManager.Move_Month(true);

                            chart1.Model.Title = DataManager.Get_Current_Month_DateTime().ToString("MMMM yyyy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Month(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;
                        }
                    }

                    // Swipped right => Decrease view
                    else if (PlotTouch.Final_Touch.X_Change > 0)
                    {
                        // Decrease the day, week, month
                        switch (PlotTouch.Current_Interval)
                        {
                        case PlotTouch.IntervalType.Hour:

                            DataManager.Move_Day(false);

                            chart1.Model.Title = DataManager.Get_Current_Day_DateTime().ToString("MMMM d, yyyy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Day(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;

                        case PlotTouch.IntervalType.Week:

                            DataManager.Move_Week(false);

                            DateTime start = DataManager.Get_Current_Week_DateTime();
                            DateTime end   = start.AddDays(7);

                            chart1.Model.Title = start.ToString("M/d/yy") + " - " + end.ToString("M/d/yy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Week(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;

                        case PlotTouch.IntervalType.Month:

                            DataManager.Move_Month(false);

                            chart1.Model.Title = DataManager.Get_Current_Month_DateTime().ToString("MMMM yyyy");

                            chart1.Model.Series.Clear();

                            DataManager.Get_Current_Month(CurrentUnit);
                            Get_Series();

                            chart1.Model.Series.Add(temp1);
                            chart1.Model.Series.Add(temp2);
                            chart1.Model.Series.Add(temp3);
                            chart1.Model.InvalidatePlot(true);

                            break;
                        }
                    }
                }

                break;
            }
        }