Skip to content

Instantly share code, notes, and snippets.

Forked from mbostock/.block
Last active October 24, 2016 00:38
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
County Circles
license: gpl-3.0

This symbol map encodes the area of each county using a circle at the county's centroid.

<!DOCTYPE html>
<meta charset="utf-8">
circle {
fill: none;
stroke: steelblue;
<script src="//"></script>
<script src="//"></script>
var width = 960,
height = 500;
var path = d3.geo.path();
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("/mbostock/raw/4090846/us.json", function(error, us) {
if (error) throw error;
.data(topojson.feature(us, us.objects.counties).features)
.attr("transform", function(d) { return "translate(" + path.centroid(d) + ")"; })
.attr("r", function(d) { return Math.sqrt(path.area(d) / Math.PI); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment