In the Crossfilter documentation, it states the following.
a grouping intersects the crossfilter's current filters, except for the associated dimension's filter. Thus, group methods consider only records that satisfy every filter except this dimension's filter. So, if the crossfilter of payments is filtered by type and total, then group by total only observes the filter by type.
What is the reasoning behind that and what is the way around it?
dimension(value) − It is used to construct a new dimension using the specified value accessor function. dimension. filter(value) − It is used to filter records for dimension's match value, and returns the dimension.
- [Instructor] Crossfilter is a JavaScript library that allows you to filter and group data on the fly. It's particularly useful with web-based dashboards when you want interaction with one chart to update what's shown on all the other charts. In fact, Crossfilter powers another JavaScript library called dc.
2 Answers. Show activity on this post. The problem isn't with your use of crossfilter, but your d3 display. Since you aren't using crossfilter for your brand filtering, it should be okay to use that dimension for fetching results (it wouldn't observe any dimension.
Cross-filtering makes it easier and more intuitive for viewers of dashboards to interact with a dashboard's data and understand how one metric affects another. With cross-filtering, users can click a data point in one dashboard tile to have all dashboard tiles automatically filter on that value.
The reason is that Crossfilter is designed for filtering on coordinated views. In this scenario, you are usually filtering on a dimension that is visualized and you want to see other dimensions change based on your filter. But the dimension where the filter is defined should stay constant, partially because it would be redundant (the filter mechanism is usually displayed visually already) and partly because you don't want your dimension values to jump around while you are trying to filter on them.
In any case, to get around it you can define two identical dimensions on the same attribute. Use one dimension for filtering and the other for grouping. This way, as far as Crossfilter is concerned, your filtering dimension and grouping dimensions are separate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With