I'm trying to achieve the effect of rescaling the d3fc cartesian chart when the user drags along the axes.
https://codepen.io/parliament718/pen/BaNQPXx
This is in d3v5, and I'm using d3-zoom to re-scale the axes using d3.event.transform. However, in d3-drag there is no d3.event.transform so I don't understand what the equivelant logic would be using just the mouse coordinates that d3-drag provides.
const zoom = d3.zoom()
.on('zoom', () => {
const t = d3.event.transform;
x.domain(t.rescaleX(x2).domain());
y.domain(t.rescaleY(y2).domain());
render();
});
plot.call(zoom);
//What is the equivelant drag action to rescale?
const yAxisDrag = d3.drag()
.on('end', (args) => {
var t = d3.zoomTransform(plot.node());
//zoom.translateBy(plot,d3.event.dx/t.k,d3.event.dy/t.k);
//How can I use zoom.scaleBy() here instead?
});