Skip to content

Instantly share code, notes, and snippets.

@1wheel
1wheel / README.md
Last active December 17, 2015 20:09 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

@1wheel
1wheel / README.md
Last active December 18, 2015 11:38 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

@1wheel
1wheel / README.md
Created June 26, 2013 05:39 — forked from mbostock/.block
@1wheel
1wheel / README.md
Created August 20, 2013 18:57 — forked from mbostock/.block
@1wheel
1wheel / README.md
Last active December 21, 2015 09:29 — forked from mbostock/.block
@1wheel
1wheel / README.md
Last active December 22, 2015 03:59 — forked from mbostock/.block

An example of d3.behavior.zoom and d3.geo.path. By modifying the transform, the browser can rapidly redraw geographic features while panning and zooming, without the overhead of reprojection. This technique can be extended by combining with d3.geo.tile.

@1wheel
1wheel / README.md
Last active December 22, 2015 12:19 — forked from mbostock/.block
@1wheel
1wheel / README.md
Last active December 23, 2015 02:39 — forked from mbostock/.block

Created for http://stackoverflow.com/questions/18809020/accessing-properties-of-objects-in-d3-histogram-bins

This chart shows a histogram of an Irwin–Hall distribution. The data is randomly generated. The values are then binned at regular intervals using D3’s histogram layout. The x-axis uses a linear scale, such that the tick values appear between bars; this provides better indication that each bar represents the count of values between its surrounding tick values.

See also this histogram of a log-normal distribution of time durations.

@1wheel
1wheel / README.md
Created November 6, 2013 04:14 — forked from mbostock/.block

By adding transitions, we can more easily follow the elements as they are entered, updated and exited. Separate transitions are defined for each of the three states.

Note that no transition is applied to the merged enter + update selection; this is because it would supersede the transition already scheduled on entering and updating elements. It's possible to schedule concurrent elements by using transition.transition or by setting transition.id, but it's simpler here to only transition the x-position on update; for entering elements, the x-position is assigned statically.

Want to read more? Try these tutorials: