Does Rowchart select only one bar in dc.js / crossfilter?

I have a dc.rowchart that has 5 different "categories". All are selected first. When I press one, then only one is highlighted. When I click on the second ... both the first and the second that I clicked are highlighted.

How can I do this / set up a line such that only one category is highlighted each time I click on the panel?

dc.filter("category1");
dc.filter("category2");

Both of these sequences look like “add” filters than replace.

+4
source share
2 answers

. , , dc.js addFilterHandler, filters, , :

myChart.addFilterHandler(function (filters, filter) {
    filters.length = 0; // empty the array
    filters.push(filter);
    return filters;
});

, cap (, ), others. , .

+2

, addFilterHandler - https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#dc.baseMixin+addFilterHandler

, , .

myChart.addFilterHander(function (filters, filter) {
    return [filter];
});
0

Source: https://habr.com/ru/post/1614992/


All Articles