示例#1
0
        /********** Tracker Content View : END **********/

        /********** Profile Chart View : START **********/

        private void GetTrackerData()
        {
            Device.BeginInvokeOnMainThread(async() =>
            {
                await Task.Factory.StartNew(() =>
                {
                    Entries      = new List <Entry>();
                    UserTrackers = UserTrackers.OrderBy(t => t.ModifyDate).ToList();
                    int index    = 0;
                    foreach (var tracker in UserTrackers)
                    {
                        index++;
                        var barColor = ChartColor.Get(index);
                        double.TryParse(tracker.CurrentWeight, out double currentWeight);
                        tracker.WeightLost      = StartWeight - currentWeight;
                        tracker.BackgroundColor = Xamarin.Forms.Color.FromHex(ChartColor.GetString(index));
                        Entries.Add(new Entry((float)tracker.WeightLost)
                        {
                            Label      = tracker.RevisionNumberDisplayShort,
                            ValueLabel = tracker.WeightLostDisplay.ToString(),
                            Color      = barColor,
                            TextColor  = barColor
                        });
                    }

                    SetChart(App.Configuration.GetUserGraph());
                });
            });
        }