Is it possible to add a set of filters at once on a dc chart? For instance, say I have a pieChart, and an array of filter values to apply.
var osChart = dc.pieChart('#oschart');
And an input set of filters, say
var filters = ["linux", "mac osx", "windows", "solaris"]
How can I apply filters so that only one "filtered" event is generated? I can do something like
for (var i=0; i < filters.length; i++) {
osChart.filter(filters[i]);
}
However that would generate 4 filtered
event.
I am applying filters based on what a user typed on a text box. When a filter is applied, I am making some ajax calls, and this tends to slow down if I apply filters one by one. I can avoid extra ajax calls if the filters can be set at once.
crossfilter has a function filterFunction
which can get this task done, but I am not sure how I can apply that on a dc chart. Apply filterFunction
on osChart.dimension()
did not work. With the latest dc release, I saw some functions like addFilterHandler
and removeFilterHandler
however I cannot test and deploy that version right now.
What other options do I have?