I have several rectangles with text inside on linear axes. Previously, I was able to zoom on the x-axis only and maintain a fixed height rectangle . I have tried the following but it doesn't stop the rectangle increasing on zoom:
gx.call(xAxis.scale(d3.event.transform.rescaleX(x)));
gy.call(yAxis;
gMain.attr("transform", d3.event.transform);
Is there a way in v4 to zoom only the width (x-axis)?
My second issue is that I've added rectangles with text inside a 'g' element and then call zoom on a clear rectangle appended to the svg, like this:
svg.append("rect")
.attr("class", "zoom")
.attr("width", width)
.attr("height", height)
.call(d3.zoom()
.scaleExtent([1, 40])
.translateExtent([[-100, -100], [width + 90, height + 100]])
.on("zoom", zoomed));
But now I can't click on a rectangle and drag it. Is there a way in version 4 to zoom and pan from the space around the rectangles and still have a click function on each rectangle?