private void DrawPointChart(List <TaskStatistic> Statistic) { var entries = new List <Microcharts.Entry>(); var DayGroup = Statistic.GroupBy(u => u.FinishedTime.Day).ToDictionary(x => x.Key, x => x.ToList()); foreach (var group in DayGroup) { var value = group.Value.Count; var day = group.Value[0].FinishedTime.Day; var entry = new Microcharts.Entry(value) { Label = group.Key.ToString(), ValueLabel = value.ToString(), Color = SKColor.Parse(ColorPickService.NextReverse()) }; entries.Add(entry); } WeeklyPointChart = new Microcharts.PointChart() { IsAnimated = false, LabelTextSize = 25, LabelOrientation = Orientation.Horizontal, ValueLabelOrientation = Orientation.Horizontal, PointSize = 25, Entries = entries, BackgroundColor = SkiaSharp.SKColors.Transparent, Margin = 15, }; }
private void DrawDonutChart(List <TaskStatistic> statistics) { var entries = new List <Microcharts.Entry>(); Dictionary <Guid, (int count, string name)> taskDictionary = new Dictionary <Guid, (int count, string name)>(); foreach (var statistic in statistics) { if (!taskDictionary.ContainsKey(statistic.TaskId)) { taskDictionary[statistic.TaskId] = (count : 1, name : statistic.TaskName); } else { taskDictionary[statistic.TaskId] = (count : taskDictionary[statistic.TaskId].count + 1, name : taskDictionary[statistic.TaskId].name); } } foreach (var item in taskDictionary) { var entry = new Microcharts.Entry(item.Value.count) { Label = item.Value.name, ValueLabel = item.Value.count.ToString(), Color = SKColor.Parse(ColorPickService.NextReverse()) }; entries.Add(entry); } TaskDonutChart = new Microcharts.DonutChart() { IsAnimated = true, AnimationDuration = TimeSpan.FromMilliseconds(300), LabelTextSize = 25, Entries = entries, BackgroundColor = SkiaSharp.SKColors.Transparent, Margin = 10, }; }