Sf police districts map.
xxxxxxxxxx
<meta charset="utf-8">
<style>
.district {
fill: #ccc;
stroke: #333;
stroke-width: .7px;
}
.district :hover {
fill: #845b46;
}
</style>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script>
<script>
var width = 960,
height = 700;
var path = d3.geo.path()
.projection(null);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("sfp.json", function(error, sfp) {
if (error) throw error;
var districts = svg.append("g")
.attr("class","district")
.selectAll("path")
.data(topojson.feature(sfp, sfp.objects.sfpd_districts).features)
.enter().append("path")
.style("opacity", 0)
.attr("d", path)
districts.append("title")
.text(function(d) { return d.properties.district; });
districts.transition().ease("elastic").duration(500).delay(function(d,i) { return 100*i; }).style("opacity",.8);
});
d3.select(self.frameElement).style("height", height + "px");
</script>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js