Rev | Line | |
---|
[76] | 1 | var xy = d3.geo.azimuthal().scale(240).mode("stereographic"), |
---|
| 2 | path = d3.geo.path().projection(xy), |
---|
| 3 | svg = d3.select("body").append("svg:svg"); |
---|
| 4 | |
---|
| 5 | d3.json("../data/world-countries.json", function(collection) { |
---|
| 6 | svg.selectAll("path") |
---|
| 7 | .data(collection.features) |
---|
| 8 | .enter().append("svg:path") |
---|
| 9 | .attr("d", path) |
---|
| 10 | .append("svg:title") |
---|
| 11 | .text(function(d) { return d.properties.name; }); |
---|
| 12 | }); |
---|
| 13 | |
---|
| 14 | function refresh() { |
---|
| 15 | svg.selectAll("path") |
---|
| 16 | .attr("d", path); |
---|
| 17 | d3.select("#lon span") |
---|
| 18 | .text(xy.origin()[0]); |
---|
| 19 | d3.select("#lat span") |
---|
| 20 | .text(xy.origin()[1]); |
---|
| 21 | d3.select("#scale span") |
---|
| 22 | .text(xy.scale()); |
---|
| 23 | d3.select("#translate-x span") |
---|
| 24 | .text(xy.translate()[0]); |
---|
| 25 | d3.select("#translate-y span") |
---|
| 26 | .text(xy.translate()[1]); |
---|
| 27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.