Last active
October 25, 2018 06:25
-
-
Save NPashaP/ed2b1cb3bca196cd86e03437df5e7238 to your computer and use it in GitHub Desktop.
US County Map - Basic
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"> | |
<style> | |
body{ | |
font-family:Roboto; | |
font-size: .6rem; | |
} | |
.state-border { | |
fill: none; | |
stroke: #000; | |
stroke-width: .5px; | |
} | |
.counties { | |
fill: #eee; | |
stroke: #bbb; | |
stroke-width: .5px; | |
} | |
.counties path:hover { | |
fill: #ddd; | |
} | |
.county-border{ | |
fill: none; | |
stroke:#fff; | |
stroke-width:2px; | |
} | |
.county-name text{ | |
text-anchor: middle; | |
pointer-events:none; | |
} | |
</style> | |
<body> | |
<svg></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://d3js.org/topojson.v1.min.js"></script> | |
<script src="http://vizjs.org/viz.v1.2.0.min.js"></script> | |
<script> | |
var width=960, height=1800; | |
d3.json(viz.maps.uscountyurl, function(error, uscjson) { | |
if (error) throw error; | |
viz.maps.uscounties=uscjson; | |
var counties = viz.uscs() | |
.state('NJ') | |
.height(height) | |
.width(width); | |
d3.select("svg") | |
.attr("width",width) | |
.attr("height",height) | |
.call(counties); | |
}); | |
// adjust the bl.ocks frame dimension. | |
d3.select(self.frameElement).style("height",height+"px").style("width",width+"px"); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment