score:1

Accepted answer

You are currently setting pie to the return of the function d3.pie()(category_count). d3.pie() itself returns a function. So what you would want to do is this:

var pie = d3.pie()
      .padAngle(.02)
      .sort(null)
      .value(function(d) {
        return d.value;
      });

Then when you call it like this:

var arcs = svgPie.selectAll("arc")
   .data(pie(category_count),
        function(d) {
          return d.data.key
        });

This is now invoking the function pie with the arguments category_count.


Related Query

More Query from same tag