Skip to content

Instantly share code, notes, and snippets.

@bcrisp
bcrisp / .block
Last active April 5, 2017 02:58 — forked from mbostock/.block
Force-Directed Lattice
license: gpl-3.0
height: 960
@bcrisp
bcrisp / .block
Created January 26, 2017 22:50 — forked from mbostock/.block
Mobile Patent Suits
license: gpl-3.0
@bcrisp
bcrisp / .block
Last active August 25, 2016 23:00 — forked from mbostock/.block
Blocks Graph
license: gpl-3.0
height: 960
@bcrisp
bcrisp / README.md
Last active August 29, 2015 14:16 — forked from mbostock/.block

This D3 example shows how to constrain the position of nodes within the rectangular bounds of the containing SVG element. As a side-effect of updating the node's "cx" and "cy" attributes, we update the node positions to be within the range [radius, width - radius] for x, [radius, height - radius] for y. If you prefer, you could use the each operator to do this as a separate step, rather than as a side-effect of setting attributes.