I am trying to understand the "fake group" filtering method as described in the dc.js FAQ How do I filter the data before it's charted?
Please see my example here: dc.js jsfiddle
I want to filter my data by TYPE before the charts are drawn (the TYPE to filter on will come from another part of my application). Basically it should have the same effect as clicking on one of the four bars (A,B,C,D) in the row chart, but I want to be able to control it from elsewhere in my code, and it should happen before the charts are drawn.
I think I need to use the Filter out bins by predicate function on the values approach on my group named "type" e.g.
function filter_bins(source_group, f) {
return {
all:function () {
return source_group.all().filter(function(d) {
return f(d.value);
});
}
};
}
But I'm unclear on what function I should be passing in as f, or what a predicate function is.
I would appreciate any help! Thanks.