pulling the pie chart code up into it's own helper function for reuse