frankenapps frankenapps - 10 days ago 8
HTML Question

How to set the zoom factor in D3.js v.4.x?

I have a svg where I have implemented zooming via D3.js.
I am not satisfied with the zoom factor when using the mousewheel.
How can I adjust the zoom factor?

I made a JSfiddle with an example of how I implemeted the zooming.

I thought I need something like this but it is wrong:

zoom.scaleBy()


I am trying to make my problem a bit clearer:

I want to set a factor, that acts as the zoom factor for one mousewheel revolution.
Illustration with pictures:

The SVG without zoom:
Normal SVG

After one mousewheel revolution:
After one mousewheel revolution.

What I would like to have after one mousewhell revolution:
But I want some steps in between (like that)

I know how this worked in older versions of D3.js but can someone help me with the current version?

Answer

I did find this issue on github. So it seems they are working on it.

Comments