Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NYC Boroughs in d3
<!DOCTYPE html>
<meta charset="utf-8">
#boroughs {
stroke: grey;
stroke-width: 2px;
fill: steelblue;
<script src="" charset="utf-8"></script>
var width = 960,
height = 500;
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("nyc.json", function(error, nyb) {
var projection = d3.geo.mercator()
.center([-73.94, 40.70])
.translate([(width) / 2, (height)/2]);
var path = d3.geo.path()
var g = svg.append("g");
.attr("id", "boroughs")
.attr("class", function(d){ return; })
.attr("d", path);
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