Created
January 17, 2015 07:46
-
-
Save miguelmota/d8fbaf42a75a223816c3 to your computer and use it in GitHub Desktop.
d3.js explode pie chart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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