Skip to content

Instantly share code, notes, and snippets.

/_.md

Forked from enjalot/_.md
Created September 26, 2012 17:43
Show Gist options
  • Save anonymous/3789440 to your computer and use it in GitHub Desktop.
Save anonymous/3789440 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"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}}
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();
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