0
votes

I have a dataset with many (thousands) of 'categories'. I want to show a row chart with the top 15 categories, but can't figure out how. Without any default 'filters', the row chart shows every single category on the chart, which looks bad. I only want to show the top 15 categories, but based on the current crossfilter filters. How can I do that using dc.js & crossfilter?

Currently, my dimension function looks like:

const myCategoriesDimension = crossFilterData.dimension(
        (d) => {
          return d.category;
        } );

And my group function looks like:

const myGroup = myCategoriesDimension.group();

My row chart looks like:

 categoriesChart
        .width(1200)
        .height(1200)
        .dimension(myCategoriesDimension)
        .group(myGroup)
        .elasticX(true);
1

1 Answers

3
votes

I think you want .cap()

https://github.com/dc-js/dc.js/blob/develop/web/docs/api-latest.md#dc.capMixin+cap

It's not available for all charts but it is available for the row chart.