d3.js - D3 - get selected Date range on brushend -


i new d3 , using brushing on grouped bar chart

http://fiddle.jshell.net/cjad3/21/

i trying range selected. listing "brushend" event , calling function brushend(). getting called returning me x-axis coordinates in numbers ([42, 318]). want in date dormat 'sat 25' 'mon 27'

thanks help.

this use invert method of x-scale. unfortunately, that method doesn't exist ordinal scales. luckily, jason davies, patch still around. don't messing source, adapted function:

function brushend() {     console.log("brushend");      var b = brush.empty() ? contextxscale.domain() : brush.extent();      console.log(b);     var d = mini_x0.domain(),       r = mini_x0.range(),       startdate = d[d3.bisect(r, b[0]) - 1],       findate = d[d3.bisect(r, b[1]) - 1];      console.log([startdate, findate]); } 

updated fiddle.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -