Built with blockbuilder.org
Say your dataset is an array of numbers, and includes both positive and negative values. Use two scales to construct the bar chart: a quantitative scale (such as a [linear scale][1]) to compute the bar positions along the x-axis, and an [ordinal scale][2] with rangeBands to compute the bar positions along the y-axis.
For the quantitative scale, compute the data domain (the minimum and maximum value) using [d3.extent][3]:
var x = d3.scale.linear()
.domain(d3.extent(data, function(d) { return d.value; }))
.range([0, width]);
[Nicing][4] the scale will extend the extent slightly to the nearest round numbers. If you want the zero-value to be centered in the middle of the canvas, take the greater of the minimum and maximum value by magnitude, or simply hard-code the desired domain.
Inspiration from Mike Bostock's chord diagram examples and others. Also the API reference layout for the chord layout.
forked from SkiWether's block: Chord diagram showing co-occurrences.
forked from anonymous's block: Chord diagram showing co-occurrences.