javascript - Update axis on zoom with d3 -


i have chart zoom\pan functionality per mark bostock's example however, whilst chart rescaling, x axis not.

i'm trying trigger redraw so:

var viewport = d3.svg.brush()     .x(xscale)     .on('brush', function () {         var newdomain = viewport.empty() ? xscale.domain() : viewport.extent();         console.log(json.stringify(newdomain, null, 2));          detailschart.setxdomain(newdomain);         detailschart.renderaxis();         detailschart.renderseries();     }); 

the renderaxis looks this:

function () {             xaxis.scale(xscale);             all.select('x.axis')                 .call(xaxis);         } 

i have fiddle here showing it.


Comments