# 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`
to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 21, 2012
1. elosito authored
`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.`
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
1. +2 −2 src/layout/chord.js
4 src/layout/chord.js
 @@ -26,7 +26,7 @@ d3.layout.chord = function() { // Compute the sum. k = 0, i = -1; while (++i < n) { x = 0, j = -1; while (++j < n) { - x += matrix[i][j]; + x += Math.abs(matrix[i][j]); } groupSums.push(x); subgroupIndex.push(d3.range(n)); @@ -62,7 +62,7 @@ d3.layout.chord = function() { dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, - a1 = x += v * k; + a1 = x += Math.abs(v) * k; subgroups[di + "-" + dj] = { index: di, subindex: dj,
Something went wrong with that request. Please try again.