(To observe bug, make sure to open the block in its own window).
A pretty barebones, mostly unstyled block, used to demonstrate the zoom bug that occurs upon resize (as described here).
This chart is a timeline-style chart, with a time (continuous) scale for the x-axis and a band scale for the y-axis. The chart always fills the width of the window. The bug behaviour is described below:
We have a chart with a d3.scaleTime as the x-axis, and a d3.scaleBand as the y-axis. We only zoom and pan on the x-axis. When we zoom or pan the chart, there is a 1:1 movement with the mouse cursor. When the window is resized horizontally, the x-axis range is recalculated, so that the chart will shrink or expand to fill the space - however, this results in the zoom and panning having an offset (the mouse moves a longer or shorter distance than the chart, and the zoom will focus in on a point to the left or right of the mouse cursor).
The zoom should stay 1:1 with the mouse (move the same distance, zoom in on the mouse position) after window resize.
Built with blockbuilder.org
https://d3js.org/d3.v4.min.js