toolkit/javascript/d3/examples/hello-world/hello-transform.html
changeset 47 c0b4a8b5a012
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolkit/javascript/d3/examples/hello-world/hello-transform.html	Thu Apr 10 14:20:23 2014 +0200
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Hello, world!</title>
+    <script type="text/javascript" src="../../d3.js"></script>
+  </head>
+  <body>
+    Your lucky numbers are:<br>
+    <span></span>
+    <span></span>
+    <span></span>
+    <span></span>
+    <span></span>
+    <script type="text/javascript">
+
+d3.selectAll("span")
+  .append("svg:svg")
+    .attr("width", 100)
+    .attr("height", 100)
+  .append("svg:text")
+    .attr("x", "50%")
+    .attr("y", "50%")
+    .attr("dy", ".35em")
+    .attr("text-anchor", "middle")
+    .attr("fill", "white")
+    .attr("stroke", "black")
+    .attr("stroke-width", 1.5)
+    .style("font", "36pt Comic Sans MS")
+    .style("text-shadow", "3px 3px 3px rgba(0,0,0,.4)")
+    .text(function() { return ~~(Math.random() * 100); });
+
+function transform() {
+  d3.selectAll("text")
+      .text(function() { return ~~(Math.random() * 100); });
+}
+
+window.addEventListener("keypress", transform, false);
+
+    </script>
+  </body>
+</html>