score:4

you can use this simple code:

...
.data(partition.nodes)
.filter(function(d) { // you're not restricted to use the "filter" function
   var startangle = arc.startangle()(d);
   var endangle = arc.endangle()(d);
});
...

score:5

you can see them in the code:

var arc = d3.svg.arc()
    .startangle(function(d) { return d.x; })
    .endangle(function(d) { return d.x + d.dx; })
    .innerradius(function(d) { return math.sqrt(d.y); })
    .outerradius(function(d) { return math.sqrt(d.y + d.dy); });

so your start angle is in the x attribute and x + dx give your end angle.

the trick is that the x, dx, y and dy are all set by the layout function:

var partition = d3.layout.partition()
    .sort(null)
    .size([2 * math.pi, radius * radius])
    .value(function(d) { return 1; });

sort(null) tells it not to reorder your data size(...) tells it the output range for x and y coordinate (radius is squared because we are mapping to an area). value(...) is the value accessor for how to weight each item.


Related Query

More Query from same tag