Sha256: 7fb3a47314fcc667a8f70a60128e04d7376ee9d1921a5da50752d84d98cb428d

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

<!DOCTYPE html>
<html>
  <head>
    <title>Hello, data!</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">

var data = [4, 8, 15, 16, 23, 42];

d3.selectAll("span")
    .data(data)
  .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(d) { return d; });

function refresh() {
  for (var i = 0; i < data.length; i++) data[i] = (data[i] + 1) % 100;
  d3.selectAll("text")
      .data(data)
      .text(function(d) { return d; });
}

window.addEventListener("keypress", refresh, false);

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bum-0.0.17 public/d3/examples/hello-world/hello-data.html
bum-0.0.16 public/d3/examples/hello-world/hello-data.html
bum-0.0.15 public/d3/examples/hello-world/hello-data.html
bum-0.0.14 public/d3/examples/hello-world/hello-data.html
bum-0.0.13 public/d3/examples/hello-world/hello-data.html
bum-0.0.12 public/d3/examples/hello-world/hello-data.html