# public mbostock /d3

### Subversion checkout URL

You can clone with HTTPS or Subversion.

# Update chord.js to support negative matrix values#818

Open
wants to merge 1 commit into from
 +2 2

### 1 participant

The chord layout currently does not support negative values in input matrices; this commit provides support for negative values by making the chord group's angle dependent on the sum of the absolute value of all matrix input values in a group.

 elosito `Update chord.js to submit negative matrix values` `The chord layout currently does not support negative values in input matrices; this commit provides support for negative values by making the chord group's angle dependent on the sum of the absolute value of all matrix input values in a group.` `1720483`

Showing 1 unique commit by 1 author.

Sep 21, 2012
`Update chord.js to submit negative matrix values`
`The chord layout currently does not support negative values in input matrices; this commit provides support for negative values by making the chord group's angle dependent on the sum of the absolute value of all matrix input values in a group.`
`1720483`
 `@@ -26,7 +26,7 @@ d3.layout.chord = function() {` 26 26 ` // Compute the sum.` 27 27 ` k = 0, i = -1; while (++i < n) {` 28 28 ` x = 0, j = -1; while (++j < n) {` 29 `- x += matrix[i][j];` 29 `+ x += Math.abs(matrix[i][j]);` 30 30 ` }` 31 31 ` groupSums.push(x);` 32 32 ` subgroupIndex.push(d3.range(n));` `@@ -62,7 +62,7 @@ d3.layout.chord = function() {` 62 62 ` dj = subgroupIndex[di][j],` 63 63 ` v = matrix[di][dj],` 64 64 ` a0 = x,` 65 `- a1 = x += v * k;` 65 `+ a1 = x += Math.abs(v) * k;` 66 66 ` subgroups[di + "-" + dj] = {` 67 67 ` index: di,` 68 68 ` subindex: dj,`