I have a SVG which can be zoomed and also a \"reset\" button. I\'m resetting the zoom with
zoom.transform(selection, d3.zoomIdentity)
This wor
This works as expected and resets the zoom on the SVG. But if I zoom again, it zooms back to the last state.
I have the same problem, after a quick research I discovered. You cant apply zoom and reset zoom to , you need to append
and apply zoom there.
svg.call(zoom.transform, d3.zoomIdentity.scale(1));
Changed to
zoom.transform(d3.select(chartContainer).select('svg.view'), d3.zoomIdentity.scale(1));
it works for me.