Ejemplo n.º 1
0
        private void LoadSumStats()
        {
            var path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\LTF" + "\\userdata" + ID + ".json";

            Stats = StatsService.FromJson((path));

            List <long> Value = new List <long>();

            Value = Stats.Select(i => i.CorrectAnsCount).ToList();

            List <DateTimeOffset> Category = new List <DateTimeOffset>();

            Category = Stats.Select(j => j.Date).ToList();

            List <MainChartModel> listdata = new List <MainChartModel>();

            int Count = Category.Count;
            int index = 0;

            while (Count - index >= 10)
            {
                Value.RemoveAt(0);
                Category.RemoveAt(0);
                index++;
                Debug.WriteLine("Dátum: " + Category[0]);
                Debug.WriteLine("Index: " + index);
                Debug.WriteLine("Počet položiek: " + Count);
            }

            int LoopCount = Count - index;

            for (int i = 0; i < LoopCount; i++)
            {
                var newValue    = (double)Value[i];
                var newCategory = Category[i].ToString("dd/MM HH:mm");

                listdata.Add(new MainChartModel()
                {
                    Category = newCategory, Value = newValue
                });
            }

            (this.chartseries.Series[0] as LineSeries).ItemsSource = listdata;
        }