/// <summary> /// generate a chart /// </summary> private void GenerateChart() { var entries = new List <Microcharts.Entry>() { new Microcharts.Entry(Cases) { Label = "Cases", ValueLabel = Cases.ToString("N0"), Color = SKColor.Parse("#266489") }, new Microcharts.Entry(Deaths) { Label = "Deaths", ValueLabel = Deaths.ToString("N0"), Color = SKColor.Parse("#68B9C0") }, new Microcharts.Entry(Recovered) { Label = "Recovered", ValueLabel = Recovered.ToString("N0"), Color = SKColor.Parse("#90D585") } }; // set font size for the chart label var chart = new BarChart() { Entries = entries, LabelTextSize = 40f }; Chart = chart; }
public void OnGet() { Deaths = diagnosisService.Deaths(); Recovered = diagnosisService.Recovered(); Diagnoses = diagnosisService.GetDiagnosesWithCorona(); var newDiagnosis = Diagnoses .Where(x => (x.Death == true && x.Recovered == true) || (x.Death == true && x.Recovered == false) || (x.Death == false && x.Recovered == true)) .GroupBy(d => d.Recovered); foreach (var item in newDiagnosis) { RecoveryRate.Add(new StatisticsCore { Recovered = item.Key == true ? "Recovered " + String.Format("{0:0.00}", ((double)item.Count() / (Deaths.Count() + Recovered.Count())) * 100) + "%" : "Deaths " + String.Format("{0:0.00}", ((double)item.Count() / (Deaths.Count() + Recovered.Count())) * 100) + "%", TotalPatients = item.GroupBy(x => x.Patient.Name).Count() }); } }