All examples By author By category About

hydrosquall

Circles on an Axis in a Static Force Layout - d3 V5

Code sample to answer this stackoverflow question, on making a beeswarm plot in D3 v5 with variable radius.

Render circles along an axis based on the node's value in a tight formation.

This is a force layout rendered statically. Collisions are detected between circles (see Clustered Force Layout I). Custom gravity drives the circle towards their desired placement along the x-axis. A light preference is employed to center circles on the x-axis respective of their value. This creates a less tightly-packed layout, but the data is represented accurately.

forked from ericandrewlewis's block: Circles on an Axis in a Static Force Layout