Skip to content

Instantly share code, notes, and snippets.

@missingdays
Forked from miguelmota/pie-explode.js
Last active August 29, 2015 14:27
Show Gist options
  • Save missingdays/3e7e9966702256463713 to your computer and use it in GitHub Desktop.
Save missingdays/3e7e9966702256463713 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