this is my first gist to block
Last active
April 12, 2016 17:12
-
-
Save bsullins/7f2be1f22b7244901a62ddadf2460a41 to your computer and use it in GitHub Desktop.
first-blocks
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
license: gpl-3.0 |
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"> | |
<link rel="stylesheet" href="light.css"> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/topojson.v1.min.js"></script> | |
<script> | |
var width = 960, | |
height = 600; | |
var path = d3.geo.path() | |
.projection(null); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
d3.json("us.json", function(error, us) { | |
if (error) throw error; | |
svg.append("path") | |
.datum(topojson.feature(us, us.objects.nation)) | |
.attr("class", "land") | |
.attr("d", path); | |
svg.append("path") | |
.datum(topojson.mesh(us, us.objects.states, function(a,b) { return a !==b; })) | |
.attr("class", "border border--state") | |
.attr("d", path); | |
svg.append("g") | |
.attr("class", "bubble") | |
.selectAll("circle") | |
.data(topojson.feature(us, us.objects.counties).features) | |
.enter().append("circle") | |
//find the centroid of the county and put the dot there | |
.attr("transform", function(d) { return "translate(" + path.centroid(d) + ")"; }) | |
//choose the radius size | |
.attr("r", function(d) { return Math.sqrt(parseFloat(d.properties.profit)* 0.00005) }); | |
}); | |
</script> |
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
/mbostock/raw/4090846/us.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment