Changeset - 4729289ef49b
[Not reviewed]
Dennis Fink - 9 years ago 2016-03-01 23:14:07
dennis.fink@c3l.lu
Use green colors
1 file changed with 13 insertions and 17 deletions:
0 comments (0 inline, 0 general)
ennstatus/static/js/worldmap.js
Show inline comments
 
@@ -64,41 +64,37 @@ function draw(topo) {
 
		.attr("class", "graticule")
 
		.attr("d", path);
 

	
 
	g.append("path")
 
		.datum({type: "LineString", coordinates: [[-180, 0], [-90, 0], [0, 0], [90, 0], [180, 0]]})
 
		.attr("class", "equator")
 
		.attr("d", path);
 

	
 
	var country = g.selectAll(".country").data(topo);
 
	d3.json("/data/worldmap", function(err, data) {
 

	
 

	
 
		var colorscale = d3.scale.threshold().domain(d3.range(1, data.max+1)).range([
 
			"#c0c2e6",
 
			"#b2b5e0",
 
			"#a4a7da",
 
			"#969ad5",
 
			"#888ccf",
 
			"#7a7fca",
 
			"#6c71c4",
 
			"#5e63be",
 
			"#5056b9",
 
			"#464caf",
 
			"#4146a1",
 
			"#3b4093",
 
			"#353a85",
 
			"#303477",
 
			"#2a2e69",
 
			"#25285b"
 
		var colorscale = d3.scale.threshold().domain(d3.range(1, (data.max+1)/3).map(function(n) { var a=1, b=1, f=1; for(var i = 2; i <= n; i++) { f = a+b; a=b; b=f } return f;})).range([
 
			"#aeffb9",
 
			"#87ff97",
 
			"#60ff76",
 
			"#38ff54",
 
			"#11ff32",
 
			"#00e920",
 
			"#00c21b",
 
			"#009a15",
 
			"#008713",
 
			"#007310",
 
			"#00600d",
 
			"#004c0a"
 
		])
 

	
 
		country.enter().insert("path")
 
			.attr("class", "country")
 
			.attr("d", path)
 
			.attr("id", function(d, i) { return d.id; })
 
			.style("fill", function(d, i) { 
 
				if (d.properties.name in data) {
 
					return colorscale(data[d.properties.name]['total']);
 
				} else {
 
					return "#fdf6e3";
 
				}
0 comments (0 inline, 0 general)