toolkit/javascript/d3/examples/azimuthal/azimuthal.js
changeset 47 c0b4a8b5a012
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolkit/javascript/d3/examples/azimuthal/azimuthal.js	Thu Apr 10 14:20:23 2014 +0200
@@ -0,0 +1,29 @@
+var xy = d3.geo.azimuthal().scale(240).mode("stereographic"),
+    circle = d3.geo.greatCircle(),
+    path = d3.geo.path().projection(xy),
+    svg = d3.select("body").append("svg:svg");
+
+d3.json("../data/world-countries.json", function(collection) {
+  svg.selectAll("path")
+      .data(collection.features)
+    .enter().append("svg:path")
+      .attr("d", function(d) { return path(circle.clip(d)); })
+    .append("svg:title")
+      .text(function(d) { return d.properties.name; });
+});
+
+function refresh(duration) {
+  var p = svg.selectAll("path");
+  if (duration) p = p.transition().duration(duration);
+  p.attr("d", function(d) { return path(circle.clip(d)); });
+  d3.select("#lon span")
+      .text(xy.origin()[0]);
+  d3.select("#lat span")
+      .text(xy.origin()[1]);
+  d3.select("#scale span")
+      .text(xy.scale());
+  d3.select("#translate-x span")
+      .text(xy.translate()[0]);
+  d3.select("#translate-y span")
+      .text(xy.translate()[1]);
+}