d3/examples/choropleth/choropleth-bounds.html

41 строка
656 B
HTML

<!DOCTYPE html>
<meta charset="utf-8"> <script src="../../d3.js"></script>
<style>
svg {
background: #eee;
width: 960px;
height: 500px;
}
#counties path {
stroke: steelblue;
}
</style>
<body>
<script>
var svg = d3.select("body")
.append("svg");
var counties = svg.append("g")
.attr("id", "counties");
var path = d3.geo.path();
d3.json("../data/us-counties.json", function(error, json) {
counties.selectAll("path")
.data(json.features)
.enter().append("path")
.attr("d", function(d) {
return path({
type: "LineString",
coordinates: d3.geo.bounds(d)
});
});
});
</script>