Skip to content

Instantly share code, notes, and snippets.

@DavidChouinard
DavidChouinard / .block
Last active July 27, 2016 21:26 — forked from mbostock/.block
Modifying a Force Layout on D3 v4
license: gpl-3.0
@DavidChouinard
DavidChouinard / README.md
Last active August 29, 2015 14:15 — forked from mbostock/.block
Multi-Foci Force Layout

Click to perturb or drag the nodes!

This example demonstrates the flexibility of D3's force layout. By using position Verlet integration, it is easy to add custom forces to a layout. In this example, the nodes are clustered around four foci using additional forces: the odd nodes are pushed down, the even nodes are pushed up, and a similar bisecting force is applied laterally. These custom forces are based purely on the index of the node, but they could just as easily be derived from properties of data!

Based on this, edited for clarity

@DavidChouinard
DavidChouinard / README.md
Last active August 29, 2015 14:13 — forked from mbostock/.block

This donut chart is constructed from a CSV file storing the populations of various age groups. The chart employs a number of D3 features: