private ColumnChart GetLastXVolume(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("lastvolume", 200); var runs = Activities.OrderByDescending(a => a.Date).Take(x).Reverse().ToList(); ColumnChart.DataSet volume = new ColumnChart.DataSet("volume"); foreach (var run in runs) { volume.Add(run.Date.ToString("dd-MM"), $"{(run.Distance / 1000):0.00}", run.Distance / 1000); } chart.AddDataSet(volume); return(chart); }
private ColumnChart GetLastXPace(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("lastpace", 200); var runs = Activities.OrderByDescending(a => a.Date).Take(x).Reverse().ToList(); ColumnChart.DataSet pace = new ColumnChart.DataSet("pace"); foreach (var run in runs) { pace.Add(run.Date.ToString("dd-MM"), run.Pace, run.Speed * run.Speed * run.Speed * run.Speed); } chart.AddDataSet(pace); return(chart); }
private ColumnChart GetLastXClimb(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("lastclimb", 200); var runs = Activities.OrderByDescending(a => a.Date).Take(x).Reverse().ToList(); ColumnChart.DataSet climb = new ColumnChart.DataSet("climb"); foreach (var run in runs) { climb.Add(run.Date.ToString("dd-MM"), Math.Round(run.Climb).ToString(CultureInfo.InvariantCulture), run.Climb); } chart.AddDataSet(climb); return(chart); }
private ColumnChart GetLastMonthClimb(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("monthclimb", 200); var months = Activities.OrderByDescending(run => run.Date).GroupBy(run => new { run.Date.Year, run.Date.Month }).Take(x).Reverse().ToList(); ColumnChart.DataSet climb = new ColumnChart.DataSet("climb"); foreach (var month in months) { double sum = month.Sum <HalbotActivity>(run => run.Climb); climb.Add(month.First <HalbotActivity>().Date.ToString("MMM"), $"{sum:0}", sum); } chart.AddDataSet(climb); return(chart); }
private ColumnChart GetLastMonthPace(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("monthpace", 200); var months = Activities.OrderByDescending(run => run.Date).GroupBy(run => new { run.Date.Year, run.Date.Month }).Take(x).Reverse().ToList(); ColumnChart.DataSet pace = new ColumnChart.DataSet("pace"); foreach (var month in months) { double avg_speed = month.Average <HalbotActivity>(run => run.Speed); pace.Add(month.First <HalbotActivity>().Date.ToString("MMM"), $"{HalbotActivity.PaceForSpeed(avg_speed)}", avg_speed * avg_speed * avg_speed * avg_speed); } chart.AddDataSet(pace); return(chart); }
private ColumnChart GetLastWeekClimb(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("weekclimb", 200); var weeks = Activities.OrderByDescending(run => run.Date).GroupBy(run => new { run.Date.Year, run.Week }).Take(x).Reverse().ToList(); ColumnChart.DataSet climb = new ColumnChart.DataSet("climb"); foreach (var week in weeks) { double sum = week.Sum <HalbotActivity>(run => run.Climb); climb.Add(week.First <HalbotActivity>().Week.ToString(), $"{sum:0}", sum); } chart.AddDataSet(climb); return(chart); }
private ColumnChart GetLastWeekPace(int x) { if (x > Activities.Count) { x = Activities.Count; } ColumnChart chart = new ColumnChart("weekpace", 200); var weeks = Activities.OrderByDescending(run => run.Date).GroupBy(run => new { run.Date.Year, run.Week }).Take(x).Reverse().ToList(); ColumnChart.DataSet pace = new ColumnChart.DataSet("pace"); foreach (var week in weeks) { double avg_speed = week.Average <HalbotActivity>(run => run.Speed); pace.Add(week.First <HalbotActivity>().Week.ToString(), $"{HalbotActivity.PaceForSpeed(avg_speed)}", avg_speed * avg_speed * avg_speed * avg_speed); } chart.AddDataSet(pace); return(chart); }