index.html
<!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="//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);
});
d3.select(self.frameElement).style("height",height+"px").style("width",width+"px");
</script>