cl-react-graph
Version:
2 lines • 11.5 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{"+x/X":function(e,t,n){"use strict";function a(e,t){this._context=e,this._t=t}function i(e){return new a(e,0)}function r(e){return new a(e,1)}n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return r})),a.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}},t.a=function(e){return new a(e,.5)}},"6iqo":function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return i}));n("E9XD"),n("t8Zj"),n("2b7M"),n("ZZWI"),n("6MCL"),n("t6b9");var a=function(e,t,n){if(void 0===n&&(n=!0),void 0===e[0]||void 0===e[1])return[0,0];try{var a="time"===t.scale?e[0].getTime():e[0],r="time"===t.scale?e[1].getTime():e[1],l=r-a,o="log"===t.scale?100:5,c=r+(i(l,n,o)-l);return"time"===t.scale?[e[0],new Date(c)]:[e[0],c]}catch(u){return[0,0]}},i=function(e,t,n){return void 0===t&&(t=!0),void 0===n&&(n=5),t?e+e*n/100:e-e*n/100}},"8UuD":function(e,t,n){"use strict";n.d(t,"c",(function(){return y})),n.d(t,"b",(function(){return b})),n.d(t,"a",(function(){return w}));var a=n("2b7M"),i=n("SSiR"),r=n("NBGV"),l=n("k9xw"),o=n("q9au"),c=n("ArWm"),u=n("RGs9"),s=n("q1tI"),f=n("6iqo"),h=n("2XWM"),d=n("XuR1"),x=n("OQCi"),y=function(e){var t=e.data,n=e.width,i=e.height,r=e.axis,l=e.left,o=void 0===l?0:l,c=Object(s.useState)({xScale:null,yScale:null}),u=c[0],y=c[1];return Object(s.useEffect)((function(){var e=function(e){var t,n;switch(e.x.scale){case"log":t=Object(h.a)().clamp(!0);break;case"time":t=Object(d.a)();break;default:t=Object(x.a)()}switch(e.y.scale){case"log":n=Object(h.a)().clamp(!0);break;case"time":n=Object(d.a)();break;default:n=Object(x.a)()}return[t,n]}(r),l=e[0],c=e[1],u=[],s=[];t.forEach((function(e){var t="log"===r.y.scale&&0===e.y?1e-6:e.y,n="log"===r.x.scale&&0===e.x?1e-6:e.x;u.push(t),s.push(n)}));var b=Object(f.b)(Object(a.a)(u),r.y),w=Object(f.b)(Object(a.a)(s),r.x);l.domain(w).rangeRound([o,n+o]),c.domain(b).range([i,0]),y({xScale:l,yScale:c})}),[t,n,i,o]),u},b=function(e){var t=Object(s.useState)(""),n=t[0],a=t[1],l=Object(s.useState)(""),o=l[0],c=l[1],u=y(e),f=u.xScale,h=u.yScale;return Object(s.useEffect)((function(){var t,l,o=e.data,u=e.line.curveType,s=void 0===u?i.a:u;if(null!==h){var d=String((t=f,l=h,Object(r.a)().curve(s).x((function(e){return t(e.x)})).y((function(e){return l(e.y)})))(o));d!==n&&(c(n),a(d))}}),[f,h,e.data,e.width,e.line]),{previous:o,current:n}},w=function(e){var t=Object(s.useState)(""),n=t[0],a=t[1],f=Object(s.useState)(""),h=f[0],d=f[1],x=y(e),b=x.xScale,w=x.yScale;return Object(s.useEffect)((function(){var t=e.data,s=e.height,f=e.line.curveType,h=void 0===f?i.a:f;if(null!==w){var x=String(function(){var e=u.a,t=null,n=Object(o.a)(0),a=u.b,i=Object(o.a)(!0),s=null,f=c.a,h=null;function d(r){var o,c,u,d,x,y=r.length,b=!1,w=new Array(y),p=new Array(y);for(null==s&&(h=f(x=Object(l.a)())),o=0;o<=y;++o){if(!(o<y&&i(d=r[o],o,r))===b)if(b=!b)c=o,h.areaStart(),h.lineStart();else{for(h.lineEnd(),h.lineStart(),u=o-1;u>=c;--u)h.point(w[u],p[u]);h.lineEnd(),h.areaEnd()}b&&(w[o]=+e(d,o,r),p[o]=+n(d,o,r),h.point(t?+t(d,o,r):w[o],a?+a(d,o,r):p[o]))}if(x)return h=null,x+""||null}function x(){return Object(r.a)().defined(i).curve(f).context(s)}return d.x=function(n){return arguments.length?(e="function"==typeof n?n:Object(o.a)(+n),t=null,d):e},d.x0=function(t){return arguments.length?(e="function"==typeof t?t:Object(o.a)(+t),d):e},d.x1=function(e){return arguments.length?(t=null==e?null:"function"==typeof e?e:Object(o.a)(+e),d):t},d.y=function(e){return arguments.length?(n="function"==typeof e?e:Object(o.a)(+e),a=null,d):n},d.y0=function(e){return arguments.length?(n="function"==typeof e?e:Object(o.a)(+e),d):n},d.y1=function(e){return arguments.length?(a=null==e?null:"function"==typeof e?e:Object(o.a)(+e),d):a},d.lineX0=d.lineY0=function(){return x().x(e).y(n)},d.lineY1=function(){return x().x(e).y(a)},d.lineX1=function(){return x().x(t).y(n)},d.defined=function(e){return arguments.length?(i="function"==typeof e?e:Object(o.a)(!!e),d):i},d.curve=function(e){return arguments.length?(f=e,null!=s&&(h=f(s)),d):f},d.context=function(e){return arguments.length?(null==e?s=h=null:h=f(s=e),d):s},d}().curve(h).x((function(e){return b(e.x)})).y0((function(e){return s})).y1((function(e){return w(e.y)}))(t));x!==n&&(d(n),a(x))}}),[b,w,e.data]),{previous:h,current:n}}},PcKq:function(e,t,n){"use strict";n.r(t);var a=n("q1tI"),i=n.n(a),r=n("ofer"),l=n("tRbT"),o=n("30+C"),c=n("oa/T"),u=n("VPyp"),s=n("uaBJ"),f=n("ExZL"),h=n("9Dj+"),d=n("H8eV"),x={axis:{x:{height:20,width:400,scale:"linear"},y:{width:20,height:400,scale:"linear"}},height:400,width:400,data:[s.d]},y=function(e){var t=e.x,n=(e.y,e.z),a=e.cx,r=e.cy,l=e.children;return i.a.createElement("text",{x:a,y:r,fontSize:4*n},t>2?"🍎":"🍐",l)};t.default=function(){var e=i.a.createElement(u.a,Object.assign({id:"scatter-demo",PointComponent:function(e){return i.a.createElement(y,e)}},x));return i.a.createElement(h.a,null,i.a.createElement(d.a,{title:"Line Chart",description:""}),i.a.createElement(r.a,{variant:"h2"},"Scatter Chart"),i.a.createElement("div",null,i.a.createElement(l.a,{container:!0,spacing:5,className:"wrapper"},i.a.createElement(l.a,{item:!0,xs:12,md:6},i.a.createElement(o.a,null,i.a.createElement(c.a,null,e)),i.a.createElement("br",null),i.a.createElement(o.a,null,i.a.createElement(c.a,null,i.a.createElement(f.a,{component:e})))),i.a.createElement(l.a,{item:!0,xs:12,md:6}))))}},VPyp:function(e,t,n){"use strict";n("E9XD");var a=n("q1tI"),i=n.n(a),r=n("ress"),l=n("+2RS"),o=n("yO41"),c=n("faMQ"),u=n("o6j4"),s=n("1pFL");t.a=function(e){var t,n,f=e.axis,h=e.clampToZero,d=void 0===h||h,x=e.data,y=e.grid,b=e.height,w=e.width,p=e.xAxisHeight,v=void 0===p?60:p,m=e.yAxisWidth,g=void 0===m?100:m,T=e.title,D=e.description,O=e.axisLabelFormat,k=e.PointComponent,_=Object(s.c)({values:x,clampToZero:d}),j=x.reduce((function(e,t){return e.concat(t.data.map((function(e){return e.x})))}),[]);return i.a.createElement(r.a,{width:w,height:b,title:T,description:D},y&&i.a.createElement(l.a,{left:g,height:b-v,svgProps:Object.assign({},y.x.style),lines:{vertical:y.y.ticks,horizontal:y.x.ticks},width:w-g}),x.map((function(e){return i.a.createElement(a.Fragment,{key:e.label.replace(/[^a-zA-Z0-9-]/,"")},e.point.show&&i.a.createElement(o.a,{axis:f,label:e.label,key:"points-"+e.label,width:w-g,left:g,height:b-v,z:e.point.radius,fill:e.point.fill,showTitle:e.point.showTitle,stroke:e.point.stroke,data:e.data,PointComponent:k}))})),i.a.createElement(u.c,{width:g,height:b-v,scale:null!==(t=f.y.scale)&&void 0!==t?t:"linear",domain:_}),i.a.createElement(c.a,{width:w-g,height:v,labelFormat:O,scale:null!==(n=f.x.scale)&&void 0!==n?n:"band",top:b-v,left:g,values:j.length>4?[j[0],j[Math.floor(j.length/4)],j[Math.floor(j.length/2)],j[Math.floor(j.length*(3/4))]]:j}))}},uaBJ:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return c})),n.d(t,"e",(function(){return u})),n.d(t,"d",(function(){return s})),n.d(t,"c",(function(){return f}));var a=n("+x/X"),i=n("SSiR"),r=new Date,l=new Array(100).fill("").map((function(e,t){return new Date((new Date).setDate(r.getDate()+t))})).map((function(e,t){return{x:e,y:1e3*t}})),o=[{label:"cdd7c30f-4d9b-433c-a5d4-12bb39df89c6 usage",line:{fill:{fill:"rgba(11, 85, 167, 0.7)",show:!0},show:!0,stroke:"#000",strokeDashArray:"0",strokeDashOffset:0,curveType:a.c},point:{fill:"#000",radius:2,show:!0,stroke:"#000"},data:l}],c=[{label:"rob Allocation",line:{curveType:i.a,fill:{fill:"rgba(11, 85, 167, 0.2)",show:!0},show:!0,stroke:"rgb(11, 85, 167)",strokeDashArray:"0",strokeDashOffset:0},point:{fill:"#000",radius:4,show:!0,stroke:""},data:l},{label:"rob'",line:{curveType:i.a,fill:{fill:"rgba(11, 85, 167, 0.7)",show:!0},show:!0,stroke:"#000",strokeDashArray:"0",strokeDashOffset:0},point:{fill:"",radius:0,show:!1,stroke:""},data:[{x:new Date("2019-08-20T00:00:00.000Z"),y:0},{x:new Date("2019-08-21T00:00:00.000Z"),y:0},{x:new Date("2019-08-22T00:00:00.000Z"),y:0},{x:new Date("2019-08-23T00:00:00.000Z"),y:0},{x:new Date("2019-08-24T00:00:00.000Z"),y:0},{x:new Date("2019-08-25T00:00:00.000Z"),y:0},{x:new Date("2019-08-26T00:00:00.000Z"),y:0},{x:new Date("2019-08-27T00:00:00.000Z"),y:0}]},{label:"Their Allocation",line:{curveType:i.a,fill:{fill:"rgba(0, 169, 123, 0.2)",show:!0},show:!0,stroke:"rgb(0, 169, 123)",strokeDashArray:"0",strokeDashOffset:0},point:{fill:"",radius:0,show:!1,stroke:""},data:[{x:new Date("2019-08-20T00:00:00.000Z"),y:0},{x:new Date("2019-08-21T00:00:00.000Z"),y:0},{x:new Date("2019-08-22T00:00:00.000Z"),y:0},{x:new Date("2019-08-23T00:00:00.000Z"),y:0},{x:new Date("2019-08-24T00:00:00.000Z"),y:0},{x:new Date("2019-08-25T00:00:00.000Z"),y:0},{x:new Date("2019-08-26T00:00:00.000Z"),y:0},{x:new Date("2019-08-27T00:00:00.000Z"),y:0}]},{label:"Theirs",line:{curveType:i.a,fill:{fill:"rgba(0, 169, 123, 0.7)",show:!0},show:!0,stroke:"#000",strokeDashArray:"0",strokeDashOffset:0},point:{fill:"",radius:0,show:!1,stroke:""},data:[{x:new Date("2019-08-20T00:00:00.000Z"),y:0},{x:new Date("2019-08-21T00:00:00.000Z"),y:0},{x:new Date("2019-08-22T00:00:00.000Z"),y:0},{x:new Date("2019-08-23T00:00:00.000Z"),y:0},{x:new Date("2019-08-24T00:00:00.000Z"),y:0},{x:new Date("2019-08-25T00:00:00.000Z"),y:0},{x:new Date("2019-08-26T00:00:00.000Z"),y:0},{x:new Date("2019-08-27T00:00:00.000Z"),y:0}]}],u={bins:["16-18","18-25","25-35","35-50","50-65","65-∞"],counts:[{label:"Background",data:[[200,2600,5100,9700,8400,6700],[2002,2100,4700,8700,4900,1400]]},{label:"Foreground",data:[[100,260,510,970,840,670],[1e3,5500,470,870,490,140]]}]},s={label:"Scatter data",point:{fill:"#000",radius:4,show:!0,stroke:""},data:[{x:0,y:1,z:5},{x:2,y:1,z:5},{x:3,y:3,z:10},{x:4,y:4,z:5},{x:5,y:1,z:15},{x:6,y:6,z:5},{x:7,y:7,z:15}]},f=[{label:"Germany",axes:[{axis:"strength",value:13},{axis:"intelligence",value:6},{axis:"charisma",value:5},{axis:"dexterity",value:9},{axis:"luck",value:2}]},{label:"Argentina",axes:[{axis:"strength",value:6},{axis:"intelligence",value:7},{axis:"charisma",value:10},{axis:"dexterity",value:13},{axis:"luck",value:9}]}]},yO41:function(e,t,n){"use strict";var a=n("8o2o"),i=n("q1tI"),r=n.n(i),l=n("8UuD"),o=n("W+EW");t.a=function(e){var t,n=e.data,i=e.z,c=void 0===i?5:i,u=(e.fill,e.stroke,e.showTitle),s=void 0===u||u,f=e.PointComponent,h=Object(l.c)(e),d=h.xScale,x=h.yScale,y="point-"+(null!==(t=e.label)&&void 0!==t?t:"").replace(/[^a-z]/gi,"");return null===x?null:r.a.createElement(r.a.Fragment,null,n.map((function(e){var t,n=e.x,i=e.y,l=(Object(a.a)(e,["x","y"]),x(i)),u=d(n),h=y+"-"+u+"-"+l;return r.a.createElement(o.a,{key:h,id:h,PointComponent:f,cx:u,cy:l,x:n,y:i,z:null!==(t=e.z)&&void 0!==t?t:c},s&&r.a.createElement("title",null,n+", "+i))})))}}}]);
//# sourceMappingURL=component---src-pages-scatter-tsx-06f9ccc5da7dadbb0707.js.map