This is a helper function that utilises d3.js to create pie charts.