문제

Im trying to get the value of the brush in a d3.js chart.

_chart.brush().value; 

I just want to get the value of the range of the brush when you select a range in the chart.

도움이 되었습니까?

해결책

I think you might be looking for

brush.extent()

Note that a brush is associated with x- and y- scales and these determine what the extent call returns.

Typically you use a brush with a quantitative scale which means the extent should give you a value from the scale's domain (data space) but if you use an ordinal scale then the extent will return values form the scale's range (pixel space).

The other thing to note is that you can get a simple range back if the brush only has one scale associated (x or y) but will give you a 2-d matrix if you've set both scales.

Have a look here for details.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top