Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-chord/ Version 1.0.2. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-chord/ Version 1.0.3. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
@@ -6,226 +6,226 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-path')) : | ||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3)); | ||
}(this, function (exports,d3Array,d3Path) { 'use strict'; | ||
}(this, (function (exports,d3Array,d3Path) { 'use strict'; | ||
var cos = Math.cos; | ||
var sin = Math.sin; | ||
var pi = Math.PI; | ||
var halfPi = pi / 2; | ||
var tau = pi * 2; | ||
var max = Math.max; | ||
var cos = Math.cos; | ||
var sin = Math.sin; | ||
var pi = Math.PI; | ||
var halfPi = pi / 2; | ||
var tau = pi * 2; | ||
var max = Math.max; | ||
function compareValue(compare) { | ||
return function(a, b) { | ||
return compare( | ||
a.source.value + a.target.value, | ||
b.source.value + b.target.value | ||
); | ||
}; | ||
} | ||
function compareValue(compare) { | ||
return function(a, b) { | ||
return compare( | ||
a.source.value + a.target.value, | ||
b.source.value + b.target.value | ||
); | ||
}; | ||
} | ||
function chord() { | ||
var padAngle = 0, | ||
sortGroups = null, | ||
sortSubgroups = null, | ||
sortChords = null; | ||
var chord = function() { | ||
var padAngle = 0, | ||
sortGroups = null, | ||
sortSubgroups = null, | ||
sortChords = null; | ||
function chord(matrix) { | ||
var n = matrix.length, | ||
groupSums = [], | ||
groupIndex = d3Array.range(n), | ||
subgroupIndex = [], | ||
chords = [], | ||
groups = chords.groups = new Array(n), | ||
subgroups = new Array(n * n), | ||
k, | ||
x, | ||
x0, | ||
dx, | ||
i, | ||
j; | ||
function chord(matrix) { | ||
var n = matrix.length, | ||
groupSums = [], | ||
groupIndex = d3Array.range(n), | ||
subgroupIndex = [], | ||
chords = [], | ||
groups = chords.groups = new Array(n), | ||
subgroups = new Array(n * n), | ||
k, | ||
x, | ||
x0, | ||
dx, | ||
i, | ||
j; | ||
// Compute the sum. | ||
k = 0, i = -1; while (++i < n) { | ||
x = 0, j = -1; while (++j < n) { | ||
x += matrix[i][j]; | ||
} | ||
groupSums.push(x); | ||
subgroupIndex.push(d3Array.range(n)); | ||
k += x; | ||
// Compute the sum. | ||
k = 0, i = -1; while (++i < n) { | ||
x = 0, j = -1; while (++j < n) { | ||
x += matrix[i][j]; | ||
} | ||
groupSums.push(x); | ||
subgroupIndex.push(d3Array.range(n)); | ||
k += x; | ||
} | ||
// Sort groups… | ||
if (sortGroups) groupIndex.sort(function(a, b) { | ||
return sortGroups(groupSums[a], groupSums[b]); | ||
}); | ||
// Sort groups… | ||
if (sortGroups) groupIndex.sort(function(a, b) { | ||
return sortGroups(groupSums[a], groupSums[b]); | ||
}); | ||
// Sort subgroups… | ||
if (sortSubgroups) subgroupIndex.forEach(function(d, i) { | ||
d.sort(function(a, b) { | ||
return sortSubgroups(matrix[i][a], matrix[i][b]); | ||
}); | ||
// Sort subgroups… | ||
if (sortSubgroups) subgroupIndex.forEach(function(d, i) { | ||
d.sort(function(a, b) { | ||
return sortSubgroups(matrix[i][a], matrix[i][b]); | ||
}); | ||
}); | ||
// Convert the sum to scaling factor for [0, 2pi]. | ||
// TODO Allow start and end angle to be specified? | ||
// TODO Allow padding to be specified as percentage? | ||
k = max(0, tau - padAngle * n) / k; | ||
dx = k ? padAngle : tau / n; | ||
// Convert the sum to scaling factor for [0, 2pi]. | ||
// TODO Allow start and end angle to be specified? | ||
// TODO Allow padding to be specified as percentage? | ||
k = max(0, tau - padAngle * n) / k; | ||
dx = k ? padAngle : tau / n; | ||
// Compute the start and end angle for each group and subgroup. | ||
// Note: Opera has a bug reordering object literal properties! | ||
x = 0, i = -1; while (++i < n) { | ||
x0 = x, j = -1; while (++j < n) { | ||
var di = groupIndex[i], | ||
dj = subgroupIndex[di][j], | ||
v = matrix[di][dj], | ||
a0 = x, | ||
a1 = x += v * k; | ||
subgroups[dj * n + di] = { | ||
index: di, | ||
subindex: dj, | ||
startAngle: a0, | ||
endAngle: a1, | ||
value: v | ||
}; | ||
} | ||
groups[di] = { | ||
// Compute the start and end angle for each group and subgroup. | ||
// Note: Opera has a bug reordering object literal properties! | ||
x = 0, i = -1; while (++i < n) { | ||
x0 = x, j = -1; while (++j < n) { | ||
var di = groupIndex[i], | ||
dj = subgroupIndex[di][j], | ||
v = matrix[di][dj], | ||
a0 = x, | ||
a1 = x += v * k; | ||
subgroups[dj * n + di] = { | ||
index: di, | ||
startAngle: x0, | ||
endAngle: x, | ||
value: groupSums[di] | ||
subindex: dj, | ||
startAngle: a0, | ||
endAngle: a1, | ||
value: v | ||
}; | ||
x += dx; | ||
} | ||
groups[di] = { | ||
index: di, | ||
startAngle: x0, | ||
endAngle: x, | ||
value: groupSums[di] | ||
}; | ||
x += dx; | ||
} | ||
// Generate chords for each (non-empty) subgroup-subgroup link. | ||
i = -1; while (++i < n) { | ||
j = i - 1; while (++j < n) { | ||
var source = subgroups[j * n + i], | ||
target = subgroups[i * n + j]; | ||
if (source.value || target.value) { | ||
chords.push(source.value < target.value | ||
? {source: target, target: source} | ||
: {source: source, target: target}); | ||
} | ||
// Generate chords for each (non-empty) subgroup-subgroup link. | ||
i = -1; while (++i < n) { | ||
j = i - 1; while (++j < n) { | ||
var source = subgroups[j * n + i], | ||
target = subgroups[i * n + j]; | ||
if (source.value || target.value) { | ||
chords.push(source.value < target.value | ||
? {source: target, target: source} | ||
: {source: source, target: target}); | ||
} | ||
} | ||
return sortChords ? chords.sort(sortChords) : chords; | ||
} | ||
chord.padAngle = function(_) { | ||
return arguments.length ? (padAngle = max(0, _), chord) : padAngle; | ||
}; | ||
return sortChords ? chords.sort(sortChords) : chords; | ||
} | ||
chord.sortGroups = function(_) { | ||
return arguments.length ? (sortGroups = _, chord) : sortGroups; | ||
}; | ||
chord.padAngle = function(_) { | ||
return arguments.length ? (padAngle = max(0, _), chord) : padAngle; | ||
}; | ||
chord.sortSubgroups = function(_) { | ||
return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups; | ||
}; | ||
chord.sortGroups = function(_) { | ||
return arguments.length ? (sortGroups = _, chord) : sortGroups; | ||
}; | ||
chord.sortChords = function(_) { | ||
return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._; | ||
}; | ||
chord.sortSubgroups = function(_) { | ||
return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups; | ||
}; | ||
return chord; | ||
} | ||
chord.sortChords = function(_) { | ||
return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._; | ||
}; | ||
var slice = Array.prototype.slice; | ||
return chord; | ||
}; | ||
function constant(x) { | ||
return function() { | ||
return x; | ||
}; | ||
} | ||
var slice = Array.prototype.slice; | ||
function defaultSource(d) { | ||
return d.source; | ||
} | ||
var constant = function(x) { | ||
return function() { | ||
return x; | ||
}; | ||
}; | ||
function defaultTarget(d) { | ||
return d.target; | ||
} | ||
function defaultSource(d) { | ||
return d.source; | ||
} | ||
function defaultRadius(d) { | ||
return d.radius; | ||
} | ||
function defaultTarget(d) { | ||
return d.target; | ||
} | ||
function defaultStartAngle(d) { | ||
return d.startAngle; | ||
} | ||
function defaultRadius(d) { | ||
return d.radius; | ||
} | ||
function defaultEndAngle(d) { | ||
return d.endAngle; | ||
} | ||
function defaultStartAngle(d) { | ||
return d.startAngle; | ||
} | ||
function ribbon() { | ||
var source = defaultSource, | ||
target = defaultTarget, | ||
radius = defaultRadius, | ||
startAngle = defaultStartAngle, | ||
endAngle = defaultEndAngle, | ||
context = null; | ||
function defaultEndAngle(d) { | ||
return d.endAngle; | ||
} | ||
function ribbon() { | ||
var buffer, | ||
argv = slice.call(arguments), | ||
s = source.apply(this, argv), | ||
t = target.apply(this, argv), | ||
sr = +radius.apply(this, (argv[0] = s, argv)), | ||
sa0 = startAngle.apply(this, argv) - halfPi, | ||
sa1 = endAngle.apply(this, argv) - halfPi, | ||
sx0 = sr * cos(sa0), | ||
sy0 = sr * sin(sa0), | ||
tr = +radius.apply(this, (argv[0] = t, argv)), | ||
ta0 = startAngle.apply(this, argv) - halfPi, | ||
ta1 = endAngle.apply(this, argv) - halfPi; | ||
var ribbon = function() { | ||
var source = defaultSource, | ||
target = defaultTarget, | ||
radius = defaultRadius, | ||
startAngle = defaultStartAngle, | ||
endAngle = defaultEndAngle, | ||
context = null; | ||
if (!context) context = buffer = d3Path.path(); | ||
function ribbon() { | ||
var buffer, | ||
argv = slice.call(arguments), | ||
s = source.apply(this, argv), | ||
t = target.apply(this, argv), | ||
sr = +radius.apply(this, (argv[0] = s, argv)), | ||
sa0 = startAngle.apply(this, argv) - halfPi, | ||
sa1 = endAngle.apply(this, argv) - halfPi, | ||
sx0 = sr * cos(sa0), | ||
sy0 = sr * sin(sa0), | ||
tr = +radius.apply(this, (argv[0] = t, argv)), | ||
ta0 = startAngle.apply(this, argv) - halfPi, | ||
ta1 = endAngle.apply(this, argv) - halfPi; | ||
context.moveTo(sx0, sy0); | ||
context.arc(0, 0, sr, sa0, sa1); | ||
if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr? | ||
context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)); | ||
context.arc(0, 0, tr, ta0, ta1); | ||
} | ||
context.quadraticCurveTo(0, 0, sx0, sy0); | ||
context.closePath(); | ||
if (!context) context = buffer = d3Path.path(); | ||
if (buffer) return context = null, buffer + "" || null; | ||
context.moveTo(sx0, sy0); | ||
context.arc(0, 0, sr, sa0, sa1); | ||
if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr? | ||
context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)); | ||
context.arc(0, 0, tr, ta0, ta1); | ||
} | ||
context.quadraticCurveTo(0, 0, sx0, sy0); | ||
context.closePath(); | ||
ribbon.radius = function(_) { | ||
return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), ribbon) : radius; | ||
}; | ||
if (buffer) return context = null, buffer + "" || null; | ||
} | ||
ribbon.startAngle = function(_) { | ||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), ribbon) : startAngle; | ||
}; | ||
ribbon.radius = function(_) { | ||
return arguments.length ? (radius = typeof _ === "function" ? _ : constant(+_), ribbon) : radius; | ||
}; | ||
ribbon.endAngle = function(_) { | ||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), ribbon) : endAngle; | ||
}; | ||
ribbon.startAngle = function(_) { | ||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), ribbon) : startAngle; | ||
}; | ||
ribbon.source = function(_) { | ||
return arguments.length ? (source = _, ribbon) : source; | ||
}; | ||
ribbon.endAngle = function(_) { | ||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), ribbon) : endAngle; | ||
}; | ||
ribbon.target = function(_) { | ||
return arguments.length ? (target = _, ribbon) : target; | ||
}; | ||
ribbon.source = function(_) { | ||
return arguments.length ? (source = _, ribbon) : source; | ||
}; | ||
ribbon.context = function(_) { | ||
return arguments.length ? ((context = _ == null ? null : _), ribbon) : context; | ||
}; | ||
ribbon.target = function(_) { | ||
return arguments.length ? (target = _, ribbon) : target; | ||
}; | ||
return ribbon; | ||
} | ||
ribbon.context = function(_) { | ||
return arguments.length ? ((context = _ == null ? null : _), ribbon) : context; | ||
}; | ||
exports.chord = chord; | ||
exports.ribbon = ribbon; | ||
return ribbon; | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
exports.chord = chord; | ||
exports.ribbon = ribbon; | ||
})); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-chord/ Version 1.0.2. Copyright 2016 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-path"],t):t(n.d3=n.d3||{},n.d3,n.d3)}(this,function(n,t,r){"use strict";function e(n){return function(t,r){return n(t.source.value+t.target.value,r.source.value+r.target.value)}}function u(){function n(n){var e,l,i,c,f,s,p=n.length,h=[],d=t.range(p),g=[],A=[],x=A.groups=new Array(p),b=new Array(p*p);for(e=0,f=-1;++f<p;){for(l=0,s=-1;++s<p;)l+=n[f][s];h.push(l),g.push(t.range(p)),e+=l}for(u&&d.sort(function(n,t){return u(h[n],h[t])}),o&&g.forEach(function(t,r){t.sort(function(t,e){return o(n[r][t],n[r][e])})}),e=y(0,v-r*p)/e,c=e?r:v/p,l=0,f=-1;++f<p;){for(i=l,s=-1;++s<p;){var M=d[f],m=g[M][s],q=n[M][m],_=l,C=l+=q*e;b[m*p+M]={index:M,subindex:m,startAngle:_,endAngle:C,value:q}}x[M]={index:M,startAngle:i,endAngle:l,value:h[M]},l+=c}for(f=-1;++f<p;)for(s=f-1;++s<p;){var P=b[s*p+f],T=b[f*p+s];(P.value||T.value)&&A.push(P.value<T.value?{source:T,target:P}:{source:P,target:T})}return a?A.sort(a):A}var r=0,u=null,o=null,a=null;return n.padAngle=function(t){return arguments.length?(r=y(0,t),n):r},n.sortGroups=function(t){return arguments.length?(u=t,n):u},n.sortSubgroups=function(t){return arguments.length?(o=t,n):o},n.sortChords=function(t){return arguments.length?(null==t?a=null:(a=e(t))._=t,n):a&&a._},n}function o(n){return function(){return n}}function a(n){return n.source}function l(n){return n.target}function i(n){return n.radius}function c(n){return n.startAngle}function f(n){return n.endAngle}function s(){function n(){var n,o=A.call(arguments),a=t.apply(this,o),l=e.apply(this,o),i=+u.apply(this,(o[0]=a,o)),c=s.apply(this,o)-g,f=d.apply(this,o)-g,y=i*p(c),x=i*h(c),b=+u.apply(this,(o[0]=l,o)),M=s.apply(this,o)-g,m=d.apply(this,o)-g;if(v||(v=n=r.path()),v.moveTo(y,x),v.arc(0,0,i,c,f),c===M&&f===m||(v.quadraticCurveTo(0,0,b*p(M),b*h(M)),v.arc(0,0,b,M,m)),v.quadraticCurveTo(0,0,y,x),v.closePath(),n)return v=null,n+""||null}var t=a,e=l,u=i,s=c,d=f,v=null;return n.radius=function(t){return arguments.length?(u="function"==typeof t?t:o(+t),n):u},n.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:o(+t),n):s},n.endAngle=function(t){return arguments.length?(d="function"==typeof t?t:o(+t),n):d},n.source=function(r){return arguments.length?(t=r,n):t},n.target=function(t){return arguments.length?(e=t,n):e},n.context=function(t){return arguments.length?(v=null==t?null:t,n):v},n}var p=Math.cos,h=Math.sin,d=Math.PI,g=d/2,v=2*d,y=Math.max,A=Array.prototype.slice;n.chord=u,n.ribbon=s,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-chord/ Version 1.0.3. Copyright 2016 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-path"],t):t(n.d3=n.d3||{},n.d3,n.d3)}(this,function(n,t,r){"use strict";function e(n){return function(t,r){return n(t.source.value+t.target.value,r.source.value+r.target.value)}}function u(n){return n.source}function o(n){return n.target}function a(n){return n.radius}function l(n){return n.startAngle}function i(n){return n.endAngle}var c=Math.cos,f=Math.sin,s=Math.PI,p=s/2,h=2*s,d=Math.max,g=function(){function n(n){var e,l,i,c,f,s,p=n.length,g=[],v=t.range(p),y=[],A=[],x=A.groups=new Array(p),b=new Array(p*p);for(e=0,f=-1;++f<p;){for(l=0,s=-1;++s<p;)l+=n[f][s];g.push(l),y.push(t.range(p)),e+=l}for(u&&v.sort(function(n,t){return u(g[n],g[t])}),o&&y.forEach(function(t,r){t.sort(function(t,e){return o(n[r][t],n[r][e])})}),e=d(0,h-r*p)/e,c=e?r:h/p,l=0,f=-1;++f<p;){for(i=l,s=-1;++s<p;){var M=v[f],m=y[M][s],q=n[M][m],_=l,C=l+=q*e;b[m*p+M]={index:M,subindex:m,startAngle:_,endAngle:C,value:q}}x[M]={index:M,startAngle:i,endAngle:l,value:g[M]},l+=c}for(f=-1;++f<p;)for(s=f-1;++s<p;){var P=b[s*p+f],T=b[f*p+s];(P.value||T.value)&&A.push(P.value<T.value?{source:T,target:P}:{source:P,target:T})}return a?A.sort(a):A}var r=0,u=null,o=null,a=null;return n.padAngle=function(t){return arguments.length?(r=d(0,t),n):r},n.sortGroups=function(t){return arguments.length?(u=t,n):u},n.sortSubgroups=function(t){return arguments.length?(o=t,n):o},n.sortChords=function(t){return arguments.length?(null==t?a=null:(a=e(t))._=t,n):a&&a._},n},v=Array.prototype.slice,y=function(n){return function(){return n}},A=function(){function n(){var n,u=v.call(arguments),o=t.apply(this,u),a=e.apply(this,u),l=+s.apply(this,(u[0]=o,u)),i=h.apply(this,u)-p,y=d.apply(this,u)-p,A=l*c(i),x=l*f(i),b=+s.apply(this,(u[0]=a,u)),M=h.apply(this,u)-p,m=d.apply(this,u)-p;if(g||(g=n=r.path()),g.moveTo(A,x),g.arc(0,0,l,i,y),i===M&&y===m||(g.quadraticCurveTo(0,0,b*c(M),b*f(M)),g.arc(0,0,b,M,m)),g.quadraticCurveTo(0,0,A,x),g.closePath(),n)return g=null,n+""||null}var t=u,e=o,s=a,h=l,d=i,g=null;return n.radius=function(t){return arguments.length?(s="function"==typeof t?t:y(+t),n):s},n.startAngle=function(t){return arguments.length?(h="function"==typeof t?t:y(+t),n):h},n.endAngle=function(t){return arguments.length?(d="function"==typeof t?t:y(+t),n):d},n.source=function(r){return arguments.length?(t=r,n):t},n.target=function(t){return arguments.length?(e=t,n):e},n.context=function(t){return arguments.length?(g=null==t?null:t,n):g},n};n.chord=g,n.ribbon=A,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-chord", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Visualize relationships or network flow with an aesthetically-pleasing circular layout.", | ||
@@ -37,5 +37,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "2", | ||
"eslint": "3", | ||
"package-preamble": "0.0", | ||
"rollup": "0.34", | ||
"rollup": "0.36", | ||
"tape": "4", | ||
@@ -42,0 +42,0 @@ "uglify-js": "2" |
@@ -26,7 +26,7 @@ # d3-chord | ||
<a href="#chord" name="chord">#</a> d3.<b>chord</b>() | ||
<a href="#chord" name="chord">#</a> d3.<b>chord</b>() [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js "Source") | ||
Constructs a new chord layout with the default settings. | ||
<a href="#_chord" name="_chord">#</a> <i>chord</i>(<i>matrix</i>) | ||
<a href="#_chord" name="_chord">#</a> <i>chord</i>(<i>matrix</i>) [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js#L19 "Source") | ||
@@ -68,23 +68,23 @@ Computes the chord layout for the specified square *matrix* of size *n*×*n*, where the *matrix* represents the directed flow amongst a network (a complete digraph) of *n* nodes. The given *matrix* must be an array of length *n*, where each element *matrix*[*i*] is an array of *n* numbers, where each *matrix*[*i*][*j*] represents the flow from the *i*th node in the network to the *j*th node. Each number *matrix*[*i*][*j*] must be nonnegative, though it can be zero if there is no flow from node *i* to node *j*. From the [Circos tableviewer example](http://mkweb.bcgsc.ca/circos/guide/tables/): | ||
<a href="#chord_padAngle" name="#chord_padAngle">#</a> <i>chord</i>.<b>padAngle</b>([<i>angle</i>]) | ||
<a href="#chord_padAngle" name="#chord_padAngle">#</a> <i>chord</i>.<b>padAngle</b>([<i>angle</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js#L104 "Source") | ||
If *angle* is specified, sets the pad angle between adjacent groups to the specified number in radians and returns this chord layout. If *angle* is not specified, returns the current pad angle, which defaults to zero. | ||
<a href="#chord_sortGroups" name="#chord_sortGroups">#</a> <i>chord</i>.<b>sortGroups</b>([<i>compare</i>]) | ||
<a href="#chord_sortGroups" name="#chord_sortGroups">#</a> <i>chord</i>.<b>sortGroups</b>([<i>compare</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js#L108 "Source") | ||
If *compare* is specified, sets the group comparator to the specified function or null and returns this chord layout. If *compare* is not specified, returns the current group comparator, which defaults to null. If the group comparator is non-null, it is used to sort the groups by their total outflow. See also [d3.ascending](https://github.com/d3/d3-array#ascending) and [d3.descending](https://github.com/d3/d3-array#descending). | ||
<a href="#chord_sortSubgroups" name="#chord_sortSubgroups">#</a> <i>chord</i>.<b>sortSubgroups</b>([<i>compare</i>]) | ||
<a href="#chord_sortSubgroups" name="#chord_sortSubgroups">#</a> <i>chord</i>.<b>sortSubgroups</b>([<i>compare</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js#L112 "Source") | ||
If *compare* is specified, sets the subgroup comparator to the specified function or null and returns this chord layout. If *compare* is not specified, returns the current subgroup comparator, which defaults to null. If the subgroup comparator is non-null, it is used to sort the subgroups corresponding to *matrix*[*i*][0 … *n* - 1] for a given group *i* by their total outflow. See also [d3.ascending](https://github.com/d3/d3-array#ascending) and [d3.descending](https://github.com/d3/d3-array#descending). | ||
<a href="#chord_sortChords" name="#chord_sortChords">#</a> <i>chord</i>.<b>sortChords</b>([<i>compare</i>]) | ||
<a href="#chord_sortChords" name="#chord_sortChords">#</a> <i>chord</i>.<b>sortChords</b>([<i>compare</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/chord.js#L116 "Source") | ||
If *compare* is specified, sets the chord comparator to the specified function or null and returns this chord layout. If *compare* is not specified, returns the current chord comparator, which defaults to null. If the chord comparator is non-null, it is used to sort the [chords](#_chord) by their combined flow; this only affects the *z*-order of the chords. See also [d3.ascending](https://github.com/d3/d3-array#ascending) and [d3.descending](https://github.com/d3/d3-array#descending). | ||
<a href="#ribbon" name="ribbon">#</a> d3.<b>ribbon</b>() | ||
<a href="#ribbon" name="ribbon">#</a> d3.<b>ribbon</b>() [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js "Source") | ||
Creates a new ribbon generator with the default settings. | ||
<a href="#_ribbon" name="_ribbon">#</a> <i>ribbon</i>(<i>arguments…</i>) | ||
<a href="#_ribbon" name="_ribbon">#</a> <i>ribbon</i>(<i>arguments…</i>) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L34 "Source") | ||
@@ -116,3 +116,3 @@ Generates a ribbon for the given *arguments*. The *arguments* are arbitrary; they are simply propagated to the ribbon generator’s accessor functions along with the `this` object. For example, with the default settings, a [chord object](#_chord) expected: | ||
<a href="#ribbon_source" name="ribbon_source">#</a> <i>ribbon</i>.<b>source</b>([<i>source</i>]) | ||
<a href="#ribbon_source" name="ribbon_source">#</a> <i>ribbon</i>.<b>source</b>([<i>source</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L74 "Source") | ||
@@ -127,3 +127,3 @@ If *source* is specified, sets the source accessor to the specified function and returns this ribbon generator. If *source* is not specified, returns the current source accessor, which defaults to: | ||
<a href="#ribbon_target" name="ribbon_target">#</a> <i>ribbon</i>.<b>target</b>([<i>target</i>]) | ||
<a href="#ribbon_target" name="ribbon_target">#</a> <i>ribbon</i>.<b>target</b>([<i>target</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L78 "Source") | ||
@@ -138,3 +138,3 @@ If *target* is specified, sets the target accessor to the specified function and returns this ribbon generator. If *target* is not specified, returns the current target accessor, which defaults to: | ||
<a href="#ribbon_radius" name="ribbon_radius">#</a> <i>ribbon</i>.<b>radius</b>([<i>radius</i>]) | ||
<a href="#ribbon_radius" name="ribbon_radius">#</a> <i>ribbon</i>.<b>radius</b>([<i>radius</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L62 "Source") | ||
@@ -149,3 +149,3 @@ If *radius* is specified, sets the radius accessor to the specified function and returns this ribbon generator. If *radius* is not specified, returns the current radius accessor, which defaults to: | ||
<a href="#ribbon_startAngle" name="ribbon_startAngle">#</a> <i>ribbon</i>.<b>startAngle</b>([<i>angle</i>]) | ||
<a href="#ribbon_startAngle" name="ribbon_startAngle">#</a> <i>ribbon</i>.<b>startAngle</b>([<i>angle</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L66 "Source") | ||
@@ -162,3 +162,3 @@ If *angle* is specified, sets the start angle accessor to the specified function and returns this ribbon generator. If *angle* is not specified, returns the current start angle accessor, which defaults to: | ||
<a href="#ribbon_endAngle" name="ribbon_endAngle">#</a> <i>ribbon</i>.<b>endAngle</b>([<i>angle</i>]) | ||
<a href="#ribbon_endAngle" name="ribbon_endAngle">#</a> <i>ribbon</i>.<b>endAngle</b>([<i>angle</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L70 "Source") | ||
@@ -175,4 +175,4 @@ If *angle* is specified, sets the end angle accessor to the specified function and returns this ribbon generator. If *angle* is not specified, returns the current end angle accessor, which defaults to: | ||
<a href="#ribbon_context" name="ribbon_context">#</a> <i>ribbon</i>.<b>context</b>([<i>context</i>]) | ||
<a href="#ribbon_context" name="ribbon_context">#</a> <i>ribbon</i>.<b>context</b>([<i>context</i>]) [<>](https://github.com/d3/d3-chord/blob/master/src/ribbon.js#L82 "Source") | ||
If *context* is specified, sets the context and returns this ribbon generator. If *context* is not specified, returns the current context, which defaults to null. If the context is not null, then the [generated ribbon](#_ribbon) is rendered to this context as a sequence of [path method](http://www.w3.org/TR/2dcontext/#canvaspathmethods) calls. Otherwise, a [path data](http://www.w3.org/TR/SVG/paths.html#PathData) string representing the generated ribbon is returned. See also [d3-path](https://github.com/d3/d3-path). |
Sorry, the diff of this file is not supported yet
149900
383