ForceLayout - maintain x-position of nodes
This example visualizes the distribution of 150 French word stems along the x-axis based on a trend value, with each circle’s horizontal position fixed while vertical positions resolve through force simulation. The D3.js v3 force layout uses custom constraints to lock each node’s x-coordinate, allowing circles to stack vertically for easier hover inspection. Tooltips display the stem, rank, and trend value on mouseover, with a data-gui control to quadruple the number of points. The chart renders as animated SVG, reusing bounded-force techniques from mbostock and bjtucker.
AI-generated descriptionThis <a href='http://bl.ocks.org/Kcnarf/91c5e84bed1ba6b1541deaa5d5f4f258'>block</a> experiments a way to vizualise the distribution of things (whatever it is) in a horizontal way (ie. along the x-axis), where constraints/objectives are:
- to maintain the exact position of each datum (represented by a circle) along the x-axis
- to be able to hover each circle to show related datum
This block uses the d3's Force Layout to achieve these objectives. I re-use the technics illustrated in <a href='http://bl.ocks.org/mbostock/1129492'>mbostock's block</a> in and later by <a href='http://bl.ocks.org/bjtucker/151f6344ffd02105a67a'>bjtucker's block</a>, in order to constrain each circle's x-position while allowing vertical accumulation/aggregation of circles.
Acknowledgments to:
- <a href='https://d3js.org/'>D3.js</a> (v3.5.5)
- <a href='http://blockbuilder.org'>blockbuilder.org</a>
- <a href='http://workshop.chromeexperiments.com/'>dat.gui</a>
- <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/1129492'>Bounded Force Layout</a>
- <a href='http://bl.ocks.org/bjtucker/'>bjtucker</a>'s block: <a href='http://bl.ocks.org/bjtucker/151f6344ffd02105a67a'>Bounded Force Layout - force rank by group</a>