Bug in the makefile. Will update when fixed. Can use us-atlas to produce the same counties.json file.
UPDATED with working makefile. Fork of us-atlas example.
forked from darrenjaworski's block: Oklahoma Counties
xxxxxxxxxx
<meta charset="utf-8">
<style>
.county {
fill: #eee;
}
.county:hover {
fill: orange;
}
.county-border {
fill: none;
stroke: #777;
}
.state-border {
fill: none;
stroke: #333;
}
svg {
display: block;
margin: auto;
}
</style>
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script src="//d3js.org/topojson.v1.min.js"></script>
<script>
var width = 960,
height = 500;
var path = d3.geo.path()
.projection(null);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("ok-counties.json", function(error, ok) {
if (error) throw error;
var counties = topojson.feature(ok, ok.objects.counties);
svg.append("g")
.attr("class", "counties")
.selectAll("path")
.data(counties.features)
.enter().append("path")
.attr('class', 'county')
.attr("d", path);
svg.append("path")
.datum(topojson.mesh(ok, ok.objects.counties, function(a, b) { return a !== b; }))
.attr("class", "county-border")
.attr("d", path);
svg.append("path")
.datum(topojson.mesh(ok, ok.objects.counties, function(a, b) { return a === b; }))
.attr("class", "state-border")
.attr("d", path);
});
</script>
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js