Skip to content

Instantly share code, notes, and snippets.

@allisonking
allisonking / README.md
Last active September 10, 2017 03:39
Saving off points from a force directed graph

This is part one of a way to use d3.js's force directed graph to create a customized static layout. Part 2 is here. The simulation first distributes all of the nodes and links according to forces and charges. Then, you can drag the nodes around to where you would want them to be in a final static image. You can also drag the purple 'intermediate' nodes around in order to specify the control points for the Bezier curve of the links.

This was largely inspired by Mike Bostock's post on his process for making the NYT Oscar Contenders graph which also uses an adjusted force directed graph layout with Bezier control points.

Once you are happy with the way your graph looks, you can click the 'print' button and a JSON object will be printed to your console. This is a quick and very dirty way to get t