mbostock/d3 — pull request #617 by dcporter (2012-04-17 15:15:15+00:00)
Title: Added ability to specify chords with explicit relationships instead of a matrix.

Hi,

I wanted the ability to specify chord data with a simple

{
source: 0,
target: 2,
value: 45,372
}

kind of relationship object. This also allows explicit declaration of which is the source and which is the target. (When using a matrix, whichever number is first, or larger, wins.)

I added two new methods to d3.layout.chord:

.relationships(x)
- gets or sets the relationships array.

.addRelationship(sourceIndex, targetIndex, value)
- pushes an individual relationship onto the relationships array.

I then added code to that closure's relayout() function to use the relationships array to populate the chords and groups arrays.

I've got a sample reworking of the hair-color example chord with the correct dominant hair color highlighted. I'm having git issues though, and am unable to push the new files. Happy to send them offline on request.

Feedback is of course appreciated.

Cheers,
Dave