1 |
- define("echarts/chart/chord","require ./base zrender/shape/Text zrender/shape/Line zrender/shape/Sector ../util/shape/Ribbon ../util/shape/Icon zrender/shape/BezierCurve ../config ../util/ecData zrender/tool/util zrender/tool/vector ../data/Graph ../layout/Chord ../chart".split(" "),function(q){function v(a,c,b,e,w){n.call(this,a,c,b,e,w);this.scaleUnitAngle=this.scaleLineLength=4;this.refresh(e)}var n=q("./base"),a=q("zrender/shape/Text"),c=q("zrender/shape/Line"),b=q("zrender/shape/Sector"),d=q("../util/shape/Ribbon"),l=q("../util/shape/Icon"),f=q("zrender/shape/BezierCurve"),m=q("../config");m.chord={zlevel:0,z:2,clickable:!0,radius:["60%","70%"],center:["50%","50%"],padding:2,sort:"none",sortSub:"none",startAngle:90,clockWise:!0,ribbonType:!0,minRadius:10,maxRadius:20,symbol:"circle",showScale:!1,showScaleText:!1,itemStyle:{normal:{borderWidth:0,borderColor:"#000",label:{show:!0,rotate:!1,distance:5},chordStyle:{width:1,color:"black",borderWidth:1,borderColor:"#999",opacity:.5}},emphasis:{borderWidth:0,borderColor:"#000",chordStyle:{width:1,color:"black",borderWidth:1,borderColor:"#999"}}}};var k=q("../util/ecData"),B=q("zrender/tool/util"),x=q("zrender/tool/vector"),y=q("../data/Graph"),t=q("../layout/Chord");return v.prototype={type:m.CHART_TYPE_CHORD,_init:function(){var a=this.series;this.selectedMap={};for(var c={},b={},e=0,w=a.length;w>e;e++)if(a[e].type===this.type){var h=this.isSelected(a[e].name);(this.selectedMap[a[e].name]=h)&&this.buildMark(e);this.reformOption(a[e]);c[a[e].name]=a[e]}e=0;for(w=a.length;w>e;e++)a[e].type===this.type&&(a[e].insertToSerie?a[e]._referenceSerie=c[a[e].insertToSerie]:b[a[e].name]=[a[e]]);e=0;for(w=a.length;w>e;e++)if(a[e].type===this.type&&a[e].insertToSerie){for(c=a[e]._referenceSerie;c&&c._referenceSerie;)c=c._referenceSerie;b[c.name]&&this.selectedMap[a[e].name]&&b[c.name].push(a[e])}for(var u in b)this._buildChords(b[u]);this.addShapeList()},_getNodeCategory:function(a,c){return a.categories&&a.categories[c.category||0]},_getNodeQueryTarget:function(a,c){var b=this._getNodeCategory(a,c);return[c,b,a]},_getEdgeQueryTarget:function(a,c,b){return b=b||"normal",[c.itemStyle&&c.itemStyle[b],a.itemStyle[b].chordStyle]},_buildChords:function(a){for(var c=[],b=a[0],e=function(a){return 0<a.layout.size},w=function(a){return function(c){return a.getEdge(c.node2,c.node1)}},h=0;h<a.length;h++){var u=a[h];if(this.selectedMap[u.name]){var g;u.data&&u.matrix?g=this._getSerieGraphFromDataMatrix(u,b):u.nodes&&u.links&&(g=this._getSerieGraphFromNodeLinks(u,b));g.filterNode(e,this);u.ribbonType&&g.filterEdge(w(g));c.push(g);g.__serie=u}}if(c.length){e=c[0];if(!b.ribbonType){var r=b.minRadius,h=b.maxRadius,p=1/0,d=-1/0;e.eachNode(function(a){d=Math.max(a.layout.size,d);p=Math.min(a.layout.size,p)});var f=(h-r)/(d-p);e.eachNode(function(a){var c=this._getNodeQueryTarget(b,a),c=this.query(c,"symbolSize");a.layout.size=d===p?c||p:c||(a.layout.size-p)*f+r},this)}h=new t;h.clockWise=b.clockWise;h.startAngle=b.startAngle*Math.PI/180;h.clockWise||(h.startAngle=-h.startAngle);h.padding=b.padding*Math.PI/180;h.sort=b.sort;h.sortSub=b.sortSub;h.directed=b.ribbonType;h.run(c);h=this.query(b,"itemStyle.normal.label.show");if(b.ribbonType){this._buildSectors(b,0,e,b,c);h&&this._buildLabels(b,0,e,b,c);for(w=h=0;h<a.length;h++)this.selectedMap[a[h].name]&&this._buildRibbons(a,h,c[w++],b);b.showScale&&this._buildScales(b,0,e)}else for(this._buildNodeIcons(b,0,e,b,c),h&&this._buildLabels(b,0,e,b,c),w=h=0;h<a.length;h++)this.selectedMap[a[h].name]&&this._buildEdgeCurves(a,h,c[w++],b,e);this._initHoverHandler(a,c)}},_getSerieGraphFromDataMatrix:function(a,c){for(var b=[],e=0,w=[],h=0;h<a.matrix.length;h++)w[h]=a.matrix[h].slice();for(var u=a.data||a.nodes,h=0;h<u.length;h++){var g={},r=u[h];r.rawIndex=h;for(var p in r)"name"===p?g.id=r.name:g[p]=r[p];var d=this._getNodeCategory(c,r),r=d?d.name:r.name;if(this.selectedMap[r]=this.isSelected(r),this.selectedMap[r])b.push(g),e++;else for(w.splice(e,1),g=0;g<w.length;g++)w[g].splice(e,1)}b=y.fromMatrix(b,w,!0);return b.eachNode(function(a){a.layout={size:a.data.outValue};a.rawIndex=a.data.rawIndex}),b.eachEdge(function(a){a.layout={weight:a.data.weight}}),b},_getSerieGraphFromNodeLinks:function(a,c){for(var b=new y(!0),e=a.data||a.nodes,d=0,h=e.length;h>d;d++){var u=e[d];if(u&&!u.ignore){var g=this._getNodeCategory(c,u),g=g?g.name:u.name;if(this.selectedMap[g]=this.isSelected(g),this.selectedMap[g])b.addNode(u.name,u).rawIndex=d}}d=0;for(h=a.links.length;h>d;d++){var u=a.links[d],g=u.source,r=u.target;"number"==typeof g&&(g=e[g],g&&(g=g.name));"number"==typeof r&&(r=e[r],r&&(r=r.name));(u=b.addEdge(g,r,u))&&(u.rawIndex=d)}return b.eachNode(function(a){var b=a.data.value;if(null==b)if(b=0,c.ribbonType)for(var e=0;e<a.outEdges.length;e++)b+=a.outEdges[e].data.weight||0;else for(e=0;e<a.edges.length;e++)b+=a.edges[e].data.weight||0;a.layout={size:b}}),b.eachEdge(function(a){a.layout={weight:null==a.data.weight?1:a.data.weight}}),b},_initHoverHandler:function(a,c){var b=a[0],e=c[0],d=this;e.eachNode(function(a){a.shape.onmouseover=function(){e.eachNode(function(a){a.shape.style.opacity=.1;a.labelShape&&(a.labelShape.style.opacity=.1,a.labelShape.modSelf());a.shape.modSelf()});for(var b=0;b<c.length;b++)for(var g=0;g<c[b].edges.length;g++){var r=c[b].edges[g],p=d._getEdgeQueryTarget(c[b].__serie,r.data);r.shape.style.opacity=.1*d.deepQuery(p,"opacity");r.shape.modSelf()}a.shape.style.opacity=1;a.labelShape&&(a.labelShape.style.opacity=1);for(b=0;b<c.length;b++){var f=c[b].getNodeById(a.id);if(f)for(g=0;g<f.outEdges.length;g++)r=f.outEdges[g],p=d._getEdgeQueryTarget(c[b].__serie,r.data),r.shape.style.opacity=d.deepQuery(p,"opacity"),(r=c[0].getNodeById(r.node2.id))&&(r.shape&&(r.shape.style.opacity=1),r.labelShape&&(r.labelShape.style.opacity=1))}d.zr.refreshNextFrame()};a.shape.onmouseout=function(){e.eachNode(function(a){a.shape.style.opacity=1;a.labelShape&&(a.labelShape.style.opacity=1,a.labelShape.modSelf());a.shape.modSelf()});for(var a=0;a<c.length;a++)for(var g=0;g<c[a].edges.length;g++){var h=c[a].edges[g];h.shape.style.opacity=d.deepQuery([h.data,b],"itemStyle.normal.chordStyle.opacity");h.shape.modSelf()}d.zr.refreshNextFrame()}})},_buildSectors:function(a,c,d,e){var f=this.parseCenter(this.zr,e.center),h=this.parseRadius(this.zr,e.radius),u=e.clockWise,g=u?1:-1;d.eachNode(function(d){var p=this._getNodeCategory(e,d.data),p=this.getColor(p?p.name:d.id),m=d.layout.startAngle/Math.PI*180*g,l=d.layout.endAngle/Math.PI*180*g,p=new b({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:f[0],y:f[1],r0:h[0],r:h[1],startAngle:m,endAngle:l,brushType:"fill",opacity:1,color:p,clockWise:u},clickable:e.clickable,highlightStyle:{brushType:"fill"}});p.style.lineWidth=this.deepQuery([d.data,e],"itemStyle.normal.borderWidth");p.highlightStyle.lineWidth=this.deepQuery([d.data,e],"itemStyle.emphasis.borderWidth");p.style.strokeColor=this.deepQuery([d.data,e],"itemStyle.normal.borderColor");p.highlightStyle.strokeColor=this.deepQuery([d.data,e],"itemStyle.emphasis.borderColor");0<p.style.lineWidth&&(p.style.brushType="both");0<p.highlightStyle.lineWidth&&(p.highlightStyle.brushType="both");k.pack(p,a,c,d.data,d.rawIndex,d.id,d.category);this.shapeList.push(p);d.shape=p},this)},_buildNodeIcons:function(a,c,b,e){var d=this.parseCenter(this.zr,e.center),h=this.parseRadius(this.zr,e.radius)[1];b.eachNode(function(b){var g=(b.layout.startAngle+b.layout.endAngle)/2,f=h*Math.cos(g),g=h*Math.sin(g),p=this._getNodeQueryTarget(e,b.data),m=this._getNodeCategory(e,b.data),n=this.deepQuery(p,"itemStyle.normal.color");n||(n=this.getColor(m?m.name:b.id));f=new l({zlevel:this.getZlevelBase(),z:this.getZBase()+1,style:{x:-b.layout.size,y:-b.layout.size,width:2*b.layout.size,height:2*b.layout.size,iconType:this.deepQuery(p,"symbol"),color:n,brushType:"both",lineWidth:this.deepQuery(p,"itemStyle.normal.borderWidth"),strokeColor:this.deepQuery(p,"itemStyle.normal.borderColor")},highlightStyle:{color:this.deepQuery(p,"itemStyle.emphasis.color"),lineWidth:this.deepQuery(p,"itemStyle.emphasis.borderWidth"),strokeColor:this.deepQuery(p,"itemStyle.emphasis.borderColor")},clickable:e.clickable,position:[f+d[0],g+d[1]]});k.pack(f,a,c,b.data,b.rawIndex,b.id,b.category);this.shapeList.push(f);b.shape=f},this)},_buildLabels:function(c,b,d,e){var f=this.query(e,"itemStyle.normal.label.color"),h=this.query(e,"itemStyle.normal.label.rotate"),m=this.query(e,"itemStyle.normal.label.distance"),g=this.parseCenter(this.zr,e.center),r=this.parseRadius(this.zr,e.radius),p=e.clockWise?1:-1;d.eachNode(function(c){var b=(c.layout.startAngle/Math.PI*180*p*-p+c.layout.endAngle/Math.PI*180*p*-p)/2,b=b%360;0>b&&(b+=360);var d=90>=b||270<=b,b=b*Math.PI/180,l=[Math.cos(b),-Math.sin(b)],k;k=e.ribbonType?e.showScaleText?35+m:m:m+c.layout.size;l=x.scale([],l,r[1]+k);x.add(l,l,g);var n={zlevel:this.getZlevelBase(),z:this.getZBase()+1,hoverable:!1,style:{text:null==c.data.label?c.id:c.data.label,textAlign:d?"left":"right",color:f||"#000000"}};h?(n.rotation=d?b:Math.PI+b,n.style.x=d?r[1]+k:-r[1]-k,n.style.y=0,n.position=g.slice()):(n.style.x=l[0],n.style.y=l[1]);n.style.textColor=this.deepQuery([c.data,e],"itemStyle.normal.label.textStyle.color")||"#fff";n.style.textFont=this.getFont(this.deepQuery([c.data,e],"itemStyle.normal.label.textStyle"));n=new a(n);this.shapeList.push(n);c.labelShape=n},this)},_buildRibbons:function(a,b,c,e){var f=a[b],h=this.parseCenter(this.zr,e.center),m=this.parseRadius(this.zr,e.radius);c.eachEdge(function(g,n){var p,l=c.getEdge(g.node2,g.node1);if(l&&!g.shape){if(l.shape)return void(g.shape=l.shape);var q=g.layout.startAngle/Math.PI*180,t=g.layout.endAngle/Math.PI*180,v=l.layout.startAngle/Math.PI*180,x=l.layout.endAngle/Math.PI*180;p=this.getColor(1===a.length?g.layout.weight<=l.layout.weight?g.node1.id:g.node2.id:f.name);var D,E,B=this._getEdgeQueryTarget(f,g.data),y=this._getEdgeQueryTarget(f,g.data,"emphasis");p=new d({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{x:h[0],y:h[1],r:m[0],source0:q,source1:t,target0:v,target1:x,brushType:"both",opacity:this.deepQuery(B,"opacity"),color:p,lineWidth:this.deepQuery(B,"borderWidth"),strokeColor:this.deepQuery(B,"borderColor"),clockWise:e.clockWise},clickable:e.clickable,highlightStyle:{brushType:"both",opacity:this.deepQuery(y,"opacity"),lineWidth:this.deepQuery(y,"borderWidth"),strokeColor:this.deepQuery(y,"borderColor")}});g.layout.weight<=l.layout.weight?(D=l.node1,E=l.node2):(D=g.node1,E=g.node2);k.pack(p,f,b,g.data,null==g.rawIndex?n:g.rawIndex,g.data.name||D.id+"-"+E.id,D.id,E.id);this.shapeList.push(p);g.shape=p}},this)},_buildEdgeCurves:function(a,b,c,e,d){var h=a[b],m=this.parseCenter(this.zr,e.center);c.eachEdge(function(a,c){var e=d.getNodeById(a.node1.id),l=d.getNodeById(a.node2.id),e=e.shape,l=l.shape,n=this._getEdgeQueryTarget(h,a.data),q=this._getEdgeQueryTarget(h,a.data,"emphasis"),e=new f({zlevel:this.getZlevelBase(),z:this.getZBase(),style:{xStart:e.position[0],yStart:e.position[1],xEnd:l.position[0],yEnd:l.position[1],cpX1:m[0],cpY1:m[1],lineWidth:this.deepQuery(n,"width"),strokeColor:this.deepQuery(n,"color"),opacity:this.deepQuery(n,"opacity")},highlightStyle:{lineWidth:this.deepQuery(q,"width"),strokeColor:this.deepQuery(q,"color"),opacity:this.deepQuery(q,"opacity")}});k.pack(e,h,b,a.data,null==a.rawIndex?c:a.rawIndex,a.data.name||a.node1.id+"-"+a.node2.id,a.node1.id,a.node2.id);this.shapeList.push(e);a.shape=e},this)},_buildScales:function(b,d,f){var e,l,h=b.clockWise,m=this.parseCenter(this.zr,b.center),g=this.parseRadius(this.zr,b.radius),n=h?1:-1,p=0,k=-1/0;b.showScaleText&&(f.eachNode(function(a){a=a.data.value;a>k&&(k=a);p+=a}),1E10<k?(e="b",l=1E-9):1E7<k?(e="m",l=1E-6):1E4<k?(e="k",l=.001):(e="",l=1));var q=p/(360-b.padding);f.eachNode(function(d){var f=d.layout.startAngle/Math.PI*180;d=d.layout.endAngle/Math.PI*180;for(var p=f;!(h&&p>d||!h&&d>p);){var k=p/180*Math.PI,t=[Math.cos(k),Math.sin(k)],k=x.scale([],t,g[1]+1);x.add(k,k,m);t=x.scale([],t,g[1]+this.scaleLineLength);x.add(t,t,m);k=new c({zlevel:this.getZlevelBase(),z:this.getZBase()-1,hoverable:!1,style:{xStart:k[0],yStart:k[1],xEnd:t[0],yEnd:t[1],lineCap:"round",brushType:"stroke",strokeColor:"#666",lineWidth:1}});this.shapeList.push(k);p+=n*this.scaleUnitAngle}if(b.showScaleText)for(p=5*q*this.scaleUnitAngle,t=0;!(h&&f>d||!h&&d>f);){k=f;k%=360;0>k&&(k+=360);var v=90>=k||270<=k,k=new a({zlevel:this.getZlevelBase(),z:this.getZBase()-1,hoverable:!1,style:{x:v?g[1]+this.scaleLineLength+4:-g[1]-this.scaleLineLength-4,y:0,text:Math.round(10*t)/10+e,textAlign:v?"left":"right"},position:m.slice(),rotation:v?[-k/180*Math.PI,0,0]:[-(k+180)/180*Math.PI,0,0]});this.shapeList.push(k);t+=p*l;f+=n*this.scaleUnitAngle*5}},this)},refresh:function(a){if(a&&(this.option=a,this.series=a.series),this.legend=this.component.legend,this.legend)this.getColor=function(a){return this.legend.getColor(a)},this.isSelected=function(a){return this.legend.isSelected(a)};else{var b={},c=0;this.getColor=function(a){return b[a]?b[a]:(b[a]||(b[a]=this.zr.getColor(c++)),b[a])};this.isSelected=function(){return!0}}this.backupShapeList();this._init()},reformOption:function(a){var b=B.merge;a=b(b(a||{},this.ecTheme.chord),m.chord);a.itemStyle.normal.label.textStyle=this.getTextStyle(a.itemStyle.normal.label.textStyle)}},B.inherits(v,n),q("../chart").define("chord",v),v});define("echarts/util/shape/Ribbon",["require","zrender/shape/Base","zrender/shape/util/PathProxy","zrender/tool/util"],function(q){function v(c){n.call(this,c);this._pathProxy=new a}var n=q("zrender/shape/Base"),a=q("zrender/shape/util/PathProxy");q=q("zrender/tool/util");return v.prototype={type:"ribbon",buildPath:function(a,b){var d=b.clockWise||!1,l=this._pathProxy;l.begin(a);var f=b.x,m=b.y,k=b.r,n=b.source0/180*Math.PI,q=b.source1/180*Math.PI,v=b.target0/180*Math.PI,t=b.target1/180*Math.PI,z=f+Math.cos(n)*k,A=m+Math.sin(n)*k,C=f+Math.cos(q)*k,e=m+Math.sin(q)*k,w=f+Math.cos(v)*k,h=m+Math.sin(v)*k,u=f+Math.cos(t)*k,k=m+Math.sin(t)*k;l.moveTo(z,A);l.arc(f,m,b.r,n,q,!d);l.bezierCurveTo(.7*(f-C)+C,.7*(m-e)+e,.7*(f-w)+w,.7*(m-h)+h,w,h);b.source0===b.target0&&b.source1===b.target1||(l.arc(f,m,b.r,v,t,!d),l.bezierCurveTo(.7*(f-u)+u,.7*(m-k)+k,.7*(f-z)+z,.7*(m-A)+A,z,A))},getRect:function(a){return a.__rect?a.__rect:(this._pathProxy.isEmpty()||this.buildPath(null,a),this._pathProxy.fastBoundingRect())}},q.inherits(v,n),v});define("zrender/shape/BezierCurve",["require","./Base","../tool/util"],function(q){var v=q("./Base"),n=function(a){this.brushTypeOnly="stroke";this.textPosition="end";v.call(this,a)};return n.prototype={type:"bezier-curve",buildPath:function(a,c){a.moveTo(c.xStart,c.yStart);"undefined"!=typeof c.cpX2&&"undefined"!=typeof c.cpY2?a.bezierCurveTo(c.cpX1,c.cpY1,c.cpX2,c.cpY2,c.xEnd,c.yEnd):a.quadraticCurveTo(c.cpX1,c.cpY1,c.xEnd,c.yEnd)},getRect:function(a){if(a.__rect)return a.__rect;var c=Math.min(a.xStart,a.xEnd,a.cpX1),b=Math.min(a.yStart,a.yEnd,a.cpY1),d=Math.max(a.xStart,a.xEnd,a.cpX1),l=Math.max(a.yStart,a.yEnd,a.cpY1),f=a.cpX2,m=a.cpY2;"undefined"!=typeof f&&"undefined"!=typeof m&&(c=Math.min(c,f),b=Math.min(b,m),d=Math.max(d,f),l=Math.max(l,m));f=a.lineWidth||1;return a.__rect={x:c-f,y:b-f,width:d-c+f,height:l-b+f},a.__rect}},q("../tool/util").inherits(n,v),n});define("echarts/data/Graph",["require","zrender/tool/util"],function(q){var v=q("zrender/tool/util"),n=function(a){this._directed=a||!1;this.nodes=[];this.edges=[];this._nodesMap={};this._edgesMap={}};n.prototype.isDirected=function(){return this._directed};n.prototype.addNode=function(a,c){if(this._nodesMap[a])return this._nodesMap[a];var b=new n.Node(a,c);return this.nodes.push(b),this._nodesMap[a]=b,b};n.prototype.getNodeById=function(a){return this._nodesMap[a]};n.prototype.addEdge=function(a,c,b){if("string"==typeof a&&(a=this._nodesMap[a]),"string"==typeof c&&(c=this._nodesMap[c]),a&&c){var d=a.id+"-"+c.id;if(this._edgesMap[d])return this._edgesMap[d];b=new n.Edge(a,c,b);return this._directed&&(a.outEdges.push(b),c.inEdges.push(b)),a.edges.push(b),a!==c&&c.edges.push(b),this.edges.push(b),this._edgesMap[d]=b,b}};n.prototype.removeEdge=function(a){var c=a.node1,b=a.node2,d=c.id+"-"+b.id;this._directed&&(c.outEdges.splice(v.indexOf(c.outEdges,a),1),b.inEdges.splice(v.indexOf(b.inEdges,a),1));c.edges.splice(v.indexOf(c.edges,a),1);c!==b&&b.edges.splice(v.indexOf(b.edges,a),1);delete this._edgesMap[d];this.edges.splice(v.indexOf(this.edges,a),1)};n.prototype.getEdge=function(a,c){return"string"!=typeof a&&(a=a.id),"string"!=typeof c&&(c=c.id),this._directed?this._edgesMap[a+"-"+c]:this._edgesMap[a+"-"+c]||this._edgesMap[c+"-"+a]};n.prototype.removeNode=function(a){if("string"!=typeof a||(a=this._nodesMap[a])){delete this._nodesMap[a.id];this.nodes.splice(v.indexOf(this.nodes,a),1);for(var c=0;c<this.edges.length;){var b=this.edges[c];b.node1===a||b.node2===a?this.removeEdge(b):c++}}};n.prototype.filterNode=function(a,c){for(var b=this.nodes.length,d=0;b>d;)a.call(c,this.nodes[d],d)?d++:(this.removeNode(this.nodes[d]),b--)};n.prototype.filterEdge=function(a,c){for(var b=this.edges.length,d=0;b>d;)a.call(c,this.edges[d],d)?d++:(this.removeEdge(this.edges[d]),b--)};n.prototype.eachNode=function(a,c){for(var b=this.nodes.length,d=0;b>d;d++)this.nodes[d]&&a.call(c,this.nodes[d],d)};n.prototype.eachEdge=function(a,c){for(var b=this.edges.length,d=0;b>d;d++)this.edges[d]&&a.call(c,this.edges[d],d)};n.prototype.clear=function(){this.nodes.length=0;this.edges.length=0;this._nodesMap={};this._edgesMap={}};n.prototype.breadthFirstTraverse=function(a,c,b,d){if("string"==typeof c&&(c=this._nodesMap[c]),c){var l="edges";"out"===b?l="outEdges":"in"===b&&(l="inEdges");for(b=0;b<this.nodes.length;b++)this.nodes[b].__visited=!1;if(!a.call(d,c,null))for(c=[c];c.length;){d=c.shift();var f=d[l];for(b=0;b<f.length;b++){var m=f[b],m=m.node1===d?m.node2:m.node1;if(!m.__visited){if(a.call(m,m,d))return;c.push(m);m.__visited=!0}}}}};n.prototype.clone=function(){for(var a=new n(this._directed),c=0;c<this.nodes.length;c++)a.addNode(this.nodes[c].id,this.nodes[c].data);for(c=0;c<this.edges.length;c++){var b=this.edges[c];a.addEdge(b.node1.id,b.node2.id,b.data)}return a};q=function(a,c){this.id=a;this.data=c||null;this.inEdges=[];this.outEdges=[];this.edges=[]};q.prototype.degree=function(){return this.edges.length};q.prototype.inDegree=function(){return this.inEdges.length};q.prototype.outDegree=function(){return this.outEdges.length};return n.Node=q,n.Edge=function(a,c,b){this.node1=a;this.node2=c;this.data=b||null},n.fromMatrix=function(a,c,b){if(c&&c.length&&c[0].length===c.length&&a.length===c.length){for(var d=c.length,l=new n(b),f=0;d>f;f++){var m=l.addNode(a[f].id,a[f]);m.data.value=0;b&&(m.data.outValue=m.data.inValue=0)}for(f=0;d>f;f++)for(a=0;d>a;a++)m=c[f][a],b&&(l.nodes[f].data.outValue+=m,l.nodes[a].data.inValue+=m),l.nodes[f].data.value+=m,l.nodes[a].data.value+=m;for(f=0;d>f;f++)for(a=f;d>a;a++)if(m=c[f][a],0!==m){var k=l.nodes[f],q=l.nodes[a];if(l.addEdge(k,q,{}).data.weight=m,f!==a&&b&&c[a][f])l.addEdge(q,k,{}).data.weight=c[a][f]}return l}},n});define("echarts/layout/Chord",["require"],function(){var q=function(a){a=a||{};this.sort=a.sort||null;this.sortSub=a.sortSub||null;this.padding=.05;this.startAngle=a.startAngle||0;this.clockWise=null==a.clockWise?!1:a.clockWise;this.center=a.center||[0,0];this.directed=!0};q.prototype.run=function(a){a instanceof Array||(a=[a]);if(a.length){for(var c=a[0],b=c.nodes.length,d=[],l=0,f=0;b>f;f++){var m=c.nodes[f],k={size:0,subGroups:[],node:m};d.push(k);for(var q=0,x=0;x<a.length;x++){var y=a[x],t=y.getNodeById(m.id);if(t){k.size+=t.layout.size;for(var z=this.directed?t.outEdges:t.edges,t=0;t<z.length;t++){var A=z[t],C=A.layout.weight;k.subGroups.push({weight:C,edge:A,graph:y});q+=C}}}l+=k.size;m=k.size/q;for(t=0;t<k.subGroups.length;t++)k.subGroups[t].weight*=m;"ascending"===this.sortSub?k.subGroups.sort(v):"descending"===this.sort&&(k.subGroups.sort(v),k.subGroups.reverse())}"ascending"===this.sort?d.sort(n):"descending"===this.sort&&(d.sort(n),d.reverse());m=(2*Math.PI-this.padding*b)/l;a=this.startAngle;c=this.clockWise?1:-1;for(f=0;b>f;f++){k=d[f];k.node.layout.startAngle=a;k.node.layout.endAngle=a+c*k.size*m;k.node.layout.subGroups=[];for(t=0;t<k.subGroups.length;t++)l=k.subGroups[t],l.edge.layout.startAngle=a,a+=c*l.weight*m,l.edge.layout.endAngle=a;a=k.node.layout.endAngle+c*this.padding}}};var v=function(a,c){return a.weight-c.weight},n=function(a,c){return a.size-c.size};return q});
|