// Method for making the chart based on the data and user input private PlotModel Chartmaker(string inhoud, int maand, string mastr) { new Thread(new ThreadStart(Getdata)).Start(); // Filtering the Bike containers AdaptedList <BikeContainer> Fietstrommels2 = FietsTrommels.Filter(element => element.Deelgemeente == inhoud.ToLower()); // Filtering the Theft AdaptedList <Theft> FietsDiefstal2 = FietsDiefstal.Filter(element => element.Neighbourhood == inhoud.ToLower()); AdaptedList <Month> months = this.dataFactory.CreateMonths(new AdaptedList <DateTime>(FietsDiefstal2.Map <DateTime>(e => e.Date).OrderBy(e => e.Date).ToList()), false); months = months.Filter(item => item.GetMonth == maand); //Making arrays int[] bak = new int[] { Fietstrommels2.Count }; int[] thefts = new[] { months[0].EventsThisMonth }; string[] xas = new[] { Extensions.FirstCharToUpper("Bike thefts in " + Fietstrommels2[0].Deelgemeente + " for the month " + mastr) }; //Making a chart PlotModel model = GraphMaker.Mutiplebarschartmaker(bak, thefts, "Fietstrommels", "Diefstallen"); model = GraphMaker.Axisdecorator(model, xas, false); return(model); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.BarPage); plotViewModel = FindViewById <PlotView>(Resource.Id.plotViewModel); mLLayoutModel = FindViewById <LinearLayout>(Resource.Id.linearLayoutModel); AdaptedList <BikeContainer> FietsTrommels = DataFactory.GetBikeContainers(); string[] neighbourhoods = new string[] { "noord", "delfshaven", "centrum", "feijenoord", "kralingen" }; int[] CountsPerNeighbourhood = new int[5]; for (int i = 0; i < neighbourhoods.Length; i++) { CountsPerNeighbourhood[i] = FietsTrommels.Filter( item => item.Deelgemeente == neighbourhoods[i] ).Count; neighbourhoods[i] = Extensions.FirstCharToUpper(neighbourhoods[i]); } plotModel = Core.GraphMaker.Barchartmaker(CountsPerNeighbourhood, colors); //Makes the axes unscrollable. Do not use with pie-chart! plotModel = Core.GraphMaker.Axisdecorator(plotModel, neighbourhoods, false); //Adding a legend (Optional) Best use with Pie chart. //mLLayoutModel = Core.GraphMaker.Legendamaker(colors, this, modelAllocations, mLLayoutModel, 150); //Adding the model to the view MyModel = plotModel; plotViewModel.Model = MyModel; }