public async void GenerateGraph() { BrandColorGenerator generator = new BrandColorGenerator(); BikeBrandsGraphModel bg = await generator.GenerateBrands(); brandChart.Legend = new ChartLegend(); brandChart.Legend.Title.Text = "Most stolen brands (Swipe right-to-left to see colours)"; brandChart.Series.Add(new PieSeries() { ItemsSource = bg.model, XBindingPath = "Name", YBindingPath = "Count", EnableTooltip = true, EnableAnimation = true, AnimationDuration = 3, EnableSmartLabels = true }); }
public async void GenerateGraph() { Project4Bicycle.BrandColorGenerator generator = new Project4Bicycle.BrandColorGenerator(); Project4Bicycle.Models.BikeBrandsGraphModel bg = await generator.GenerateBrands(); BrandColorGenerator generator2 = new BrandColorGenerator(); Project4Bicycle.Models.BikeColorsGraphModel bg2 = await generator.GenerateColors(); List <string> brand = new List <string>(); List <int> amount = new List <int>(); for (var i = 0; i < bg.model.Count; i++) { Brand tt = bg.model[i]; brand.Add(tt.Name); amount.Add(tt.Count); } List <string> color = new List <string>(); List <int> amount2 = new List <int>(); for (var j = 0; j < bg2.model.Count; j++) { dynamic tt = bg2.model[j]; color.Add(tt.Name); amount2.Add(tt.Count); } chart5.Series[0].Points.DataBindXY(brand, amount); chart5.Series[0].Name = "Thefts"; chart4.Series[0].Points.DataBindXY(color, amount2); chart4.Series[0].Name = "Thefts"; }