d3/examples/choropleth/choropleth-bounds.html

41 строка
656 B
HTML
Исходник Обычный вид История

<!DOCTYPE html>
2012-10-12 03:34:17 +04:00
<meta charset="utf-8"> <script src="../../d3.js"></script>
<style>
svg {
background: #eee;
width: 960px;
height: 500px;
}
#counties path {
stroke: steelblue;
}
2012-10-12 03:34:17 +04:00
</style>
<body>
<script>
var svg = d3.select("body")
.append("svg");
var counties = svg.append("g")
.attr("id", "counties");
var path = d3.geo.path();
2012-10-12 03:34:17 +04:00
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)
});
});
});
2012-10-12 03:34:17 +04:00
</script>