score:1

Accepted answer

I figured it out like this:

var bubble_inner = d3.pack()
    .size([2 * radius_pack, 2 * radius_pack])
    .padding(padding_pack);

var root = d3.hierarchy({"children": data.inner})
    .sum(function(d) {
        return _(d.data).chain()
            .pluck("spent")
            .reduce(function(memo, num) {
                return memo + num;
            }, 0)
            .value();
    });

var node_inner_g = inner.selectAll("g.node_inner")
    .data(
        bubble_inner(root).children
    )
    .enter()
    .append("g")
        .attr("class", function(d) {
            return "node_inner " + d.candidate;
        })
        .attr("transform", function(d) {
            return "translate(" + [d.x, d.y] + ")";
        });

Related Query

More Query from same tag