Filtering by drop-down menus.

1,072 views
Skip to first unread message

Bradley Spatz

unread,
Aug 18, 2014, 6:25:08 PM8/18/14
to dc-js-us...@googlegroups.com
Has anyone written a chart type that allows you to filter from a (set of) drop-down menu?

For example, think of a dc.js chart element that you can click on to filter a data set like any of the existing elements (pie, row, etc.) but instead of it being graphical, it's simply a text list of values as in:

<select multiple>
  <option> All
  <option> one
  <option> two
  ...
</select>

So instead of clicking on one or more bars in a bar chart to filter on those values of the dimension, you just click on or select text from a drop-down menu.  This would be useful for a set of filters across the top of a panel of other graphical (pie, line, bubble) charts.

Have you seen something like that?  We are thinking about trying to build one, but figured this would be a common option and thus likely already implemented.

Thanks.

Gordon Woodhull

unread,
Aug 18, 2014, 6:41:46 PM8/18/14
to Bradley Spatz, dc-js-us...@googlegroups.com
I don't think anyone has implemented a chart type for this, although there are plenty of forks and extensions out there I don't know about.

I recently answered an SO question on the subject, and indeed I've seen it come up a few times.


Definitely a PR would be welcome. It should be pretty easy to write!

Bradley Spatz

unread,
Aug 18, 2014, 6:52:18 PM8/18/14
to dc-js-us...@googlegroups.com, bradle...@gmail.com
And it wouldn't *have* to be a dc.js chart type (although that would be ideal), it could just be some Javascript with the requisite hooks to send/receive updates from other dc elements.

Gordon Woodhull

unread,
Aug 18, 2014, 7:35:44 PM8/18/14
to Bradley Spatz, dc-js-us...@googlegroups.com
Yeah, esp. since you probably don't need to redraw when other filters change. 

If you do (for instance to only show the options relevant to the currently filtered data), I (just) started to document adding an external chart to dc's registry here:


and on the attached SO answer.
Reply all
Reply to author
Forward
0 new messages