Crossfilter create dimension with data whose have nested objects

I'm trying to create graphics with the libraries crossfilter, d3 and dc, and it works well until I create the dimension with an array of objects like this:

{ age: 12, name: 'John Doe', ocupation: 'developer' }

But when in the data I use nested objects and create dimentions with them it wont works to me.
Nested object example:

{ age: 12, name: 'John Doe', nested: { value: 'developer' } }

I don't find any docs about how to use crossfilter with nested objects, then is it possible?
How can I do it?

Upvotes: 1

Views: 193

Answers (1)

Gordon
Gordon

Reputation: 20120

You define the accessor functions for crossfilter, so you can define them however you like.

For example, if you're trying to create an occupation dimension, you could do

var occDimension = cf.dimension(function(row) {
    return row.nested.value;
})

If this was not your question, you'll need to provide more details and an example of the code which didn't work.

Upvotes: 1

Related Questions