Skip to content

Releases: d3/d3-force

v1.0.6

10 Mar 18:05
Compare
Choose a tag to compare
  • Update dependencies.

v1.0.5

28 Feb 17:30
Compare
Choose a tag to compare
  • Update dependencies.

v1.0.4

23 Nov 00:33
Compare
Choose a tag to compare
  • Allow forces to be isolated to a subset of nodes (#72).

v1.0.3

07 Oct 16:17
Compare
Choose a tag to compare
  • Fix bug where calling collide.radius had no effect. (#63)
  • Improve error message when link references unknown nodes. (#62)

v1.0.2

02 Aug 21:47
Compare
Choose a tag to compare
  • Add module entry point to package.json.

v1.0.1

29 Jul 22:45
Compare
Choose a tag to compare
  • Edit the README.

v1.0.0

24 Jun 17:45
Compare
Choose a tag to compare

Changes since D3 3.x

The force layout d3.layout.force has been renamed to d3.forceSimulation. The force simulation now uses velocity Verlet integration rather than position Verlet, tracking the nodes’ positions (node.x, node.y) and velocities (node.vx, node.vy) rather than their previous positions (node.px, node.py).

Rather than hard-coding a set of built-in forces, the force simulation is now extensible: you specify which forces you want! The approach affords greater flexibility through composition. The new forces are more flexible, too: force parameters can typically be configured per-node or per-link. There are separate positioning forces for x and y that replace force.gravity; x.x and y.y replace force.size. The new link force replaces force.linkStrength and employs better default heuristics to improve stability. The new many-body force replaces force.charge and supports a new minimum-distance parameter and performance improvements thanks to 4.0’s new quadtrees. There are also brand-new forces for centering nodes and collision resolution.

The new forces and simulation have been carefully crafted to avoid nondeterminism. Rather than initializing nodes randomly, if the nodes do not have preset positions, they are placed in a phyllotaxis pattern:

Phyllotaxis

Random jitter is still needed to resolve link, collision and many-body forces if there are coincident nodes, but at least in the common case, the force simulation (and the resulting force-directed graph layout) is now consistent across browsers and reloads. D3 no longer plays dice!

The force simulation has several new methods for greater control over heating, such as simulation.alphaMin and simulation.alphaDecay, and the internal timer. Calling simulation.alpha now has no effect on the internal timer, which is controlled independently via simulation.stop and simulation.restart. The force layout’s internal timer now starts automatically on creation, removing force.start. As in 3.x, you can advance the simulation manually using simulation.tick. The force.friction parameter is replaced by simulation.velocityDecay. A new simulation.alphaTarget method allows you to set the desired alpha (temperature) of the simulation, such that the simulation can be smoothly reheated during interaction, and then smoothly cooled again. This improves the stability of the graph during interaction.

The force layout no longer depends on the drag behavior, though you can certainly create draggable force-directed graphs! Set node.fx and node.fy to fix a node’s position. As an alternative to a Voronoi SVG overlay, you can now use simulation.find to find the closest node to a pointer.

See CHANGES for all D3 changes since 3.x.

v0.7.1

19 Jun 16:21
Compare
Choose a tag to compare
  • Update dependencies.

v0.7.0

08 Jun 03:54
Compare
Choose a tag to compare

v0.6.3

20 May 21:22
Compare
Choose a tag to compare