score:0

try this and you'll see it:

buildchart('#chart', [
    {"label":"one", "value":1}, 
    {"label":"two", "value":2}, 
    {"label":"three", "value":3},
    {"label":"four", "value":4},
    {"label":"five", "value":1},
    {"label":"six", "value":2},
    {"label":"seven", "value":3},
    {"label":"eight", "value":4},
    {"label":"nine", "value":1},
    {"label":"ten", "value":2}
]);

every "value" must fall on 4 categories ['successful', 'unsuccessful','best one', 'moderate'] then they are grouped by categories

the pie layout converts data into arcs (slices of the pie), and the sort comparator specifies how the arcs should be sorted in terms of their angles. by default, the arcs are sorted by value in descending order, so the largest value will have the overall starting angle (zero by default). so essentially, the sort determines in what order the angles are set, starting from the starting angle.

to disable this use: .sort(null)

change your code to this:

var pie = d3.layout.pie()
.value(function(d) { return d.value; })
 .sort(null);

here is the working code: https://jsfiddle.net/bqp6hdfr/


Related Query

More Query from same tag