I have data set where some of the field values are arrays and I'd like to use crossfilter and d3.js or dc.js to display histogram of how many times each of those values was present in the dataset.
Here's an example:
var data = [
{"key":"KEY-1","tags":["tag1", "tag2"]},
{"key":"KEY-2","tags":["tag2"]},
{"key":"KEY-3","tags":["tag3", "tag1"]}];
var cf = crossfilter(data);
var tags = cf.dimension(function(d){ return d.tags;});
var tagsGroup = tags.group();
dc.rowChart("#chart")
.renderLabel(true)
.dimension(tags)
.group(tagsGroup)
.xAxis().ticks(3);
dc.renderAll();
And JSFiddle http://jsfiddle.net/uhXf5/2/
When I run that code it produces graph like this:
But what I want is something like this:
To make things even more complicated it would be awesome to be able to click on any of the rows and filter dataset by the tag that was clicked.
Anyone has any ideas how to achieve that?
Thanks, Kostya