-
Notifications
You must be signed in to change notification settings - Fork 0
/
c768d7e1.js
1 lines (1 loc) · 2.54 KB
/
c768d7e1.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{AsTW:function($,M,e){"use strict";e.r(M),e.d(M,"default",function(){return S});var s=e("nKUr"),z=e.n(s),F=e("y8nQ"),P=e("Vl3Y"),J=e("OaEy"),y=e("2fM7"),K=e("c1Ei"),o=e.n(K),g=e("5Tp6"),x=e("XKWP"),B=e("N7Kx"),L=e("kFHX"),R=e("4jIl"),H=e("q1tI"),k=e.n(H),_=e("VphZ"),S=function(V){Object(L.a)(l,V);var b=Object(R.a)(l);function l(){var t;Object(x.a)(this,l);for(var c=arguments.length,m=new Array(c),a=0;a<c;a++)m[a]=arguments[a];return t=b.call.apply(b,[this].concat(m)),t.svgWidth=900,t.svgHeight=500,t.drawSvg=Object(g.a)(o.a.mark(function h(){var u,d,E,r,v,C,U,A,O,T,W,I,D,f,j,p=arguments;return o.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return u=p.length>0&&p[0]!==void 0?p[0]:{},d=u.type,E=d===void 0?0:d,r=_.select(".hierarchy-test"),r.selectAll("svg").remove(),v=r.append("svg").attr("width",t.svgWidth).attr("height",t.svgHeight).style("border","1px solid black"),i.next=6,_.json("./hierarchy/tree.json");case 6:C=i.sent,U=t.types[E].value().size([t.svgHeight,t.svgWidth-50]),A=_.hierarchy(C),O=U(A),T=O.descendants(),W=O.links(),I=_.linkHorizontal().x(function(n){return n.y}).y(function(n){return n.x}),D=v.selectAll("path").data(W),D.enter().append("path").attr("d",I).attr("stroke","#f16384").attr("stroke-width",1).attr("fill","none"),D.exit().remove(),f=v.selectAll("text").data(T),j=f.enter(),j.append("text").attr("x",function(n){return n.y+5}).attr("y",function(n){return n.x-5}).attr("dy",10).text(function(n){return n.data.name}),j.append("circle").attr("cx",function(n){return n.y}).attr("cy",function(n){return n.x}).attr("fill","black").attr("stroke","#f16384").transition().duration(500).ease(_.easeCircleIn).attr("r",2),f.exit().remove();case 21:case"end":return i.stop()}},h)})),t.types=[{label:"tree",value:_.tree},{label:"cluster",value:_.cluster}],t.handType=function(){var h=Object(g.a)(o.a.mark(function u(d){return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.drawSvg({type:d});case 2:case"end":return r.stop()}},u)}));return function(u){return h.apply(this,arguments)}}(),t}return Object(B.a)(l,[{key:"componentDidMount",value:function(){this.drawSvg()}},{key:"render",value:function(){return Object(s.jsxs)(s.Fragment,{children:[Object(s.jsx)(P.a,{children:Object(s.jsx)(P.a.Item,{label:"\u7C7B\u578B",children:Object(s.jsx)(y.a,{defaultValue:0,onChange:this.handType,children:this.types.map(function(c,m){var a=c.label;return Object(s.jsx)(y.a.Option,{value:m,children:a},a)})})})}),Object(s.jsx)("div",{className:"hierarchy-test"})]})}}]),l}(k.a.Component)}}]);