toolkit/javascript/d3/examples/choropleth/choropleth-bounds.html
author Nicolas Sauret <nicolas.sauret@iri.centrepompidou.fr>
Fri, 18 Apr 2014 14:31:58 +0200
changeset 51 79833eaa394a
parent 47 c0b4a8b5a012
permissions -rw-r--r--
set up second level for navigation

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <script type="text/javascript" src="../../d3.js"></script>
    <script type="text/javascript" src="../../d3.geo.js"></script>
    <style type="text/css">

svg {
  background: #eee;
  width: 960px;
  height: 500px;
}

#counties path {
  stroke: steelblue;
}

    </style>
  </head>
  <body>
    <script type="text/javascript">

var svg = d3.select("body")
  .append("svg:svg");

var counties = svg.append("svg:g")
    .attr("id", "counties");

var path = d3.geo.path();

d3.json("../data/us-counties.json", function(json) {
  counties.selectAll("path")
      .data(json.features)
    .enter().append("svg:path")
      .attr("d", function(d) {
        return path({
          type: "LineString",
          coordinates: d3.geo.bounds(d)
        });
      });
});

    </script>
  </body>
</html>