novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.15k forks source link

lineWithFocusChart way to hook into 'brush' event? #1765

Open camatangelo opened 8 years ago

camatangelo commented 8 years ago

I'm using the lineWithFocusChart and I need to hook into the brush event (much like linePlusBarChart example), however it doesn't look like that's possible as the lineWithFocusChart doesn't dispatch that event, e.g...

chart.dispatch.on('brush', function(extent, brush) { console.log(extent, brush)})
d3.js:492 Uncaught TypeError: Cannot read property 'on' of undefined(…)

Any suggestions or work-arounds to connect to the interaction with focus area?

brylie commented 8 years ago

Issue #1788 describes an idea that may be useful here, that all NVD3 charts could be built with composable components. E.g. NVD3 would have a generic events handler that could be attached to any chart type, adding brushing support with ease.

The NVD3 architecture is currently somewhat component based, but the documentation may be lacking examples of how to compose custom chart types.

ghost commented 7 years ago

+1