-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 5.42 KB
/
index.js
1
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("d3-shape"),require("d3-scale"));else if("function"==typeof define&&define.amd)define(["react","d3-shape","d3-scale"],t);else{var r="object"==typeof exports?t(require("react"),require("d3-shape"),require("d3-scale")):t(e.react,e["d3-shape"],e["d3-scale"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function i(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var d=n(r(0)),s=n(r(3)),p=n(r(4)),y=n(r(5)),h=n(r(6)),g=n(r(7)),b=r(8),m={data:[],width:160,height:90,color:"#2ebd59",plot:"bars",paddingX:5,paddingY:5},x={bars:p.default,area:s.default,line:y.default,dots:h.default},v=function(e){function t(){return l(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return f(t,e),c(t,[{key:"render",value:function(){var e=Object.assign({},m,this.props);return e.data.length?(e.yScale=(0,b.scaleLinear)().domain([0,Math.max.apply(Math,o(e.data.map(function(e){return e.y})))]).range([e.height-2*e.paddingY,0]),e.xScale=(0,b.scaleLinear)().domain([e.data[0].x||0,e.data[e.data.length-1].x||e.data.length-1]).range([0,e.width-2*e.paddingX]),d.default.createElement("svg",{width:e.width,height:e.height},d.default.createElement("g",{style:{transform:"translate(".concat(e.paddingX,"px,").concat(e.paddingY,"px)")}},x[e.plot](e),e.threshold&&d.default.createElement(g.default,e)))):d.default.createElement("svg",null)}}]),t}(d.default.Component);t.default=v},function(e,t,r){"use strict";function n(e){var t=(0,o.area)().x(function(t,r){return e.xScale(t.x||r)}).y0(e.yScale.range()[0]).y1(function(t){return e.yScale(t.y)});return a.default.createElement("path",{d:t(e.data),fill:e.color})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var a=function(e){return e&&e.__esModule?e:{default:e}}(r(0)),o=r(1)},function(e,t,r){"use strict";function n(e){var t=e.data.length-1,r=e.xScale.range()[1]/t*.15,n=(e.xScale.range()[1]-r*t)/e.data.length,o=n+r;return a.default.createElement("g",null,e.data.map(function(t,r){var l=e.yScale(t.y);return a.default.createElement("rect",{key:r,x:r*o,y:l,height:e.yScale.range()[0]-l,width:n,fill:e.color})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var a=function(e){return e&&e.__esModule?e:{default:e}}(r(0));r(1)},function(e,t,r){"use strict";function n(e){var t=(0,o.line)().x(function(t,r){return e.xScale(t.x||r)}).y(function(t){return e.yScale(t.y)});return a.default.createElement("path",{d:t(e.data),strokeWidth:"1.3",stroke:e.color,fill:"none"})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var a=function(e){return e&&e.__esModule?e:{default:e}}(r(0)),o=r(1)},function(e,t,r){"use strict";function n(e){return a.default.createElement("g",null,e.data.map(function(t,r){return a.default.createElement("circle",{key:r,r:"3",cx:e.xScale(t.x||r),cy:e.yScale(t.y),fill:e.color})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var a=function(e){return e&&e.__esModule?e:{default:e}}(r(0))},function(e,t,r){"use strict";function n(e){var t=e.yScale(e.threshold.value),r=null,n=e.xScale.range()[0],o=e.xScale.range()[1];if(e.threshold.type){var l={x:n,width:o,opacity:"0.3",fill:e.threshold.color||"lightgray"};"above"===e.threshold.type?(l.y=e.yScale.range()[1],l.height=t):"below"===e.threshold.type&&(l.y=t,l.height=e.yScale.range()[0]-t),r=a.default.createElement("rect",l)}return a.default.createElement("g",null,a.default.createElement("line",{y1:t,y2:t,x1:n,x2:o,strokeWidth:"1.3",stroke:e.threshold.color||"lightgray",strokeDasharray:"7 5",fill:"none"}),r)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var a=function(e){return e&&e.__esModule?e:{default:e}}(r(0))},function(e,t){e.exports=r}])});