public void ReloadSeries() { var views = items.Where(p => p.IsFinishedWithDate).ToList(); Series.Clear(); Counts.Clear(); foreach (var t in MovieViewModel.TypesDict) { int c = 0; var points = new List <DataModel>(); for (var dt = 2012; dt <= DateTime.Today.Year; dt = dt + 1) { var count = views.Count(p => p.FinishDate.Value.Year == dt && p.Type == t.Key); points.Add( new DataModel() { Year = dt, Count = count }); c = c + count; } var a = new StackedColumnSeries() { Values = new ChartValues <DataModel>(points), Title = t.Value, Fill = ConvertFuncs.TypeToBrushFunc(t.Key) }; Series.Add(a); Counts.Add(new CountClass(c, t.Key, t.Value)); } Totals = Counts.Sum(p => p.Count); Reloaded?.Invoke(null, EventArgs.Empty); }
public void ReloadSeries() { var views = items.Where(p => p.States.IsStateDoneWithDate(StateEnum.Finished)).ToList(); Series.Clear(); Counts.Clear(); foreach (var t in MovieViewModel.TypesDict) { int c = 0; var points = new List <DateTimePoint>(); for (var dt = FirstDay; dt <= LastDay; dt = dt.AddDays(1)) { var count = views.Count(p => p.FinishDate == dt && p.Type == t.Key); points.Add( new DateTimePoint() { DateTime = dt, Value = count }); c = c + count; } var a = new StackedColumnSeries() { Values = new ChartValues <DateTimePoint>(points), Title = t.Value, Fill = ConvertFuncs.TypeToBrushFunc(t.Key) }; Series.Add(a); Counts.Add(new CountClass(c, t.Key, t.Value)); } Totals = Counts.Sum(p => p.Count); Reloaded?.Invoke(null, EventArgs.Empty); }