I’m using d3 to highlight various countries, and have managed to create a bounding box based on the Bottom Left, Top Left, Bottom Right and Top Right most countries.
So far so good, however I’m unable to find out how to ‘zoom in’ to that bounding box.
I appreciate that while my SVG element is about 800×400 in pixels, the ratio of the bounding box won’t always conform to that SVG element, but in the very least, I’d like to be able to somehow zoom in.
Has anyone any examples on how to achieve this?
Have a look at this example. It restricts the zooming in such that small countries are not magnified too much, but should be easy enough to change if you don’t want that.
This question may also be of help.