Beispiel #1
0
        public static async Task <List <BarModel> > GenerateData(StatisticsViewModel vm, UIColor up, UIColor down)
#endif
        {
            var models = new List <BarModel>();

            if (vm.GroupsEventsCount.Count == 0)
            {
                await vm.ExecuteRefreshCommand();
            }

            int previous = -1;

            foreach (var eventInGroup in vm.GroupsEventsCount)
            {
                var color = previous == -1 || previous < eventInGroup.Value ? up : down;
                models.Add(new BarModel()
                {
                    Value = eventInGroup.Value, Color = color, Legend = vm.FromUnixTime(eventInGroup.Key).ToString("MM/dd/yy")
                });
                previous = eventInGroup.Value;
            }


            return(models);
        }
Beispiel #2
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await viewModel.ExecuteRefreshCommand();

            if (viewModel.CheckInData.Count > 0)
            {
                var max = Device.Idiom == TargetIdiom.Phone ? 7.0 : 16.0;

                var factor = max / (double)viewModel.CheckInData.Count;
                if (factor > 1.0)
                {
                    factor = 1.0;
                }
                else if (factor < .1)
                {
                    factor = .1;
                }

                //Chart.PrimaryAxis.ZoomFactor = factor;
            }
            else
            {
                //Chart.IsVisible = false;
            }
        }