Is there a way to zoom into a D3 force layout graph?

Update 6/4/14 See also Mike Bostock’s answer here for changes in D3 v.3 and the related example. I think this probably supersedes the answer below. Update 2/18/2014 I think @ahaarnos’s answer is preferable if you want the entire SVG to pan and zoom. The nested g elements in my answer below are really only necessary … Read more

How do I remove all children elements from a node and then apply them again with different color and size?

Your answer will work, but for posterity, these methods are more generic. Remove all children from HTML: d3.select(“div.parent”).html(“”); Remove all children from SVG/HTML: d3.select(“g.parent”).selectAll(“*”).remove(); The .html(“”) call works with my SVG, but it might be a side effect of using innerSVG.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)