//Adds the actual color to the polygons. public static GMapPolygon addFill(GMapPolygon polygon, string areaname, string selectedTable, string Year) { double green = 0; double red = 0; double blue = 0; string echtgebeidnaam = DictionairContainer.getAreaName(areaname.ToLower()); string dataofarea = DatabaseRequester.getDataFromYear(selectedTable, echtgebeidnaam, Year); double numofarea = double.Parse(dataofarea, CultureInfo.GetCultureInfo("de-DE")); double percentage; if (selectedTable == "tevredenheid_met_het_wonen_in_de_buurt_") { percentage = 100 - numofarea; } else { percentage = (numofarea / 10); } double factor = 1; red = Math.Log10(Math.Pow(10, factor) * (percentage)) * (255 / (factor + 2)); //Uses a logaristmic scale for colors green = -Math.Log10(Math.Pow(10, factor) * (percentage)) * (255 / factor + 2) + 255; if (red > 255) { red = 255; } if (green > 255) { green = 255; } if (red < 0) { red = 0; } if (green < 0) { green = 0; } polygon.Fill = new SolidBrush(Color.FromArgb(100, (int)red, (int)green, (int)blue)); polygon.Stroke = new Pen(Color.Green, 0); return(polygon); }
public static Series CreateNewChart(string gebied, string Data_type) { Series series = new Series(); series.Name = Data_type; series.ChartType = SeriesChartType.Line; string table_name = DictionairContainer.ChangeName(Data_type); string echtegebied = DictionairContainer.getAreaName(gebied.ToLower()); double data06 = double.Parse((DatabaseRequester.getDataFromYear(table_name, echtegebied, "2006")), CultureInfo.GetCultureInfo("de-DE")); double data07 = double.Parse((DatabaseRequester.getDataFromYear(table_name, echtegebied, "2007")), CultureInfo.GetCultureInfo("de-DE")); double data08 = double.Parse((DatabaseRequester.getDataFromYear(table_name, echtegebied, "2008")), CultureInfo.GetCultureInfo("de-DE")); double data09 = double.Parse((DatabaseRequester.getDataFromYear(table_name, echtegebied, "2009")), CultureInfo.GetCultureInfo("de-DE")); double data11 = double.Parse((DatabaseRequester.getDataFromYear(table_name, echtegebied, "2011")), CultureInfo.GetCultureInfo("de-DE")); series.Points.DataBindXY(new[] { 2006, 2007, 2008, 2009, 2011 }, new[] { data06, data07, data08, data09, data11 }); return(series); }