6

Crossfilter supports dimensions with arrays since version 1.4.0-alpha.06 https://github.com/crossfilter/crossfilter/wiki/API-Reference#dimension_with_arrays

Is it possible to exploit this functionality in dc.js?

I haven' found any examples yet... I am aware of the method described in Is there a way to tell crossfilter to treat elements of array as separate records instead of treating whole array as single key?, but that works with earlier versions of crossfilter too (it does not make use of the new functionality).

Community
  • 1
  • 1
emiguevara
  • 1,359
  • 13
  • 26
  • 2
    Yes, it's possible. :) Would you care to contribute an example? – Gordon Jan 18 '17 at 16:56
  • 2
    The cool thing about this is that you just use one of these array dimensions and it should work the same way as any other dimension in dc.js. I think... – Ethan Jewett Jan 18 '17 at 19:12
  • 2
    P.S. I edited the version mentioned, as this functionality has not (and I assume will not) be introduced in the 1.3.x line. – Ethan Jewett Jan 18 '17 at 19:12
  • Thanks, the crossfilter version I was testing was the issue... using 1.4.0 it is possible to get something going on with pies and rows. I'll post an answer with a working example. – emiguevara Jan 19 '17 at 10:06

1 Answers1

10

With help from comments above, I managed to get this working, very simple indeed if you use the right version of crossfilter (1.4.0). Works fine with rowChart() and pieChart().

I made a an example bl.ock based on previous approaches: http://bl.ocks.org/emiguevara/4bd152a8828f6b31270702d97dc0133d

emiguevara
  • 1,359
  • 13
  • 26
  • Brilliant great for multipart survey questions. Thank you! – user2259146 Sep 22 '18 at 13:46
  • How to create bar chart if the data set look like this {"key":"KEY-1", "state":"CA", "topics":["Technology","Science", "Automotive"],"medium":["paper", "web"], "date":new Date("10/02/2012"),"publication":[{at:new Date("10/05/2012"),publication_name:"MixMe"},{at:new Date("10/05/2013"),publication_name:"MC GRAW"},]}, { "key":"KEY-2","state":"CA","topics":["Health"],"medium":["paper"],"date": new Date("10/05/2012"),"publication":[{at:new Date("10/05/2010"),publication_name:"Come On"},{at:new Date("10/05/2011"),publication_name:"MC GRAW"},]. Count on y-axis and publication name on x axis – Shahabaz Nov 19 '18 at 15:29