View this code at http://livecoding.io/9940470
Created
April 2, 2014 18:44
-
-
Save iros/9940470 to your computer and use it in GitHub Desktop.
created by http://livecoding.io
This file contains hidden or 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
{ | |
"libraries": [ | |
"d3", | |
"TopoJSON" | |
], | |
"mode": "javascript", | |
"layout": "fullscreen mode (vertical)", | |
"resolution": "reset" | |
} |
This file contains hidden or 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
.states { | |
fill: #e5e5e5; | |
stroke: #fff; | |
stroke-width:2px; | |
} | |
.states:hover { | |
fill: steelblue; | |
} |
This file contains hidden or 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
<svg id="map"></svg> |
This file contains hidden or 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
var width = 960, | |
height = 700; | |
var svg = d3.select("#map") | |
.attr("width", width) | |
.attr("height", height); | |
var geometry = livecoding.json; | |
var projection = d3.geo.mercator() | |
.scale(950) | |
.translate([width * 2.16, height * 1.5]); | |
var path = d3.geo.path().projection(projection); | |
svg.append("path") | |
.datum(topojson.feature(geometry, geometry.objects.usStates)) | |
.attr("d", path) | |
.classed("states", true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment