I have a <svg> whose width is 100% of this container. When the container size changes, I update the linear xScale.range() to represent the new modified width of the <svg> . Apparently, I need to apply the range again to my zoom, as described in zoom.x () :
If the scale domain or range is changed programmatically, this function must be called again. Setting x-scale also resets the scale to 1 and translates to [0, 0].
Resetting scale and translate happens where I have a problem. If I previously zoomed in before resizing, I call zoom.x( xScale ) , and now d3 considers the chart scale to be 1 and the translation to 0.0, so I cannot zoom out or pan.
Is my approach to how I handle size incorrectly?
source share