-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path360541a1.js
1 lines (1 loc) · 2.37 KB
/
360541a1.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{OEXY:function(x,D,t){"use strict";t.r(D),t.d(D,"default",function(){return U});var _=t("nKUr"),y=t.n(_),K=t("giR+"),M=t("fyUT"),B=t("y8nQ"),E=t("Vl3Y"),A=t("OaEy"),j=t("2fM7"),p=t("c1Ei"),u=t.n(p),O=t("5Tp6"),P=t("XKWP"),f=t("N7Kx"),g=t("kFHX"),T=t("4jIl"),b=t("q1tI"),C=t.n(b),c=t("VphZ"),U=function(W){Object(g.a)(o,W);var I=Object(T.a)(o);function o(m){var e;return Object(P.a)(this,o),e=I.call(this,m),e.svgWidth=500,e.svgHeight=500,e.margin=40,e.drawSvg=Object(O.a)(u.a.mark(function s(){var d,n,r,a,l,v,i;return u.a.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:d=e.state,n=d.tickSize,r=d.axisType,a=c.select(".scale-test"),a.selectAll("svg").remove(),l=a.append("svg").attr("width",e.svgWidth).attr("height",e.svgHeight).style("border","1px solid black"),v=c.scaleLinear().domain([0,e.svgWidth]).range([0,e.svgWidth-e.margin*2]),i=e.axisTypes[r].value(v).ticks(n),l.append("g").attr("transform","translate(".concat(e.margin,",").concat(e.margin,")")).call(i);case 7:case"end":return h.stop()}},s)})),e.axisTypes=Object.keys(c).filter(function(s){return s.startsWith("axis")}).map(function(s){return{label:s,value:c[s]}}),e.state={tickSize:10,axisType:0},e}return Object(f.a)(o,[{key:"componentDidMount",value:function(){var m=Object(O.a)(u.a.mark(function s(){return u.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()}},s,this)}));function e(){return m.apply(this,arguments)}return e}()},{key:"render",value:function(){var e=this,s=this.state,d=s.tickSize,n=s.axisType;return Object(_.jsxs)(_.Fragment,{children:[Object(_.jsxs)(E.a,{children:[Object(_.jsx)(E.a.Item,{label:"axis\u7C7B\u578B",children:Object(_.jsx)(j.a,{defaultValue:n,onChange:function(){var r=Object(O.a)(u.a.mark(function a(l){return u.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",e.setState({axisType:l},e.drawSvg));case 1:case"end":return i.stop()}},a)}));return function(a){return r.apply(this,arguments)}}(),children:this.axisTypes.map(function(r,a){var l=r.label;return Object(_.jsx)(j.a.Option,{value:a,children:l},l)})})}),Object(_.jsx)(E.a.Item,{label:"tick\u6570\u91CF",children:Object(_.jsx)(M.a,{defaultValue:d,onChange:function(a){return e.setState({tickSize:a},e.drawSvg)},min:1,max:100})})]}),Object(_.jsx)("div",{className:"scale-test"})]})}}]),o}(C.a.Component)}}]);