Reputation: 393
I'm visualizing a drug database of 200 entries. I've created a piechart using DC.js to show the frequency of each drug. The pie chart is cluttered with drugs that appear once.
I want to adjust this pie chart so that it visualizes the top 5 most used drugs i.e. the top 5 biggest slices of the pie chart.
Is there a way to use the .group() or .reduceSum() methods so only the biggest pie chart slices are shown?
Upvotes: 1
Views: 371
Reputation: 20150
As answered on the user group: Use the functions of the Cap Mixin, which is a base of the pie chart:
var pie = dc.pieChart("#pie-chart");
[...]
pie.cap(5);
Upvotes: 1