I want to make multi level array filtering using crossfilter ans d3.
App.js looks like below.
var region = [{ "code" : "New-York", "id" : 1, "centre" : [{ "name": "xxx", "id" : 11 },{ "name": "yyy", "id" : 12, },{ "name": "zzz", "id" : 13, }] },{ "code" : "Florida", "id" : 2, "centre" : [{ "name": "aaa", "id" : 21 },{ "name": "bbb", "id" : 23, }] },{ "code" : "Tennessee", "id" : 3, "centre" : [{ "name": "ccc", "id" : 31 }, { "name": "ddd", "id" : 32, }, { "name": "eee", "id" : 33, }, { "name": "fff", "id" : 34, }] },{ "code" : "Jersey", "id" : 3, "centre" : [{ "name": "ccc", "id" : 31 }, { "name": "ddd", "id" : 32, }, { "name": "eee", "id" : 33, }, { "name": "fff", "id" : 34, }] } ]; $(document).ready(function() { var i, allCodeDimensionGroups, currentSet, currentSetSum; regionCrossfilter = crossfilter(region); regionsCount = regionCrossfilter.groupAll().value(); codeDimension = regionCrossfilter.dimension( function(regiion) { //return region.centre[0].id; return regiion.code; }), codeDimensionGroup = codeDimension.group(), table = $('#outputTable'), header = $('#outputTable > thead > tr'), valuesRow = $('#outputTable > tbody > tr'); function appendRegionData(region, value) { //Adds header cell and value beneath it header.append('<th>' + region + '</th>'); valuesRow.append('<td>' + value + '</td>') } appendRegionData('Region', regionsCount); allCodeDimensionGroups = codeDimensionGroup.all(); //ee for (i = 0; i < allCodeDimensionGroups.length; i += 1) { codeDimension.filter(allCodeDimensionGroups[i].key); currentSet = codeDimension.top(Infinity); appendRegionData(allCodeDimensionGroups[i].key, currentSet); } //Reset the filters when you are done codeDimension.filterAll(); }); Can we show the results as below in a table.
New-York Florida Jersey xxx aaa ccc yyy bbb ddd zzz eee fff How can we do this using crossfilter js and d3 js.
Any help would be accepted.
Thanks in advance.