imacoder
imacoder

Reputation: 186

d3 v4 extent returns undefined?

var selectZoom = d3.brush().extent([[0, 0], [WIDTH, HEIGHT]])
                .on("brush",brush)
                .on("end", brushended);
 function brush(){
            var selection = d3.event.selection;
            console.log(selectZoom.extent()); // this prints function
            console.log(d3.extent(selectZoom)); // this prints [undefined,undefined]
        }

I am trying to set extent to d3.js v4 brush. I tried two ways to access the extent. But both did not work.

Please help.

Upvotes: 0

Views: 890

Answers (1)

imacoder
imacoder

Reputation: 186

console.log(selectZoom.extent().call()); 

Above statement worked for me.

Upvotes: 1

Related Questions