Mapd-crossfilter group function

I am trying to group data from a dimension based on a callback function like is described here.

The callback function seems to have no effect on the grouping of the data, and looking at the source code this does not seem to be supported. Is there really no option for doing this?

The way the Omnisci’s Crossfilter works is it takes the string that you input and it essential inserts it into an sql query. For example

var time = crossFilter.dimension("datetime") // the datetime string will be inserted directly into the SQL query

SELECT datetime FROM <database>;

Building off of this we are now able to achieve the filtering that we are after. Let’s say that we want to group by hour, then you can do

var time = crossFilter.dimension("extract(hour from datetime)")

SELECT extract(hour from datetime) FROM <database>;

Now you can use your newly grouped dimension!

1 Like

Yap, it’s very similar to dc.js :wink: