示例#1
0
        private async Task <PlotModel> GetBgcModel(NightView nv)
        {
            var model = new PlotModel();

            model.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom,
                Minimum  = DateTimeAxis.ToDouble(Start.LocalDateTime),
                Maximum  = DateTimeAxis.ToDouble(End.LocalDateTime)
            });

            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left,
                Minimum  = 20,
                Maximum  = 400
            });

            var bgSeries = new LineSeries {
                Title = "Blood Glucose Concentration"
            };

            await foreach (var tv in nv.GlucoseValues(Start, End))
            {
                bgSeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(tv.Time.LocalDateTime), (double)tv.Value));
            }

            model.Series.Add(bgSeries);
            return(model);
        }
示例#2
0
        private async Task <PlotModel> GetModel()
        {
            var nv      = new NightView(App.Configuration);
            var dtStart = DateTimeOffset.Now.AddHours(-6);
            var dtEnd   = DateTimeOffset.Now;

            var model = new PlotModel {
                Title = "Something"
            };

            model.Axes.Add(new DateTimeAxis {
                Position = AxisPosition.Bottom,
                Minimum  = DateTimeAxis.ToDouble(dtStart.LocalDateTime),
                Maximum  = DateTimeAxis.ToDouble(dtEnd.LocalDateTime)
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left
            });

            var lineSeries = new LineSeries();

            await foreach (var gv in nv.GlucoseValues(dtStart, dtEnd))
            {
                lineSeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(gv.Time.LocalDateTime), (double)gv.Value));
            }

            lineSeries.Title = "Nice";
            model.Series.Add(lineSeries);

            return(model);
        }