Skip to content

Instantly share code, notes, and snippets.

@rogerfischer
Last active October 15, 2015 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerfischer/fc27f5b8af7c9208dd56 to your computer and use it in GitHub Desktop.
Save rogerfischer/fc27f5b8af7c9208dd56 to your computer and use it in GitHub Desktop.
fresh block
<!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>
Display the source blob
Display the rendered blob
Raw
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