Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created January 17, 2015 07:46
Show Gist options
  • Save miguelmota/d8fbaf42a75a223816c3 to your computer and use it in GitHub Desktop.
Save miguelmota/d8fbaf42a75a223816c3 to your computer and use it in GitHub Desktop.
d3.js explode pie chart
function explode(d, index) {
var offset = 10;
var angle = (d.startAngle + d.endAngle) / 2;
var xOff = Math.sin(angle) * offset;
var yOff = -Math.cos(angle) * offset;
return 'translate(' + xOff + ',' + yOff +')';
}
arc.attr('transform', explode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment