Sha256: cd1702e68b9ef469b30a6a96e1d25a1503dbd7e6a5f03f3ab5e4f3f04f9d595e

Contents?: true

Size: 1.01 KB

Versions: 25

Compression:

Stored size: 1.01 KB

Contents

var w = 960,
    h = 960,
    format = d3.format(",d");

var pack = d3.layout.pack()
    .size([w - 4, h - 4])
    .value(function(d) { return d.size; });

var vis = d3.select("#chart").append("svg")
    .attr("width", w)
    .attr("height", h)
    .attr("class", "pack")
  .append("g")
    .attr("transform", "translate(2, 2)");

d3.json("../data/flare.json", function(json) {
  var node = vis.data([json]).selectAll("g.node")
      .data(pack.nodes)
    .enter().append("g")
      .attr("class", function(d) { return d.children ? "node" : "leaf node"; })
      .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });

  node.append("title")
      .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); });

  node.append("circle")
      .attr("r", function(d) { return d.r; });

  node.filter(function(d) { return !d.children; }).append("text")
      .attr("text-anchor", "middle")
      .attr("dy", ".3em")
      .text(function(d) { return d.name.substring(0, d.r / 3); });
});

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/d3/examples/pack/pack.js