how to set d3.brush extent right?

I am writing a d3 widget based on Mike Bostocks example So I am trying to set brush extent with predefined dates, but the extent rectangle is not applied to those dates.

var brush = d3.svg.brush()
            .extent([new Date("May 2001"), new Date("May 2002")])
            .on('brush', brushed);


the entire code here



As I understood, you want to set initially the date period. You'll need to call brush component with desired extent.

        brush.extent([new Date("May 2001"), new Date("May 2002")]);'.brush').call(brush);

Working code is here


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.