[ Launch: canada ] 5921364 by petesmaluck
See Previous Inlet [ Gist ]
-
-
Save petesmaluck/5921364 to your computer and use it in GitHub Desktop.
canada
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":"","editor_json0":{"vim":false,"emacs":false,"width":740,"height":194,"hide":true},"editor_json1":{"vim":false,"emacs":false,"width":713,"height":223,"hide":true},"description":"canada","display":"svg","public":true,"require":[],"fileconfigs":{"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.svg":{"default":true,"vim":false,"emacs":false,"fontSize":12},"worldcountries.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
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
//a redo of enjalot's tributary3762317 | |
var countries = tributary.worldcountries; | |
var svg = d3.select("svg"); | |
var cw = 603; | |
var ch = 429; | |
var xy = d3.geo.mercator() | |
.scale(279) | |
.translate([792, 604]) | |
//then we need a path function | |
var geopath = d3.geo.path() | |
.projection(xy); | |
var chart = svg.append("g") | |
.attr("transform", "translate(" + [-52, 43] + ")"); | |
//chart | |
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:"#34B17A", | |
stroke:"#FFFFFF", | |
"stroke-width": 1 | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment