Skip to content

Instantly share code, notes, and snippets.

View owendall's full-sized avatar

Owen Dall Sotomayor owendall

View GitHub Profile
@owendall
owendall / D3.js Force Layout Tutorial - Part 8 - 2016-07-21
Created July 22, 2016 20:38 — forked from sathomas/README.md
Understanding D3.js Force Layout - 8: gravity
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If you missed the beginning of the series, here's a link to
[first example](http://jsdatav.is/visuals.html?id=11550728).
The code in the previous examples has mentioned a property that D3 calls
_gravity._ The force layout uses this property to keep nodes from wandering
off the edges of the visualization, something they might otherwise do to
avoid overlap.
@owendall
owendall / D3.js Force Layout Tutorial - Part 6 - 2016-07-21
Last active July 22, 2016 20:37 — forked from sathomas/README.md
Understanding D3.js Force Layout - 6: charge (continued)
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If you missed the beginning of the series, here's a link to
[first example](http://jsdatav.is/visuals.html?id=11550728).
The [previous example](http://jsdatav.is/visuals.html?id=1ca23ee9588580d768aa)
shows how `charge` can influence the distance between connected nodes and
prevent the layout from achieving the desired `linkDistance`. That's not
the main purpose of the `charge` force, however. It exists mostly to
@owendall
owendall / D3.js Force Layout Tutorial - Part 5 - 2016-07-21
Created July 22, 2016 20:36 — forked from sathomas/README.md
Understanding D3.js Force Layout - 5: charge
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If you missed the beginning of the series, here's a link to
[first example](http://jsdatav.is/visuals.html?id=11550728).
The [previous example](http://jsdatav.is/visuals.html?id=83515b77c2764837aac2)
shows how `linkDistance` tells the force layout the desired distance
between connected nodes. It may seem strange that D3 doesn't simply
compel all links to be that distance. The force layout, however, takes
@owendall
owendall / D3.js Force Layout Tutorial - Part 4 - 2016-07-21
Created July 22, 2016 20:35 — forked from sathomas/README.md
Understanding D3.js Force Layout - 4: linkDistance
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If you missed the beginning of the series, here's a link to
[first example](http://jsdatav.is/visuals.html?id=11550728).
Earlier examples looked at the operation of force layout from a (very)
high level. This example begins examining the important properties of
the force layout in more detail.
@owendall
owendall / D3.js Force Layout Tutorial - Part 3 - 2016-07-21
Last active July 22, 2016 20:35 — forked from sathomas/README.md
Understanding D3.js Force Layout - 3: Seeing a Layout in Action
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If you missed the beginning of the series, here's a link to
[first example](http://jsdatav.is/visuals.html?id=11550728).
Before digging into the properties and options of the force layout, it's
helpful to understand how the layout works more generally. And although
there's some serious mathematics going on under the hood, the principle
is pretty simple: The layout moves the graph nodes around a little bit
@owendall
owendall / D3.js Force Layout Tutorial - Part 2 - 2016-07-21
Last active July 22, 2016 20:33 — forked from sathomas/README.md
Understanding D3.js Force Layout - 2: Simple to Complex with (almost) No Code Changes
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
If the [previous example](http://jsdatav.is/visuals.html?id=11550728) didn't look very
impressive, that's probably because it wasn't. Why bother to use a force layout
just to place two circles a specific distance apart? Here's the payoff, though.
With nearly the _exact same code_ we can see what a more complex graph looks like.
There are plenty of ways to improve this graph (most of which we'll cover in
@owendall
owendall / D3.js Force Layout Tutorial - Part 1 - 2016-07-21
Last active July 22, 2016 20:34 — forked from sathomas/README.md
Understanding D3.js Force Layout - 1: The Simplest Possible Graph
This is part of a series of examples that describe the basic operation of
the [D3.js](http://d3js.org) [force layout](https://github.com/mbostock/d3/wiki/Force-Layout).
Eventually they may end up in a blog post that wraps everything together.
The first example creates the simplest possible graph using a force layout.
The comments in the code walk through the steps in creating a force directed
graph.
Things start to get more interesting in the [next example](http://jsdatav.is/visuals.html?id=11560633).
@owendall
owendall / Labeled Force Layout with Images as Nodes - 2016-07-21
Last active July 22, 2016 20:18 — forked from mbostock/.block
Labeled Force Layout with Images as Nodes - 2016-07-21
license: gpl-3.0
@owendall
owendall / Interactive Node Creation - 2016-07-21
Last active July 22, 2016 20:19 — forked from vprtwn/README.md
Force Editor + Pan/Zoom
Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.
Built with [D3.js](http://mbostock.github.com/d3/).