I am using d3.js, and I\'m working on a brushed area chart by modifying this example. In addition to the x-axis changing based on the brush, I\'d like chart\'s y-axis to be redr
A shorter possibility would be to use d3.scale.invert() on your brush.extent()
like so:
var domainExtent = brush.extent().map(function(d){return scale.invert(d);});
var filteredData = data.filter(function(d){return ((d <= domainExtent[1]) && (d >= domainExtent[0]));});
However, by now d3 has gained d3.brushX(), which only allows brushing in East/West direction by design.