Created
January 30, 2014 10:29
-
-
Save xseignard/8705981 to your computer and use it in GitHub Desktop.
indexed world map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>test</title> | |
<script src="http://mbostock.github.com/d3/d3.js"></script><style type="text/css"></style><script src="http://d3js.org/d3.v2.js"></script> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
window.onload = function() { | |
var width = 800, | |
height = 500; | |
//Define path generator | |
var path = d3.geo.path().projection(d3.geo.mercator()) | |
var svg = d3.select('body').append('svg') | |
.attr('width', width) | |
.attr('height', height); | |
var i = 0; | |
d3.json('countries.geo.json', function(json) { | |
svg.selectAll('path') | |
.data(json.features) | |
.enter() | |
.append('path') | |
.attr('id', function(d) { return d.id; }) | |
.attr('d', path) | |
.attr('fill', function() { | |
var color = 'rgb('+i+','+i+','+i+')'; | |
i++; | |
return color; | |
}) | |
.append('svg:title') | |
.text(function(d) { return d.properties.name; }); | |
}); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi , I like this app it is nice but have in mind that Kosovo is Serbia !