I'm trying to center my d3 graph when it loads. So I run
var g = svg.append("g");
//... then later
g.call(zoom.transform, center);
It's not actually centering, it's just scaling right now. But the scale works. The problem is, when I then scroll to zoom in or out, it starts from 1
instead of 0.5
. So it jumps.
Here's my jsbin.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…