Dynamic Pie Chart SVG

This used all my powers of trigonometry and takes the same data as used in the world map example to make a pie chart.

Small and large angles are dealt with by the code. The main mistake here is that secondary countries and tertiary countries are all treated the same as the primary country so the data on the pie chart is not as accurate as it could be.

Added: 07 Aug 2015