react-chartjs-2
Advanced tools
Comparing version 2.8.0 to 2.9.0
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("chart.js")):"function"==typeof define&&define.amd?define(["exports","react","chart.js"],e):e(t.ReactChartjs2={},t.React,t.Chart)}(this,function(t,e,n){"use strict";function r(t,e){return e={exports:{}},t(e,e.exports),e.exports}function o(t){return function(){return t}}function a(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function i(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function u(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function c(t){var e=this.__data__=new E(t);this.size=e.size}function s(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new vt;++e<n;)this.add(t[e])}function f(t,e,n,r,o){return t===e||(null==t||null==e||!Zt(t)&&!Zt(e)?t!==t&&e!==e:He(t,e,n,r,f,o))}function p(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(yn);var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=t.apply(this,r);return n.cache=a.set(o,i)||a,i};return n.cache=new(p.Cache||vt),n}function h(t){if("string"==typeof t)return t;if(Nt(t))return On(t,h)+"";if(pn(t))return Pn?Pn.call(t):"";var e=t+"";return"0"==e&&1/t==-wn?"-0":e}e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n;var l="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d=function(){};d.thatReturns=o,d.thatReturnsFalse=o(!1),d.thatReturnsTrue=o(!0),d.thatReturnsNull=o(null),d.thatReturnsThis=function(){return this},d.thatReturnsArgument=function(t){return t};var y=d,v=function(t){},b=function(t,e,n,r,o,a,i,u){if(v(e),!t){var c;if(void 0===e)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,a,i,u],f=0;(c=Error(e.replace(/%s/g,function(){return s[f++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},_="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",g=function(){function t(t,e,n,r,o,a){a!==_&&b(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e};return n.checkPropTypes=y,n.PropTypes=n,n},j=r(function(t){t.exports=g()}),m=function(t,e){return t===e||t!==t&&e!==e},O=function(t,e){for(var n=t.length;n--;)if(m(t[n][0],e))return n;return-1},w=Array.prototype.splice;a.prototype.clear=function(){this.__data__=[],this.size=0},a.prototype.delete=function(t){var e=this.__data__,n=O(e,t);return n>=0&&(n==e.length-1?e.pop():w.call(e,n,1),--this.size,!0)},a.prototype.get=function(t){var e=this.__data__,n=O(e,t);return 0>n?void 0:e[n][1]},a.prototype.has=function(t){return O(this.__data__,t)>-1},a.prototype.set=function(t,e){var n=this.__data__,r=O(n,t);return 0>r?(++this.size,n.push([t,e])):n[r][1]=e,this};var E=a,P="object"==typeof l&&l&&l.Object===Object&&l,A="object"==typeof self&&self&&self.Object===Object&&self,I=P||A||Function("return this")(),C=I.Symbol,D=Object.prototype,z=D.hasOwnProperty,k=D.toString,S=C?C.toStringTag:void 0,T=function(t){var e=z.call(t,S),n=t[S];try{t[S]=void 0;var r=!0}catch(t){}var o=k.call(t);return r&&(e?t[S]=n:delete t[S]),o},x=Object.prototype.toString,R=function(t){return x.call(t)},B="[object Null]",M="[object Undefined]",F=C?C.toStringTag:void 0,L=function(t){return null==t?void 0===t?M:B:F&&F in Object(t)?T(t):R(t)},U=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},K="[object AsyncFunction]",$="[object Function]",W="[object GeneratorFunction]",q="[object Proxy]",V=function(t){if(!U(t))return!1;var e=L(t);return e==$||e==W||e==K||e==q},N=I["__core-js_shared__"],H=function(){var t=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),G=function(t){return!!H&&H in t},Y=Function.prototype.toString,J=function(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Q=/[\\^$.*+?()[\]{}|]/g,X=/^\[object .+?Constructor\]$/,Z=Function.prototype,tt=Object.prototype,et=Z.toString,nt=tt.hasOwnProperty,rt=RegExp("^"+et.call(nt).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ot=function(t){return!(!U(t)||G(t))&&(V(t)?rt:X).test(J(t))},at=function(t,e){return null==t?void 0:t[e]},it=function(t,e){var n=at(t,e);return ot(n)?n:void 0},ut=it(I,"Map"),ct=it(Object,"create"),st="__lodash_hash_undefined__",ft=Object.prototype.hasOwnProperty,pt=Object.prototype.hasOwnProperty,ht="__lodash_hash_undefined__";i.prototype.clear=function(){this.__data__=ct?ct(null):{},this.size=0},i.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},i.prototype.get=function(t){var e=this.__data__;if(ct){var n=e[t];return n===st?void 0:n}return ft.call(e,t)?e[t]:void 0},i.prototype.has=function(t){var e=this.__data__;return ct?void 0!==e[t]:pt.call(e,t)},i.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ct&&void 0===e?ht:e,this};var lt=i,dt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},yt=function(t,e){var n=t.__data__;return dt(e)?n["string"==typeof e?"string":"hash"]:n.map};u.prototype.clear=function(){this.size=0,this.__data__={hash:new lt,map:new(ut||E),string:new lt}},u.prototype.delete=function(t){var e=yt(this,t).delete(t);return this.size-=e?1:0,e},u.prototype.get=function(t){return yt(this,t).get(t)},u.prototype.has=function(t){return yt(this,t).has(t)},u.prototype.set=function(t,e){var n=yt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};var vt=u,bt=200;c.prototype.clear=function(){this.__data__=new E,this.size=0},c.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},c.prototype.get=function(t){return this.__data__.get(t)},c.prototype.has=function(t){return this.__data__.has(t)},c.prototype.set=function(t,e){var n=this.__data__;if(n instanceof E){var r=n.__data__;if(!ut||bt-1>r.length)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new vt(r)}return n.set(t,e),this.size=n.size,this};var _t=c,gt="__lodash_hash_undefined__";s.prototype.add=s.prototype.push=function(t){return this.__data__.set(t,gt),this},s.prototype.has=function(t){return this.__data__.has(t)};var jt=s,mt=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1},Ot=function(t,e){return t.has(e)},wt=1,Et=2,Pt=function(t,e,n,r,o,a){var i=n&wt,u=t.length,c=e.length;if(!(u==c||i&&c>u))return!1;var s=a.get(t);if(s&&a.get(e))return s==e;var f=-1,p=!0,h=n&Et?new jt:void 0;for(a.set(t,e),a.set(e,t);++f<u;){var l=t[f],d=e[f];if(r)var y=i?r(d,l,f,e,t,a):r(l,d,f,t,e,a);if(void 0!==y){if(y)continue;p=!1;break}if(h){if(!mt(e,function(t,e){if(!Ot(h,e)&&(l===t||o(l,t,n,r,a)))return h.push(e)})){p=!1;break}}else if(l!==d&&!o(l,d,n,r,a)){p=!1;break}}return a.delete(t),a.delete(e),p},At=I.Uint8Array,It=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n},Ct=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n},Dt=1,zt=2,kt="[object Boolean]",St="[object Date]",Tt="[object Error]",xt="[object Map]",Rt="[object Number]",Bt="[object RegExp]",Mt="[object Set]",Ft="[object String]",Lt="[object Symbol]",Ut="[object ArrayBuffer]",Kt="[object DataView]",$t=C?C.prototype:void 0,Wt=$t?$t.valueOf:void 0,qt=function(t,e,n,r,o,a,i){switch(n){case Kt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ut:return!(t.byteLength!=e.byteLength||!a(new At(t),new At(e)));case kt:case St:case Rt:return m(+t,+e);case Tt:return t.name==e.name&&t.message==e.message;case Bt:case Ft:return t==e+"";case xt:var u=It;case Mt:var c=r&Dt;if(u||(u=Ct),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;r|=zt,i.set(t,e);var f=Pt(u(t),u(e),r,o,a,i);return i.delete(t),f;case Lt:if(Wt)return Wt.call(t)==Wt.call(e)}return!1},Vt=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t},Nt=Array.isArray,Ht=function(t,e,n){var r=e(t);return Nt(t)?r:Vt(r,n(t))},Gt=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a},Yt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Qt=Jt?function(t){return null==t?[]:(t=Object(t),Gt(Jt(t),function(e){return Yt.call(t,e)}))}:function(){return[]},Xt=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},Zt=function(t){return null!=t&&"object"==typeof t},te="[object Arguments]",ee=function(t){return Zt(t)&&L(t)==te},ne=Object.prototype,re=ne.hasOwnProperty,oe=ne.propertyIsEnumerable,ae=ee(function(){return arguments}())?ee:function(t){return Zt(t)&&re.call(t,"callee")&&!oe.call(t,"callee")},ie=function(){return!1},ue=r(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,o=r&&r.exports===n?I.Buffer:void 0,a=(o?o.isBuffer:void 0)||ie;t.exports=a}),ce=9007199254740991,se=/^(?:0|[1-9]\d*)$/,fe=function(t,e){return!!(e=null==e?ce:e)&&("number"==typeof t||se.test(t))&&t>-1&&t%1==0&&e>t},pe=9007199254740991,he=function(t){return"number"==typeof t&&t>-1&&t%1==0&&pe>=t},le={};le["[object Float32Array]"]=le["[object Float64Array]"]=le["[object Int8Array]"]=le["[object Int16Array]"]=le["[object Int32Array]"]=le["[object Uint8Array]"]=le["[object Uint8ClampedArray]"]=le["[object Uint16Array]"]=le["[object Uint32Array]"]=!0,le["[object Arguments]"]=le["[object Array]"]=le["[object ArrayBuffer]"]=le["[object Boolean]"]=le["[object DataView]"]=le["[object Date]"]=le["[object Error]"]=le["[object Function]"]=le["[object Map]"]=le["[object Number]"]=le["[object Object]"]=le["[object RegExp]"]=le["[object Set]"]=le["[object String]"]=le["[object WeakMap]"]=!1;var de=function(t){return function(e){return t(e)}},ye=r(function(t,e){var n=e&&!e.nodeType&&e,r=n&&!0&&t&&!t.nodeType&&t,o=r&&r.exports===n&&P.process,a=function(){try{return o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}),ve=ye&&ye.isTypedArray,be=ve?de(ve):function(t){return Zt(t)&&he(t.length)&&!!le[L(t)]},_e=Object.prototype.hasOwnProperty,ge=function(t,e){var n=Nt(t),r=!n&&ae(t),o=!n&&!r&&ue(t),a=!n&&!r&&!o&&be(t),i=n||r||o||a,u=i?Xt(t.length,String):[],c=u.length;for(var s in t)!e&&!_e.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||fe(s,c))||u.push(s);return u},je=Object.prototype,me=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||je)},Oe=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),we=Object.prototype.hasOwnProperty,Ee=function(t){if(!me(t))return Oe(t);var e=[];for(var n in Object(t))we.call(t,n)&&"constructor"!=n&&e.push(n);return e},Pe=function(t){return null!=t&&he(t.length)&&!V(t)},Ae=function(t){return Pe(t)?ge(t):Ee(t)},Ie=function(t){return Ht(t,Ae,Qt)},Ce=1,De=Object.prototype.hasOwnProperty,ze=function(t,e,n,r,o,a){var i=n&Ce,u=Ie(t),c=u.length;if(c!=Ie(e).length&&!i)return!1;for(var s=c;s--;){var f=u[s];if(!(i?f in e:De.call(e,f)))return!1}var p=a.get(t);if(p&&a.get(e))return p==e;var h=!0;a.set(t,e),a.set(e,t);for(var l=i;++s<c;){var d=t[f=u[s]],y=e[f];if(r)var v=i?r(y,d,f,e,t,a):r(d,y,f,t,e,a);if(!(void 0===v?d===y||o(d,y,n,r,a):v)){h=!1;break}l||(l="constructor"==f)}if(h&&!l){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(h=!1)}return a.delete(t),a.delete(e),h},ke=it(I,"DataView"),Se=it(I,"Promise"),Te=it(I,"Set"),xe=it(I,"WeakMap"),Re=J(ke),Be=J(ut),Me=J(Se),Fe=J(Te),Le=J(xe),Ue=L;(ke&&"[object DataView]"!=Ue(new ke(new ArrayBuffer(1)))||ut&&"[object Map]"!=Ue(new ut)||Se&&"[object Promise]"!=Ue(Se.resolve())||Te&&"[object Set]"!=Ue(new Te)||xe&&"[object WeakMap]"!=Ue(new xe))&&(Ue=function(t){var e=L(t),n="[object Object]"==e?t.constructor:void 0,r=n?J(n):"";if(r)switch(r){case Re:return"[object DataView]";case Be:return"[object Map]";case Me:return"[object Promise]";case Fe:return"[object Set]";case Le:return"[object WeakMap]"}return e});var Ke=Ue,$e=1,We="[object Arguments]",qe="[object Array]",Ve="[object Object]",Ne=Object.prototype.hasOwnProperty,He=function(t,e,n,r,o,a){var i=Nt(t),u=Nt(e),c=i?qe:Ke(t),s=u?qe:Ke(e),f=(c=c==We?Ve:c)==Ve,p=(s=s==We?Ve:s)==Ve,h=c==s;if(h&&ue(t)){if(!ue(e))return!1;i=!0,f=!1}if(h&&!f)return a||(a=new _t),i||be(t)?Pt(t,e,n,r,o,a):qt(t,e,c,n,r,o,a);if(!(n&$e)){var l=f&&Ne.call(t,"__wrapped__"),d=p&&Ne.call(e,"__wrapped__");if(l||d){var y=l?t.value():t,v=d?e.value():e;return a||(a=new _t),o(y,v,n,r,a)}}return!!h&&(a||(a=new _t),ze(t,e,n,r,o,a))},Ge=f,Ye=function(t,e){return Ge(t,e)},Je=function(){try{var t=it(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Qe=function(t,e,n){"__proto__"==e&&Je?Je(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},Xe=function(t,e,n,r){for(var o=-1,a=null==t?0:t.length;++o<a;){var i=t[o];e(r,i,n(i),t)}return r},Ze=function(t){return function(e,n,r){for(var o=-1,a=Object(e),i=r(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===n(a[c],c,a))break}return e}}(),tn=function(t,e){return function(n,r){if(null==n)return n;if(!Pe(n))return t(n,r);for(var o=n.length,a=e?o:-1,i=Object(n);(e?a--:++a<o)&&!1!==r(i[a],a,i););return n}}(function(t,e){return t&&Ze(t,e,Ae)}),en=function(t,e,n,r){return tn(t,function(t,o,a){e(r,t,n(t),a)}),r},nn=1,rn=2,on=function(t,e,n,r){var o=n.length,a=o,i=!r;if(null==t)return!a;for(t=Object(t);o--;){var u=n[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=n[o])[0],s=t[c],f=u[1];if(i&&u[2]){if(void 0===s&&!(c in t))return!1}else{var p=new _t;if(r)var h=r(s,f,c,t,e,p);if(!(void 0===h?Ge(f,s,nn|rn,r,p):h))return!1}}return!0},an=function(t){return t===t&&!U(t)},un=function(t){for(var e=Ae(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,an(o)]}return e},cn=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}},sn=function(t){var e=un(t);return 1==e.length&&e[0][2]?cn(e[0][0],e[0][1]):function(n){return n===t||on(n,t,e)}},fn="[object Symbol]",pn=function(t){return"symbol"==typeof t||Zt(t)&&L(t)==fn},hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ln=/^\w*$/,dn=function(t,e){if(Nt(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!pn(t))||ln.test(t)||!hn.test(t)||null!=e&&t in Object(e)},yn="Expected a function";p.Cache=vt;var vn=p,bn=500,_n=/^\./,gn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jn=/\\(\\)?/g,mn=function(t){var e=vn(t,function(t){return n.size===bn&&n.clear(),t}),n=e.cache;return e}(function(t){var e=[];return _n.test(t)&&e.push(""),t.replace(gn,function(t,n,r,o){e.push(r?o.replace(jn,"$1"):n||t)}),e}),On=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o},wn=1/0,En=C?C.prototype:void 0,Pn=En?En.toString:void 0,An=h,In=function(t){return null==t?"":An(t)},Cn=function(t,e){return Nt(t)?t:dn(t,e)?[t]:mn(In(t))},Dn=1/0,zn=function(t){if("string"==typeof t||pn(t))return t;var e=t+"";return"0"==e&&1/t==-Dn?"-0":e},kn=function(t,e){for(var n=0,r=(e=Cn(e,t)).length;null!=t&&r>n;)t=t[zn(e[n++])];return n&&n==r?t:void 0},Sn=function(t,e,n){var r=null==t?void 0:kn(t,e);return void 0===r?n:r},Tn=function(t,e){return null!=t&&e in Object(t)},xn=function(t,e,n){for(var r=-1,o=(e=Cn(e,t)).length,a=!1;++r<o;){var i=zn(e[r]);if(!(a=null!=t&&n(t,i)))break;t=t[i]}return a||++r!=o?a:!!(o=null==t?0:t.length)&&he(o)&&fe(i,o)&&(Nt(t)||ae(t))},Rn=function(t,e){return null!=t&&xn(t,e,Tn)},Bn=1,Mn=2,Fn=function(t,e){return dn(t)&&an(e)?cn(zn(t),e):function(n){var r=Sn(n,t);return void 0===r&&r===e?Rn(n,t):Ge(e,r,Bn|Mn)}},Ln=function(t){return t},Un=function(t){return function(e){return null==e?void 0:e[t]}},Kn=function(t){return function(e){return kn(e,t)}},$n=function(t){return dn(t)?Un(zn(t)):Kn(t)},Wn=function(t){return"function"==typeof t?t:null==t?Ln:"object"==typeof t?Nt(t)?Fn(t[0],t[1]):sn(t):$n(t)},qn=function(t,e){return function(n,r){var o=Nt(n)?Xe:en,a=e?e():{};return o(n,t,Wn(r,2),a)}}(function(t,e,n){Qe(t,n,e)}),Vn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Nn=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Hn=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},Gn=function(t,e){var n={};for(var r in t)0>e.indexOf(r)&&Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},Yn=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Jn="undefined"!=typeof process&&process.env&&"production",Qn=function(t){function r(){Vn(this,r);var e=Yn(this,t.call(this));return e.handleOnClick=function(t){var n=e.chartInstance,r=e.props,o=r.getDatasetAtEvent,a=r.getElementAtEvent,i=r.getElementsAtEvent,u=r.onElementsClick;o&&o(n.getDatasetAtEvent(t),t),a&&a(n.getElementAtEvent(t),t),i&&i(n.getElementsAtEvent(t),t),u&&u(n.getElementsAtEvent(t),t)},e.ref=function(t){e.element=t},e.chartInstance=void 0,e}return Hn(r,t),r.prototype.componentDidMount=function(){this.renderChart()},r.prototype.componentDidUpdate=function(){if(this.props.redraw)return this.destroyChart(),void this.renderChart();this.updateChart()},r.prototype.shouldComponentUpdate=function(t){var e=this.props,n=e.type,r=e.options,o=e.plugins,a=e.legend,i=e.height,u=e.width;if(!0===t.redraw)return!0;if(i!==t.height||u!==t.width)return!0;if(n!==t.type)return!0;if(!Ye(a,t.legend))return!0;if(!Ye(r,t.options))return!0;var c=this.transformDataProp(t);return!Ye(this.shadowDataProp,c)||!Ye(o,t.plugins)},r.prototype.componentWillUnmount=function(){this.destroyChart()},r.prototype.transformDataProp=function(t){var e=t.data;return"function"==typeof e?e(this.element):e},r.prototype.memoizeDataProps=function(){if(this.props.data){var t=this.transformDataProp(this.props);return this.shadowDataProp=Nn({},t,{datasets:t.datasets&&t.datasets.map(function(t){return Nn({},t)})}),this.saveCurrentDatasets(),t}},r.prototype.checkDatasets=function(t){var e="production"!==Jn&&"prod"!==Jn,n=this.props.datasetKeyProvider!==r.getLabelAsKey,o=t.length>1;if(e&&o&&!n){var a=!1;t.forEach(function(t){t.label||(a=!0)}),a&&console.error('[react-chartjs-2] Warning: Each dataset needs a unique key. By default, the "label" property on each dataset is used. Alternatively, you may provide a "datasetKeyProvider" as a prop that returns a unique key.')}},r.prototype.getCurrentDatasets=function(){return this.chartInstance&&this.chartInstance.config.data&&this.chartInstance.config.data.datasets||[]},r.prototype.saveCurrentDatasets=function(){var t=this;this.datasets=this.datasets||{},this.getCurrentDatasets().forEach(function(e){t.datasets[t.props.datasetKeyProvider(e)]=e})},r.prototype.updateChart=function(){var t=this,e=this.props.options,r=this.memoizeDataProps(this.props);if(this.chartInstance){e&&(this.chartInstance.options=n.helpers.configMerge(this.chartInstance.options,e));var o=this.getCurrentDatasets(),a=r.datasets||[];this.checkDatasets(o);var i=qn(o,this.props.datasetKeyProvider);this.chartInstance.config.data.datasets=a.map(function(e){var n=i[t.props.datasetKeyProvider(e)];if(n&&n.type===e.type&&e.data){n.data.splice(e.data.length),e.data.forEach(function(t,r){n.data[r]=e.data[r]});var r=Gn(e,["data"]);return Nn({},n,r)}return e});var u=Gn(r,["datasets"]);this.chartInstance.config.data=Nn({},this.chartInstance.config.data,u),this.chartInstance.update()}},r.prototype.renderChart=function(){var t=this.props,e=t.options,o=t.legend,a=t.type,i=t.plugins,u=this.element,c=this.memoizeDataProps();void 0===o||Ye(r.defaultProps.legend,o)||(e.legend=o),this.chartInstance=new n(u,{type:a,data:c,options:e,plugins:i})},r.prototype.destroyChart=function(){this.saveCurrentDatasets();var t=Object.values(this.datasets);this.chartInstance.config.data.datasets=t,this.chartInstance.destroy()},r.prototype.render=function(){var t=this.props,n=t.height,r=t.width,o=t.id;return e.createElement("canvas",{ref:this.ref,height:n,width:r,id:o,onClick:this.handleOnClick})},r}(e.Component);Qn.getLabelAsKey=function(t){return t.label},Qn.propTypes={data:j.oneOfType([j.object,j.func]).isRequired,getDatasetAtEvent:j.func,getElementAtEvent:j.func,getElementsAtEvent:j.func,height:j.number,legend:j.object,onElementsClick:j.func,options:j.object,plugins:j.arrayOf(j.object),redraw:j.bool,type:function(t,e,r){if(!n.controllers[t[e]])return Error("Invalid chart type `"+t[e]+"` supplied to `"+r+"`.")},width:j.number,datasetKeyProvider:j.func},Qn.defaultProps={legend:{display:!0,position:"bottom"},type:"doughnut",height:150,width:300,redraw:!1,options:{},datasetKeyProvider:Qn.getLabelAsKey};var Xn=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"doughnut"}))},n}(e.Component),Zn=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"pie"}))},n}(e.Component),tr=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"line"}))},n}(e.Component),er=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"bar"}))},n}(e.Component),nr=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"horizontalBar"}))},n}(e.Component),rr=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"radar"}))},n}(e.Component),or=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"polarArea"}))},n}(e.Component),ar=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"bubble"}))},n}(e.Component),ir=function(t){function n(){return Vn(this,n),Yn(this,t.apply(this,arguments))}return Hn(n,t),n.prototype.render=function(){var t=this;return e.createElement(Qn,Nn({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"scatter"}))},n}(e.Component),ur=n.defaults;t.default=Qn,t.Doughnut=Xn,t.Pie=Zn,t.Line=tr,t.Bar=er,t.HorizontalBar=nr,t.Radar=rr,t.Polar=or,t.Bubble=ar,t.Scatter=ir,t.defaults=ur,t.Chart=n,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("chart.js")):"function"==typeof define&&define.amd?define(["exports","react","chart.js"],e):e(t.ReactChartjs2={},t.React,t.Chart)}(this,function(t,e,r){"use strict";function n(t,e){return e={exports:{}},t(e,e.exports),e.exports}function o(t){return function(){return t}}function a(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function c(t){var e=this.__data__=new E(t);this.size=e.size}function s(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new vt;++e<r;)this.add(t[e])}function f(t,e,r,n,o){return t===e||(null==t||null==e||!Zt(t)&&!Zt(e)?t!==t&&e!==e:He(t,e,r,n,f,o))}function p(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(dr);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=t.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(p.Cache||vt),r}function h(t){if("string"==typeof t)return t;if(Nt(t))return jr(t,h)+"";if(fr(t))return wr?wr.call(t):"";var e=t+"";return"0"==e&&1/t==-mr?"-0":e}e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var l="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d=function(){};d.thatReturns=o,d.thatReturnsFalse=o(!1),d.thatReturnsTrue=o(!0),d.thatReturnsNull=o(null),d.thatReturnsThis=function(){return this},d.thatReturnsArgument=function(t){return t};var y=d,v=function(t){},b=function(t,e,r,n,o,a,i,u){if(v(e),!t){var c;if(void 0===e)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,o,a,i,u],f=0;(c=Error(e.replace(/%s/g,function(){return s[f++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}},_="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",g=function(){function t(t,e,r,n,o,a){a!==_&&b(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var r={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e};return r.checkPropTypes=y,r.PropTypes=r,r},j=n(function(t){t.exports=g()}),m=function(t,e){return t===e||t!==t&&e!==e},O=function(t,e){for(var r=t.length;r--;)if(m(t[r][0],e))return r;return-1},w=Array.prototype.splice;a.prototype.clear=function(){this.__data__=[],this.size=0},a.prototype.delete=function(t){var e=this.__data__,r=O(e,t);return r>=0&&(r==e.length-1?e.pop():w.call(e,r,1),--this.size,!0)},a.prototype.get=function(t){var e=this.__data__,r=O(e,t);return 0>r?void 0:e[r][1]},a.prototype.has=function(t){return O(this.__data__,t)>-1},a.prototype.set=function(t,e){var r=this.__data__,n=O(r,t);return 0>n?(++this.size,r.push([t,e])):r[n][1]=e,this};var E=a,P="object"==typeof l&&l&&l.Object===Object&&l,A="object"==typeof self&&self&&self.Object===Object&&self,I=P||A||Function("return this")(),C=I.Symbol,D=Object.prototype,z=D.hasOwnProperty,k=D.toString,S=C?C.toStringTag:void 0,T=function(t){var e=z.call(t,S),r=t[S];try{t[S]=void 0;var n=!0}catch(t){}var o=k.call(t);return n&&(e?t[S]=r:delete t[S]),o},x=Object.prototype.toString,R=function(t){return x.call(t)},B="[object Null]",M="[object Undefined]",F=C?C.toStringTag:void 0,L=function(t){return null==t?void 0===t?M:B:F&&F in Object(t)?T(t):R(t)},U=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},K="[object AsyncFunction]",$="[object Function]",q="[object GeneratorFunction]",W="[object Proxy]",V=function(t){if(!U(t))return!1;var e=L(t);return e==$||e==q||e==K||e==W},N=I["__core-js_shared__"],H=function(){var t=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),G=function(t){return!!H&&H in t},Y=Function.prototype.toString,J=function(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Q=/[\\^$.*+?()[\]{}|]/g,X=/^\[object .+?Constructor\]$/,Z=Function.prototype,tt=Object.prototype,et=Z.toString,rt=tt.hasOwnProperty,nt=RegExp("^"+et.call(rt).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ot=function(t){return!(!U(t)||G(t))&&(V(t)?nt:X).test(J(t))},at=function(t,e){return null==t?void 0:t[e]},it=function(t,e){var r=at(t,e);return ot(r)?r:void 0},ut=it(I,"Map"),ct=it(Object,"create"),st="__lodash_hash_undefined__",ft=Object.prototype.hasOwnProperty,pt=Object.prototype.hasOwnProperty,ht="__lodash_hash_undefined__";i.prototype.clear=function(){this.__data__=ct?ct(null):{},this.size=0},i.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},i.prototype.get=function(t){var e=this.__data__;if(ct){var r=e[t];return r===st?void 0:r}return ft.call(e,t)?e[t]:void 0},i.prototype.has=function(t){var e=this.__data__;return ct?void 0!==e[t]:pt.call(e,t)},i.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ct&&void 0===e?ht:e,this};var lt=i,dt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},yt=function(t,e){var r=t.__data__;return dt(e)?r["string"==typeof e?"string":"hash"]:r.map};u.prototype.clear=function(){this.size=0,this.__data__={hash:new lt,map:new(ut||E),string:new lt}},u.prototype.delete=function(t){var e=yt(this,t).delete(t);return this.size-=e?1:0,e},u.prototype.get=function(t){return yt(this,t).get(t)},u.prototype.has=function(t){return yt(this,t).has(t)},u.prototype.set=function(t,e){var r=yt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};var vt=u,bt=200;c.prototype.clear=function(){this.__data__=new E,this.size=0},c.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},c.prototype.get=function(t){return this.__data__.get(t)},c.prototype.has=function(t){return this.__data__.has(t)},c.prototype.set=function(t,e){var r=this.__data__;if(r instanceof E){var n=r.__data__;if(!ut||bt-1>n.length)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new vt(n)}return r.set(t,e),this.size=r.size,this};var _t=c,gt="__lodash_hash_undefined__";s.prototype.add=s.prototype.push=function(t){return this.__data__.set(t,gt),this},s.prototype.has=function(t){return this.__data__.has(t)};var jt=s,mt=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1},Ot=function(t,e){return t.has(e)},wt=1,Et=2,Pt=function(t,e,r,n,o,a){var i=r&wt,u=t.length,c=e.length;if(!(u==c||i&&c>u))return!1;var s=a.get(t);if(s&&a.get(e))return s==e;var f=-1,p=!0,h=r&Et?new jt:void 0;for(a.set(t,e),a.set(e,t);++f<u;){var l=t[f],d=e[f];if(n)var y=i?n(d,l,f,e,t,a):n(l,d,f,t,e,a);if(void 0!==y){if(y)continue;p=!1;break}if(h){if(!mt(e,function(t,e){if(!Ot(h,e)&&(l===t||o(l,t,r,n,a)))return h.push(e)})){p=!1;break}}else if(l!==d&&!o(l,d,r,n,a)){p=!1;break}}return a.delete(t),a.delete(e),p},At=I.Uint8Array,It=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r},Ct=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r},Dt=1,zt=2,kt="[object Boolean]",St="[object Date]",Tt="[object Error]",xt="[object Map]",Rt="[object Number]",Bt="[object RegExp]",Mt="[object Set]",Ft="[object String]",Lt="[object Symbol]",Ut="[object ArrayBuffer]",Kt="[object DataView]",$t=C?C.prototype:void 0,qt=$t?$t.valueOf:void 0,Wt=function(t,e,r,n,o,a,i){switch(r){case Kt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ut:return!(t.byteLength!=e.byteLength||!a(new At(t),new At(e)));case kt:case St:case Rt:return m(+t,+e);case Tt:return t.name==e.name&&t.message==e.message;case Bt:case Ft:return t==e+"";case xt:var u=It;case Mt:var c=n&Dt;if(u||(u=Ct),t.size!=e.size&&!c)return!1;var s=i.get(t);if(s)return s==e;n|=zt,i.set(t,e);var f=Pt(u(t),u(e),n,o,a,i);return i.delete(t),f;case Lt:if(qt)return qt.call(t)==qt.call(e)}return!1},Vt=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t},Nt=Array.isArray,Ht=function(t,e,r){var n=e(t);return Nt(t)?n:Vt(n,r(t))},Gt=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,a=[];++r<n;){var i=t[r];e(i,r,t)&&(a[o++]=i)}return a},Yt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Qt=Jt?function(t){return null==t?[]:(t=Object(t),Gt(Jt(t),function(e){return Yt.call(t,e)}))}:function(){return[]},Xt=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},Zt=function(t){return null!=t&&"object"==typeof t},te="[object Arguments]",ee=function(t){return Zt(t)&&L(t)==te},re=Object.prototype,ne=re.hasOwnProperty,oe=re.propertyIsEnumerable,ae=ee(function(){return arguments}())?ee:function(t){return Zt(t)&&ne.call(t,"callee")&&!oe.call(t,"callee")},ie=function(){return!1},ue=n(function(t,e){var r=e&&!e.nodeType&&e,n=r&&!0&&t&&!t.nodeType&&t,o=n&&n.exports===r?I.Buffer:void 0,a=(o?o.isBuffer:void 0)||ie;t.exports=a}),ce=9007199254740991,se=/^(?:0|[1-9]\d*)$/,fe=function(t,e){var r=typeof t;return!!(e=null==e?ce:e)&&("number"==r||"symbol"!=r&&se.test(t))&&t>-1&&t%1==0&&e>t},pe=9007199254740991,he=function(t){return"number"==typeof t&&t>-1&&t%1==0&&pe>=t},le={};le["[object Float32Array]"]=le["[object Float64Array]"]=le["[object Int8Array]"]=le["[object Int16Array]"]=le["[object Int32Array]"]=le["[object Uint8Array]"]=le["[object Uint8ClampedArray]"]=le["[object Uint16Array]"]=le["[object Uint32Array]"]=!0,le["[object Arguments]"]=le["[object Array]"]=le["[object ArrayBuffer]"]=le["[object Boolean]"]=le["[object DataView]"]=le["[object Date]"]=le["[object Error]"]=le["[object Function]"]=le["[object Map]"]=le["[object Number]"]=le["[object Object]"]=le["[object RegExp]"]=le["[object Set]"]=le["[object String]"]=le["[object WeakMap]"]=!1;var de=function(t){return function(e){return t(e)}},ye=n(function(t,e){var r=e&&!e.nodeType&&e,n=r&&!0&&t&&!t.nodeType&&t,o=n&&n.exports===r&&P.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}),ve=ye&&ye.isTypedArray,be=ve?de(ve):function(t){return Zt(t)&&he(t.length)&&!!le[L(t)]},_e=Object.prototype.hasOwnProperty,ge=function(t,e){var r=Nt(t),n=!r&&ae(t),o=!r&&!n&&ue(t),a=!r&&!n&&!o&&be(t),i=r||n||o||a,u=i?Xt(t.length,String):[],c=u.length;for(var s in t)!e&&!_e.call(t,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||fe(s,c))||u.push(s);return u},je=Object.prototype,me=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||je)},Oe=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),we=Object.prototype.hasOwnProperty,Ee=function(t){if(!me(t))return Oe(t);var e=[];for(var r in Object(t))we.call(t,r)&&"constructor"!=r&&e.push(r);return e},Pe=function(t){return null!=t&&he(t.length)&&!V(t)},Ae=function(t){return Pe(t)?ge(t):Ee(t)},Ie=function(t){return Ht(t,Ae,Qt)},Ce=1,De=Object.prototype.hasOwnProperty,ze=function(t,e,r,n,o,a){var i=r&Ce,u=Ie(t),c=u.length;if(c!=Ie(e).length&&!i)return!1;for(var s=c;s--;){var f=u[s];if(!(i?f in e:De.call(e,f)))return!1}var p=a.get(t);if(p&&a.get(e))return p==e;var h=!0;a.set(t,e),a.set(e,t);for(var l=i;++s<c;){var d=t[f=u[s]],y=e[f];if(n)var v=i?n(y,d,f,e,t,a):n(d,y,f,t,e,a);if(!(void 0===v?d===y||o(d,y,r,n,a):v)){h=!1;break}l||(l="constructor"==f)}if(h&&!l){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(h=!1)}return a.delete(t),a.delete(e),h},ke=it(I,"DataView"),Se=it(I,"Promise"),Te=it(I,"Set"),xe=it(I,"WeakMap"),Re=J(ke),Be=J(ut),Me=J(Se),Fe=J(Te),Le=J(xe),Ue=L;(ke&&"[object DataView]"!=Ue(new ke(new ArrayBuffer(1)))||ut&&"[object Map]"!=Ue(new ut)||Se&&"[object Promise]"!=Ue(Se.resolve())||Te&&"[object Set]"!=Ue(new Te)||xe&&"[object WeakMap]"!=Ue(new xe))&&(Ue=function(t){var e=L(t),r="[object Object]"==e?t.constructor:void 0,n=r?J(r):"";if(n)switch(n){case Re:return"[object DataView]";case Be:return"[object Map]";case Me:return"[object Promise]";case Fe:return"[object Set]";case Le:return"[object WeakMap]"}return e});var Ke=Ue,$e=1,qe="[object Arguments]",We="[object Array]",Ve="[object Object]",Ne=Object.prototype.hasOwnProperty,He=function(t,e,r,n,o,a){var i=Nt(t),u=Nt(e),c=i?We:Ke(t),s=u?We:Ke(e),f=(c=c==qe?Ve:c)==Ve,p=(s=s==qe?Ve:s)==Ve,h=c==s;if(h&&ue(t)){if(!ue(e))return!1;i=!0,f=!1}if(h&&!f)return a||(a=new _t),i||be(t)?Pt(t,e,r,n,o,a):Wt(t,e,c,r,n,o,a);if(!(r&$e)){var l=f&&Ne.call(t,"__wrapped__"),d=p&&Ne.call(e,"__wrapped__");if(l||d){var y=l?t.value():t,v=d?e.value():e;return a||(a=new _t),o(y,v,r,n,a)}}return!!h&&(a||(a=new _t),ze(t,e,r,n,o,a))},Ge=f,Ye=function(t,e){return Ge(t,e)},Je=function(){try{var t=it(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Qe=function(t,e,r){"__proto__"==e&&Je?Je(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},Xe=function(t,e,r,n){for(var o=-1,a=null==t?0:t.length;++o<a;){var i=t[o];e(n,i,r(i),t)}return n},Ze=function(t){return function(e,r,n){for(var o=-1,a=Object(e),i=n(e),u=i.length;u--;){var c=i[t?u:++o];if(!1===r(a[c],c,a))break}return e}}(),tr=function(t,e){return function(r,n){if(null==r)return r;if(!Pe(r))return t(r,n);for(var o=r.length,a=e?o:-1,i=Object(r);(e?a--:++a<o)&&!1!==n(i[a],a,i););return r}}(function(t,e){return t&&Ze(t,e,Ae)}),er=function(t,e,r,n){return tr(t,function(t,o,a){e(n,t,r(t),a)}),n},rr=1,nr=2,or=function(t,e,r,n){var o=r.length,a=o,i=!n;if(null==t)return!a;for(t=Object(t);o--;){var u=r[o];if(i&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=r[o])[0],s=t[c],f=u[1];if(i&&u[2]){if(void 0===s&&!(c in t))return!1}else{var p=new _t;if(n)var h=n(s,f,c,t,e,p);if(!(void 0===h?Ge(f,s,rr|nr,n,p):h))return!1}}return!0},ar=function(t){return t===t&&!U(t)},ir=function(t){for(var e=Ae(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ar(o)]}return e},ur=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}},cr=function(t){var e=ir(t);return 1==e.length&&e[0][2]?ur(e[0][0],e[0][1]):function(r){return r===t||or(r,t,e)}},sr="[object Symbol]",fr=function(t){return"symbol"==typeof t||Zt(t)&&L(t)==sr},pr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hr=/^\w*$/,lr=function(t,e){if(Nt(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!fr(t))||hr.test(t)||!pr.test(t)||null!=e&&t in Object(e)},dr="Expected a function";p.Cache=vt;var yr=p,vr=500,br=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_r=/\\(\\)?/g,gr=function(t){var e=yr(t,function(t){return r.size===vr&&r.clear(),t}),r=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(br,function(t,r,n,o){e.push(n?o.replace(_r,"$1"):r||t)}),e}),jr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},mr=1/0,Or=C?C.prototype:void 0,wr=Or?Or.toString:void 0,Er=h,Pr=function(t){return null==t?"":Er(t)},Ar=function(t,e){return Nt(t)?t:lr(t,e)?[t]:gr(Pr(t))},Ir=1/0,Cr=function(t){if("string"==typeof t||fr(t))return t;var e=t+"";return"0"==e&&1/t==-Ir?"-0":e},Dr=function(t,e){for(var r=0,n=(e=Ar(e,t)).length;null!=t&&n>r;)t=t[Cr(e[r++])];return r&&r==n?t:void 0},zr=function(t,e,r){var n=null==t?void 0:Dr(t,e);return void 0===n?r:n},kr=function(t,e){return null!=t&&e in Object(t)},Sr=function(t,e,r){for(var n=-1,o=(e=Ar(e,t)).length,a=!1;++n<o;){var i=Cr(e[n]);if(!(a=null!=t&&r(t,i)))break;t=t[i]}return a||++n!=o?a:!!(o=null==t?0:t.length)&&he(o)&&fe(i,o)&&(Nt(t)||ae(t))},Tr=function(t,e){return null!=t&&Sr(t,e,kr)},xr=1,Rr=2,Br=function(t,e){return lr(t)&&ar(e)?ur(Cr(t),e):function(r){var n=zr(r,t);return void 0===n&&n===e?Tr(r,t):Ge(e,n,xr|Rr)}},Mr=function(t){return t},Fr=function(t){return function(e){return null==e?void 0:e[t]}},Lr=function(t){return function(e){return Dr(e,t)}},Ur=function(t){return lr(t)?Fr(Cr(t)):Lr(t)},Kr=function(t){return"function"==typeof t?t:null==t?Mr:"object"==typeof t?Nt(t)?Br(t[0],t[1]):cr(t):Ur(t)},$r=function(t,e){return function(r,n){var o=Nt(r)?Xe:er,a=e?e():{};return o(r,t,Kr(n,2),a)}}(function(t,e,r){Qe(t,r,e)}),qr=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Wr=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Vr=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},Nr=function(t,e){var r={};for(var n in t)0>e.indexOf(n)&&Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},Hr=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Gr="undefined"!=typeof process&&process.env&&"production",Yr=function(t){function n(){qr(this,n);var e=Hr(this,t.call(this));return e.handleOnClick=function(t){var r=e.chartInstance,n=e.props,o=n.getDatasetAtEvent,a=n.getElementAtEvent,i=n.getElementsAtEvent,u=n.onElementsClick;o&&o(r.getDatasetAtEvent(t),t),a&&a(r.getElementAtEvent(t),t),i&&i(r.getElementsAtEvent(t),t),u&&u(r.getElementsAtEvent(t),t)},e.ref=function(t){e.element=t},e.chartInstance=void 0,e}return Vr(n,t),n.prototype.componentDidMount=function(){this.renderChart()},n.prototype.componentDidUpdate=function(){if(this.props.redraw)return this.destroyChart(),void this.renderChart();this.updateChart()},n.prototype.shouldComponentUpdate=function(t){var e=this.props,r=e.type,n=e.options,o=e.plugins,a=e.legend,i=e.height,u=e.width;if(!0===t.redraw)return!0;if(i!==t.height||u!==t.width)return!0;if(r!==t.type)return!0;if(!Ye(a,t.legend))return!0;if(!Ye(n,t.options))return!0;var c=this.transformDataProp(t);return!Ye(this.shadowDataProp,c)||!Ye(o,t.plugins)},n.prototype.componentWillUnmount=function(){this.destroyChart()},n.prototype.transformDataProp=function(t){var e=t.data;return"function"==typeof e?e(this.element):e},n.prototype.memoizeDataProps=function(){if(this.props.data){var t=this.transformDataProp(this.props);return this.shadowDataProp=Wr({},t,{datasets:t.datasets&&t.datasets.map(function(t){return Wr({},t)})}),this.saveCurrentDatasets(),t}},n.prototype.checkDatasets=function(t){var e="production"!==Gr&&"prod"!==Gr,r=this.props.datasetKeyProvider!==n.getLabelAsKey,o=t.length>1;if(e&&o&&!r){var a=!1;t.forEach(function(t){t.label||(a=!0)}),a&&console.error('[react-chartjs-2] Warning: Each dataset needs a unique key. By default, the "label" property on each dataset is used. Alternatively, you may provide a "datasetKeyProvider" as a prop that returns a unique key.')}},n.prototype.getCurrentDatasets=function(){return this.chartInstance&&this.chartInstance.config.data&&this.chartInstance.config.data.datasets||[]},n.prototype.saveCurrentDatasets=function(){var t=this;this.datasets=this.datasets||{},this.getCurrentDatasets().forEach(function(e){t.datasets[t.props.datasetKeyProvider(e)]=e})},n.prototype.updateChart=function(){var t=this,e=this.props.options,n=this.memoizeDataProps(this.props);if(this.chartInstance){e&&(this.chartInstance.options=r.helpers.configMerge(this.chartInstance.options,e));var o=this.getCurrentDatasets(),a=n.datasets||[];this.checkDatasets(o);var i=$r(o,this.props.datasetKeyProvider);this.chartInstance.config.data.datasets=a.map(function(e){var r=i[t.props.datasetKeyProvider(e)];if(r&&r.type===e.type&&e.data){r.data.splice(e.data.length),e.data.forEach(function(t,n){r.data[n]=e.data[n]});var n=Nr(e,["data"]);return Wr({},r,n)}return e});var u=Nr(n,["datasets"]);this.chartInstance.config.data=Wr({},this.chartInstance.config.data,u),this.chartInstance.update()}},n.prototype.renderChart=function(){var t=this.props,e=t.options,o=t.legend,a=t.type,i=t.plugins,u=this.element,c=this.memoizeDataProps();void 0===o||Ye(n.defaultProps.legend,o)||(e.legend=o),this.chartInstance=new r(u,{type:a,data:c,options:e,plugins:i})},n.prototype.destroyChart=function(){if(this.chartInstance){this.saveCurrentDatasets();var t=Object.values(this.datasets);this.chartInstance.config.data.datasets=t,this.chartInstance.destroy()}},n.prototype.render=function(){var t=this.props,r=t.height,n=t.width,o=t.id;return e.createElement("canvas",{ref:this.ref,height:r,width:n,id:o,onClick:this.handleOnClick})},n}(e.Component);Yr.getLabelAsKey=function(t){return t.label},Yr.propTypes={data:j.oneOfType([j.object,j.func]).isRequired,getDatasetAtEvent:j.func,getElementAtEvent:j.func,getElementsAtEvent:j.func,height:j.number,legend:j.object,onElementsClick:j.func,options:j.object,plugins:j.arrayOf(j.object),redraw:j.bool,type:function(t,e,n){if(!r.controllers[t[e]])return Error("Invalid chart type `"+t[e]+"` supplied to `"+n+"`.")},width:j.number,datasetKeyProvider:j.func},Yr.defaultProps={legend:{display:!0,position:"bottom"},type:"doughnut",height:150,width:300,redraw:!1,options:{},datasetKeyProvider:Yr.getLabelAsKey};var Jr=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"doughnut"}))},r}(e.Component),Qr=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"pie"}))},r}(e.Component),Xr=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"line"}))},r}(e.Component),Zr=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"bar"}))},r}(e.Component),tn=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"horizontalBar"}))},r}(e.Component),en=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"radar"}))},r}(e.Component),rn=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"polarArea"}))},r}(e.Component),nn=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"bubble"}))},r}(e.Component),on=function(t){function r(){return qr(this,r),Hr(this,t.apply(this,arguments))}return Vr(r,t),r.prototype.render=function(){var t=this;return e.createElement(Yr,Wr({},this.props,{ref:function(e){return t.chartInstance=e&&e.chartInstance},type:"scatter"}))},r}(e.Component),an=r.defaults;t.default=Yr,t.Doughnut=Jr,t.Pie=Qr,t.Line=Xr,t.Bar=Zr,t.HorizontalBar=tn,t.Radar=en,t.Polar=rn,t.Bubble=nn,t.Scatter=on,t.defaults=an,t.Chart=r,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -256,2 +256,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
ChartComponent.prototype.destroyChart = function destroyChart() { | ||
if (!this.chartInstance) { | ||
return; | ||
} | ||
// Put all of the datasets that have existed in the chart back on the chart | ||
@@ -258,0 +262,0 @@ // so that the metadata associated with this chart get destroyed. |
@@ -277,2 +277,6 @@ 'use strict'; | ||
ChartComponent.prototype.destroyChart = function destroyChart() { | ||
if (!this.chartInstance) { | ||
return; | ||
} | ||
// Put all of the datasets that have existed in the chart back on the chart | ||
@@ -279,0 +283,0 @@ // so that the metadata associated with this chart get destroyed. |
{ | ||
"name": "react-chartjs-2", | ||
"version": "2.8.0", | ||
"version": "2.9.0", | ||
"description": "react-chartjs-2", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -88,10 +88,15 @@ [![build status]( https://img.shields.io/travis/jerairrest/react-chartjs-2.svg?branch=master&style=flat-square)](https://travis-ci.org/jerairrest/react-chartjs-2) | ||
```js | ||
chartReference = {}; | ||
class MyComponent extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.chartReference = React.createRef(); | ||
} | ||
componentDidMount() { | ||
console.log(this.chartReference); // returns a Chart.js instance reference | ||
} | ||
componentDidMount() { | ||
console.log(this.chartReference); // returns a Chart.js instance reference | ||
} | ||
render() { | ||
return (<Doughnut ref={(reference) => this.chartReference = reference } data={data} />) | ||
render() { | ||
return (<Doughnut ref={this.chartReference} data={data} options={options} />) | ||
} | ||
} | ||
@@ -98,0 +103,0 @@ ``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
502452
5581
230