Skip to content

Instantly share code, notes, and snippets.

@petesmaluck
Created July 3, 2013 18:29
Show Gist options
  • Save petesmaluck/5921364 to your computer and use it in GitHub Desktop.
Save petesmaluck/5921364 to your computer and use it in GitHub Desktop.
canada
{"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}
//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
})
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment