react-highcharts
Version:
React wrapper for highcharts
1 lines • 3.91 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("highcharts")):"function"==typeof define&&define.amd?define(["react","highcharts"],t):"object"==typeof exports?exports.index=t(require("react"),require("highcharts")):e.index=t(e.React,e.Highcharts)}("undefined"!=typeof self?self:this,function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(t,r){t.exports=e},function(e,t,r){"use strict";(function(n){Object.defineProperty(t,"__esModule",{value:!0});var o,i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(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)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=r(0),u=(o=c)&&o.__esModule?o:{default:o};var f=void 0===n?window:n;t.default=function(t,r){var n=function(e){function n(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return e.chartType=t,e.Highcharts=r,e.displayName="Highcharts"+t,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);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)}(n,c.Component),a(n,[{key:"setChartRef",value:function(e){this.chartRef=e}},{key:"renderChart",value:function(e){var t=this;if(!e)throw new Error("Config must be specified for the "+this.displayName+" component");var r=e.chart;this.chart&&this.chart.destroy(),this.chart=new this.Highcharts[this.chartType](i({},e,{chart:i({},r,{renderTo:this.chartRef})}),this.props.callback),this.props.neverReflow||f&&f.requestAnimationFrame&&requestAnimationFrame(function(){t.chart&&t.chart.options&&t.chart.reflow()})}},{key:"shouldComponentUpdate",value:function(e){return!!(e.neverReflow||e.isPureConfig&&this.props.config===e.config)||(this.renderChart(e.config),!1)}},{key:"getChart",value:function(){if(!this.chart)throw new Error("getChart() should not be called before the component is mounted");return this.chart}},{key:"componentDidMount",value:function(){this.renderChart(this.props.config)}},{key:"componentWillUnmount",value:function(){this.chart.destroy()}},{key:"render",value:function(){return u.default.createElement("div",i({ref:this.setChartRef.bind(this)},this.props.domProps))}}]),n}();n.defaultProps={callback:function(){},domProps:{}};var o=n;return o.Highcharts=r,o.withHighcharts=function(r){return e.exports(t,r)},o},e.exports=t.default}).call(t,r(2))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},,function(e,t,r){e.exports=r(5)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(1)),o=i(r(6));function i(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)("Chart",o.default),e.exports=t.default},function(e,r){e.exports=t}])});