I'm continuting mbostocks's series of gists about pie charts.
This variation of a donut chart demonstrates how to add/remove slices or move between datasets of differing lengths with transitions. Clicking the radio buttons changes the displayed metric. Note how the new slice enters anticlockwise from the 'end' of the pie chart.
Previous: Animated transition. Next: Nice initial transition.
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js