Skip to content
mbostock edited this page Jul 3, 2011 · 41 revisions

API ReferenceLayouts

A flexible force-directed graph layout implementation using position Verlet integration to allow simple constraints. For more on physical simulations, see Thomas Jakobsen. This implementation uses a quadtree to accelerate charge interaction using the Barnes–Hut approximation. In addition to the repulsive charge force, a psuedo-gravity force keeps nodes centered in the visible area. Links are fixed-distance geometric constraints.

force

Additional custom forces and constraints may be applied on the "tick" event, simply by updating the x and y attributes of nodes. For example, this can be used to implement multiple foci. The layout algorithm is also extremely robust in dealing with disconnected graphs.

# d3.layout.force()

# force.size([size])

# force.distance([distance])

# force.friction([friction])

# force.charge([charge])

# force.gravity([gravity])

# force.theta([theta])

# force.nodes([nodes])

# force.links([links])

# force.start()

# force.resume()

# force.stop()

# force.on(type, listener)

# force.drag()

Clone this wiki locally