Using Crossfilter, is it possible to track max/min when grouping?
crossfilter, javascript
Solution
After playing around with this for a bit, you can rebuild the group by just calling the group method again.
Problem
When using Crossfilter (https://github.com/square/crossfilter), I specify functions to use when adding and removing data from a group. It's fairly trivial to keep track of a running average (using CoffeeScript): ``` reduceAdd = (p, v) -> ++p.count; p.sum += v.digit; p reduceRemove = (p, v) -> --p.count; p.sum -= v.digit; p reduceInitial = -> { count: 0 sum: 0 average: -> return 0 if this.count == 0 return this.sum / this.count } ``` Is it possible to keep track of the max and min of each group? I can't figure out a way short of keeping all elements in a huge array and doing a d3.min / d3.max. It seems that adding/removing data would be extremely inefficient. I also looked for a way to tell Crossfilter to completely rebuild the group from scratch, rather than removing items from an existing group. If a filter is applied, the group is reset and rebuilt. Nothing obvious.