Navigate and Zoom around graph
This example demonstrates an interactive graph visualization that users can navigate by panning across the background, zooming with the mousewheel, and dragging individual nodes. A force-directed layout, powered by `d3.layout.force`, positions and animates the nodes and links, with SVG rendering for all elements. Middle-clicking on the background adds new nodes at the cursor’s location, while buttons freeze, thaw, or fit the entire graph to the viewport. The zoom behavior uses `d3.behavior.zoom`, and the fit function computes the graph’s bounding box via `getBBox` to adjust the view transform.
AI-generated descriptionSee SO answer.
You can pan (click background), zoom (mousewheel), drag nodes around. Middle click to add more nodes (at mouse).
forked from <a href='http://bl.ocks.org/TWiStErRob/'>TWiStErRob</a>'s block: <a href='http://bl.ocks.org/TWiStErRob/b1c62730e01fe33baa2dea0d0aa29359'>Zoom to fit</a>