SF Realtor Neighborhood Maps with Mouseover Built with blockbuilder.org
Last active
October 15, 2015 23:33
-
-
Save rogerfischer/fc27f5b8af7c9208dd56 to your computer and use it in GitHub Desktop.
fresh block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.land { | |
fill: #ccc; | |
} | |
.boundary { | |
fill: none; | |
stroke: #999; | |
} | |
path { | |
fill: lightgrey; | |
stroke: #fff; | |
stroke-width: .5px; | |
} | |
path:hover { | |
fill: darkgrey; | |
} | |
</style> | |
<body> | |
<h1>SF Realtor Neighborhoods</h1> | |
<div id="background" style="width:960px;height:800;background:white"></div> | |
<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 = 800; | |
var path = d3.geo.path() | |
.projection(null); | |
var nameById = d3.map(); | |
var svg = d3.select("#background").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
d3.json("realtor_neighborhoods.json", function(error, sf) { | |
if (error) return console.error(error); | |
// console.log(sf); | |
svg.selectAll("path") | |
.data(topojson.feature(sf, sf.objects.Realtor_Neighborhoods).features) | |
.enter() | |
.append("path") | |
.attr("d", path) | |
.append('svg:title').text(function(d) { /*console.log(d.properties); */ | |
return ("Neighborhood: " +d.properties.nbrhood + ", " + d.properties.sfar_distr); }); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment