dc.js icon indicating copy to clipboard operation
dc.js copied to clipboard

Get value of selected brush

Open pdaems opened this issue 13 years ago • 5 comments

Is their a quick way to get the value of the selected brush in a barChart.

I would need the startDate & EndDate of the brush that the user selects.

pdaems avatar Apr 24 '13 10:04 pdaems

Posted a bit to early found the solution in the code volumeChart.brush().extent();

pdaems avatar Apr 24 '13 11:04 pdaems

Cool, and yes, chart.brush() returns you a d3 brush which has all the functions from d3 brush available.

NickQiZhu avatar Apr 24 '13 15:04 NickQiZhu

Is this feature not supported anymore? if I try to grab it via brush() on dc.barChart. I keep on getting "chart1.brush is not a function". There is also no documentation about this in the dc.js api.

marctiedemann avatar Sep 15 '15 09:09 marctiedemann

Hi @marctiedemann. It's definitely still supported: https://github.com/dc-js/dc.js/blob/develop/src/coordinate-grid-mixin.js#L941

I don't know why it's undocumented.

Perhaps you've accidentally saved a reference to something that is not a chart, for example by manipulating an axis at the end of your chart initialization? (See "Why does everything break after a call to .xAxis or .yAxis??" in the FAQ.)

gordonwoodhull avatar Sep 15 '15 10:09 gordonwoodhull

Ah yes, thanx I was missing that!

marctiedemann avatar Sep 15 '15 16:09 marctiedemann