-
-
Save anonymous/3789440 to your computer and use it in GitHub Desktop.
just another inlet to tributary
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
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":364,"height":299,"hide":false},"endpoint":"tributary","editor_json0":{"vim":false,"emacs":false,"width":740,"height":194,"hide":true},"editor_json1":{"vim":false,"emacs":false,"width":713,"height":223,"hide":true}} |
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
var countries = tributary.worldcountries; | |
var svg = d3.select("svg"); | |
var cw = 600; | |
var ch = 429; | |
var xy = d3.geo.mercator() | |
.scale(338) | |
.translate([300, 263]) | |
//then we need a path function | |
var geopath = d3.geo.path() | |
.projection(xy); | |
var chart = svg.append("g") | |
.attr("transform", "translate(" + [-114, 9] + ")"); | |
//chart | |
chart.append("circle") | |
.attr({ | |
cx: cw/2, | |
cy: ch/2, | |
r: 144, | |
fill: "#DDD9C5", | |
"stroke-width": 0 | |
}) | |
chart.append("g") | |
.attr("id", "countries"); | |
chart.append("g") | |
.attr("id", "points") | |
var countriesGroup = chart.select("#countries"); | |
//create a path for each country | |
countriesGroup.selectAll("path") | |
.data(countries.features) | |
.enter() | |
.append("path") | |
.attr("d", geopath) | |
.attr("id", function(d) { | |
return d.properties.name; | |
}) | |
.classed("country", true) | |
.style({ | |
fill:"#F7924F", | |
stroke:"#FFFFFF", | |
"stroke-width": 0 | |
}) | |
countriesGroup.select("#Antarctica").remove(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment