The reason that our arc() function won't work is the data isn't formatted properly for the function. The arc function that we generated expects the data object to have things like a start angle, an end angle, and so on. Fortunately, D3 can reformat our data so that it will work with our generated arc() function. To do this, we'll generate a pie function that will take a dataset and add the necessary attributes to it for the start angle, end angle, and so on. Add the following just before the code for var path =d3.select('g').selectAll('path')...:
var pie = d3.pie()
.value(function(d) { return d.count; }) //use the 'count' property each value in the original array to determine how big the piece of pie should be
.sort(null); //don't sort the values
Our pie variable is a function that takes...