If you examine the dodgy arc, you will see you can flip it into the right place by altering the sign on the transform from (50,0)
to (-50,0)
. If you then look at the code that assigns the transform, it is
.attr("transform", function(d, i) { d.pullOutSize = pullOutSize * ( d.startAngle + 0.01 > Math.PI ? -1 : 1); return "translate("+ d.pullOutSize +','+ 0 +")";});
with a note in the original text to say that "the 0.01 is for rounding errors". Given that the startAngle
is already 3.13--i.e. very close to Pi--it looks like this is an edge case where the value fell just the wrong side of the cutoff. Changing the allowable rounding error value to 0.02 puts the arc in the correct place, or you could do something like
d.pullOutSize = pullOutSize * ( // is the start angle less than Pi? d.startAngle + 0.01 < Math.PI ? 1 : // if yes, is the end angle also less than Pi? d.endAngle < Math.PI ? 1 : -1 );
to prevent edge cases like that in your dataset.