Skip to main content
100%

Force Layout - faster final arrangement

✓ Published0🌍 Public
KKcnarf
Last edited Dec 3, 2018
Created on Apr 15, 2016

This example demonstrates a D3 v3 force layout arranging 150 French word stems from a CSV file based on their trend values. It shows the final clustered arrangement of nodes without displaying the live simulation, using `d3.layout.force` with explicit `force.tick()` calls to compute positions quickly. Nodes are constrained on the x-axis and then transitioned to their computed y-coordinates. SVG circles are colored by rank, with a tooltip showing stem, rank, and trend on hover.

AI-generated description

In a <a href='http://bl.ocks.org/Kcnarf/91c5e84bed1ba6b1541deaa5d5f4f258'>previous block</a>, I was not interesting in viewing the live arrangement of the Force Layout, because (even if it is beautifull and amazing) it takes some times to have the final arrangement.

Hence, this <a href='http://bl.ocks.org/Kcnarf/6a0b4488bc60ea61eb887bf4d1f9b2b5'>block</a> (hummm ... the last lines of the code of this block) explains :

  • how you can use the D3's Force Layout to compute the final arrangement,
  • how you can omit the live arrangement, and display only the final arrangement
  • having all these things in less time that it takes to write it

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>
  • This <a href='http://bl.ocks.org/Kcnarf/6a0b4488bc60ea61eb887bf4d1f9b2b5'>block</a> is a continuation of a <a href='http://bl.ocks.org/Kcnarf/91c5e84bed1ba6b1541deaa5d5f4f258'>previous one</a>
mit Licensed

Similar vizzes