Skip to content

Instantly share code, notes, and snippets.

@davo

davo/_.md

Created Jan 11, 2013
Embed
What would you like to do?
An inlet to Tributary
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{"description":"An inlet to Tributary","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"comunas.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.7,"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,"hidepanel":false}
var comunas = tributary.comunas;
var svg = d3.select("svg");
var cw = 900;
var ch = 629;
var xy = d3.geo.mercator()
.scale(110968)
.translate([18163, -10586])
//then we need a path function
var geopath = d3.geo.path()
.projection(xy);
var chart = svg.append("g")
.attr("transform", "translate(" + [-81, 9] + ")");
chart.append("g")
.attr("id", "comunas");
var comunasGroup = chart.select("#comunas");
comunasGroup.selectAll("path")
.data(comunas.features)
.enter()
.append("path")
.attr("d", geopath)
.attr("id", function(d) {
return d.properties.name;
})
.style({
fill:"#F7924F",
stroke:"#FFFFFF",
"stroke-width": 0
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment