I've got a regular time scale:
band.xScale = d3.time.scale()
.domain([data.minDate, data.maxDate])
That I want to modify with a zoom:
var zoom = d3.behavior.zoom()
.scaleExtent([1, 10])
.on("zoom", zoomed);
function zoomed() {
console.log(d3.event.scale);
var oldDomain = bands[0].xScale.domain();
var newDomain = ??? oldDomain * d3.event.scale ???
bands[0].xScale.domain(newDomain);
bands[0].redraw();
}
In other words, transform the [date1, date2] domain into a new array with new dates.
I could calculate the transformation myself, but I'd have to use something like Moment.js, and it really seems like the kind of thing d3 would have a built-in approach for...