equal
deleted
inserted
replaced
|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
|
5 <script type="text/javascript" src="../../d3.js"></script> |
|
6 <script type="text/javascript" src="../../d3.geo.js"></script> |
|
7 <style type="text/css"> |
|
8 |
|
9 svg { |
|
10 background: #eee; |
|
11 width: 960px; |
|
12 height: 500px; |
|
13 } |
|
14 |
|
15 #counties path { |
|
16 stroke: steelblue; |
|
17 } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <script type="text/javascript"> |
|
23 |
|
24 var svg = d3.select("body") |
|
25 .append("svg:svg"); |
|
26 |
|
27 var counties = svg.append("svg:g") |
|
28 .attr("id", "counties"); |
|
29 |
|
30 var path = d3.geo.path(); |
|
31 |
|
32 d3.json("../data/us-counties.json", function(json) { |
|
33 counties.selectAll("path") |
|
34 .data(json.features) |
|
35 .enter().append("svg:path") |
|
36 .attr("d", function(d) { |
|
37 return path({ |
|
38 type: "LineString", |
|
39 coordinates: d3.geo.bounds(d) |
|
40 }); |
|
41 }); |
|
42 }); |
|
43 |
|
44 </script> |
|
45 </body> |
|
46 </html> |