You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.7 KiB

// https://d3js.org/d3-chord/ Version 1.0.4. Copyright 2017 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})});