-
-
Save azlkiniue/1fca896399de64dcbcde4fb69184ee0b to your computer and use it in GitHub Desktop.
World Map with D3.js
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
(function(window) { | |
var data, | |
xy = d3 | |
.geo | |
.equirectangular() | |
.scale($('#map_container').width()) | |
.translate([$('#map_container').width() / 2, $('#map_container').height() / 2]), | |
path = d3 | |
.geo | |
.path() | |
.projection(xy), | |
svg = d3 | |
.select('#map_container') | |
.append('svg:svg'), | |
countries = svg | |
.append('svg:g') | |
.attr('id', 'countries'); | |
/* World Map */ | |
countries.selectAll('path') | |
.data(window.countries_data.features) // get the data here: https://gist.github.com/2969317 | |
.enter() | |
.append('svg:path') | |
.attr('d', path) | |
.attr('fill', 'rgba(29,91,85,1)') | |
.attr('stroke', 'rgba(29,91,85,1)') | |
.attr('stroke-width', 1); | |
}(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment