-
Notifications
You must be signed in to change notification settings - Fork 0
/
c7a3139e.js
1 lines (1 loc) · 3.7 KB
/
c7a3139e.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[25],{hevo:function(G,R,t){"use strict";t.r(R),t.d(R,"default",function(){return V});var u=t("nKUr"),J=t.n(u),N=t("y8nQ"),A=t("Vl3Y"),X=t("OaEy"),T=t("2fM7"),B=t("c1Ei"),v=t.n(B),c=t("k16G"),p=t("5Tp6"),L=t("XKWP"),x=t("N7Kx"),k=t("kFHX"),S=t("4jIl"),H=t("q1tI"),w=t.n(H),_=t("VphZ"),V=function($){Object(k.a)(h,$);var F=Object(S.a)(h);function h(f){var a;return Object(L.a)(this,h),a=F.call(this,f),a.svgWidth=500,a.svgHeight=500,a.margin=40,a.drawSvg=Object(p.a)(v.a.mark(function l(){var m,n,i,d,o,O,y,U,E,C,D,j,I,M,W,P,K,b;return v.a.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:try{m=a.state.curveType,n=a.curveTypes[m].value,i=_.select(".shape-test"),i.selectAll("svg").remove(),d=i.append("svg").attr("width",a.svgWidth).attr("height",a.svgHeight).style("border","1px solid black"),o=_.arc(),O=o({innerRadius:30,outerRadius:50,startAngle:0,endAngle:Math.PI*2*90/360}),O&&d.append("path").attr("d",O).attr("fill","red").attr("transform","translate(50,50)"),y=_.pie(),U=y([1,1,2,3,5,8,13,21]).map(function(e){var r=e.startAngle,s=e.endAngle;return{startAngle:r,endAngle:s,innerRadius:30,outerRadius:50}}),d.append("g").attr("transform","translate(150,50)").selectAll("path").data(U).enter().append("path").attr("d",o).attr("fill",function(e,r){return _.schemeCategory10[r]}),E=Array(50).fill(0).map(function(e,r){return[r*a.svgWidth/30,a.svgHeight-Math.random()*30-5]}),C=_.line().curve(n),D=C(E),D&&d.append("path").attr("d",D).attr("fill","none").attr("stroke","green").attr("stroke-width",1),j=_.range(0,360,1).map(function(e){return[Math.PI*2*e/360,100+Math.sin(Math.random()*Math.PI)*20]}),I=_.lineRadial().curve(n),M=I(j),M&&d.append("path").attr("transform","translate(130,250)").attr("d",M).attr("fill","none").attr("stroke","red").attr("stroke-width",1),W=_.areaRadial().innerRadius(function(e){var r=Object(c.a)(e,2),s=r[1];return s-50}).outerRadius(function(e){var r=Object(c.a)(e,2),s=r[1];return s}).curve(n),P=W(j),P&&d.append("path").attr("transform","translate(375,250)").attr("d",P).attr("fill","#a280db").attr("stroke","red").attr("stroke-width",1),K=_.area().curve(n).x(function(e){var r=Object(c.a)(e,1),s=r[0];return s}).y(function(e){var r=Object(c.a)(e,2),s=r[1];return s-50}).x0(function(e){var r=Object(c.a)(e,1),s=r[0];return s}).y0(function(e){var r=Object(c.a)(e,2),s=r[1];return s-50}).x1(function(e){var r=Object(c.a)(e,1),s=r[0];return s}).y1(function(){return 500-50}),b=K(E),b&&d.append("path").attr("transform","translate(0,0)").attr("d",b).attr("fill","#e87777")}catch(e){console.error(e)}case 1:case"end":return g.stop()}},l)})),a.curveTypes=Object.keys(_).filter(function(l){return l.startsWith("curve")}).map(function(l){return{label:l,value:_[l]}}),a.state={curveType:0},a}return Object(x.a)(h,[{key:"componentDidMount",value:function(){var f=Object(p.a)(v.a.mark(function l(){return v.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.drawSvg();case 2:case"end":return n.stop()}},l,this)}));function a(){return f.apply(this,arguments)}return a}()},{key:"render",value:function(){var a=this,l=this.state.curveType;return Object(u.jsxs)(u.Fragment,{children:[Object(u.jsx)(A.a,{children:Object(u.jsx)(A.a.Item,{label:"axis\u7C7B\u578B",children:Object(u.jsx)(T.a,{defaultValue:l,onChange:function(){var m=Object(p.a)(v.a.mark(function n(i){return v.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",a.setState({curveType:i},a.drawSvg));case 1:case"end":return o.stop()}},n)}));return function(n){return m.apply(this,arguments)}}(),children:this.curveTypes.map(function(m,n){var i=m.label;return Object(u.jsx)(T.a.Option,{value:n,children:i},i)})})})}),Object(u.jsx)("div",{className:"shape-test"})]})}}]),h}(w.a.Component)}}]);