Thanks Mike, that is useful.
In my real case I have to be able to zoom in from the initial state to
get details on the view (ie, the minimum scale can't be 1) and my min
and max coordinates are not the same as the initial state (for example,
in the initial state I have coordinates [100,500] but want to limit
panning/zooming to [0,1000] -- all in user coordinates).
Is there a way to achieve this? Any example I can take a look at?
Thanks again,
M;
On 06/04/2017 18:15, Mike Bostock wrote:
> This seems to work:
>
> d3.zoom()
> .scaleExtent([1, 2])
> .translateExtent([[0, 0], [svg_dx, svg_dy]])
> .on("zoom", zoom)
>
> You could instead set the /zoom/.extent
> <
https://github.com/d3/d3-zoom/blob/master/README.md#zoom_extent> to the
> inner chart area rather than covering the entire SVG element, which is
> the default behavior. (The zoom behavior doesn’t know anything about the
> margins of your chart—it just knows you want a zoomable element.) Then,
> set the /zoom/.translateExtent to the same value:
> <mailto:
d3-js+un...@googlegroups.com>.
> --
> You received this message because you are subscribed to the Google
> Groups "d3-js" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
d3-js+un...@googlegroups.com
> <mailto:
d3-js+un...@googlegroups.com>.