javascript - Show top n-results in dc.js chart -


i have dataset many (thousands) of 'categories'. want show row chart top 15 categories, can't figure out how. without default 'filters', row chart shows every single category on chart, looks bad. want show top 15 categories, based on current crossfilter filters. how can using dc.js & crossfilter?

currently, dimension function looks like:

const mycategoriesdimension = crossfilterdata.dimension(         (d) => {           return d.category;         } ); 

and group function looks like:

const mygroup = mycategoriesdimension.group(); 

my row chart looks like:

 categorieschart         .width(1200)         .height(1200)         .dimension(mycategoriesdimension)         .group(mygroup)         .elasticx(true); 

i think want .cap()

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

it's not available charts available row chart.


Comments