react-chartjs-2
Advanced tools
Comparing version 1.2.9 to 1.3.0
@@ -8,3 +8,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
}); | ||
exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined; | ||
exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = exports.Bubble = undefined; | ||
@@ -50,3 +50,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
redraw: _react.PropTypes.bool, | ||
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea']), | ||
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']), | ||
width: _react.PropTypes.number | ||
@@ -337,2 +337,28 @@ }, | ||
var Bubble = exports.Bubble = function (_React$Component8) { | ||
_inherits(Bubble, _React$Component8); | ||
function Bubble() { | ||
_classCallCheck(this, Bubble); | ||
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments)); | ||
} | ||
_createClass(Bubble, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _this16 = this; | ||
return _react2.default.createElement(ChartComponent, _extends({}, this.props, { | ||
ref: function ref(_ref8) { | ||
return _this16.chart_instance = _ref8 && _ref8.chart_instance; | ||
}, | ||
type: 'bubble' | ||
})); | ||
} | ||
}]); | ||
return Bubble; | ||
}(_react2.default.Component); | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
@@ -339,0 +365,0 @@ },{"./utils/deepEqual":2,"chart.js":undefined,"react-dom":undefined}],2:[function(require,module,exports){ |
@@ -1,1 +0,1 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){return function t(e,n,r){function o(a,u){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[a]={exports:{}};e[a][0].call(s.exports,function(t){var n=e[a][1][t];return o(n?n:t)},s,s.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){(function(e){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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}function a(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)}Object.defineProperty(n,"__esModule",{value:!0}),n.Polar=n.Radar=n.HorizontalBar=n.Bar=n.Line=n.Pie=n.Doughnut=void 0;var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},f="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,s=r(f),p=t("react-dom"),l=r(p),h=t("chart.js"),d=r(h),y=t("./utils/deepEqual"),_=r(y),b=s["default"].createClass({displayName:"ChartComponent",propTypes:{data:f.PropTypes.object.isRequired,height:f.PropTypes.number,legend:f.PropTypes.object,onElementsClick:f.PropTypes.func,options:f.PropTypes.object,redraw:f.PropTypes.bool,type:f.PropTypes.oneOf(["doughnut","pie","line","bar","horizontalBar","radar","polarArea"]),width:f.PropTypes.number},getDefaultProps:function(){return{legend:{display:!0,position:"bottom"},type:"doughnut",height:150,width:300,redraw:!1}},componentWillMount:function(){this.chart_instance=void 0},componentDidMount:function(){this.renderChart()},componentDidUpdate:function(){this.props.redraw?(this.chart_instance.destroy(),this.renderChart()):this.updateChart()},_objectWithoutProperties:function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},shouldComponentUpdate:function(t,e){var n=["id","width","height","onElementsClick"],r=this._objectWithoutProperties(t,n),o=this._objectWithoutProperties(this.props,n);return!(0,_["default"])(r,o,{strict:!0})},componentWillUnmount:function(){this.chart_instance.destroy()},updateChart:function(){var t=this.props,e=t.data,n=t.options;this.chart_instance&&(n&&(this.chart_instance.options=d["default"].helpers.configMerge(this.chart_instance.options,n)),this.chart_instance.config.data=c({},this.chart_instance.config.data,e),this.chart_instance.update())},renderChart:function(){var t=this.props,e=t.data,n=t.options,r=(t.legend,t.type),o=l["default"].findDOMNode(this);this.chart_instance=new d["default"](o,{type:r,data:e,options:n})},handleOnClick:function(t){var e=this.chart_instance.getElementsAtEvent(t);if(e.length){var n=this.props.onElementsClick;n(e)}},render:function(){var t=this.props,e=t.height,n=t.width,r=t.onElementsClick;return s["default"].createElement("canvas",{height:e,width:n,onClick:"function"==typeof r?this.handleOnClick:null})}});n["default"]=b;n.Doughnut=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"doughnut"}))}}]),e}(s["default"].Component),n.Pie=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"pie"}))}}]),e}(s["default"].Component),n.Line=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"line"}))}}]),e}(s["default"].Component),n.Bar=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"bar"}))}}]),e}(s["default"].Component),n.HorizontalBar=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"horizontalBar"}))}}]),e}(s["default"].Component),n.Radar=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"radar"}))}}]),e}(s["default"].Component),n.Polar=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),u(e,[{key:"render",value:function(){var t=this;return s["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"polarArea"}))}}]),e}(s["default"].Component)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils/deepEqual":2,"chart.js":void 0,"react-dom":void 0}],2:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},o=Object.prototype.hasOwnProperty,i=function(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e},a=function u(t,e){if(i(t,e))return!0;if("object"!==("undefined"==typeof t?"undefined":r(t))||null===t||"object"!==("undefined"==typeof e?"undefined":r(e))||null===e)return!1;for(var n=Object.keys(t),a=0;a<n.length;a++)if(!o.call(e,n[a]))return!1;for(var c in t){if(!e.hasOwnProperty(c))return!1;if(!u(t[c],e[c]))return!1}return!0};n["default"]=a},{}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Chart=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(b){"use strict";function n(a){return a&&a.__esModule?a:{default:a}}function o(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function q(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(c,"__esModule",{value:!0}),c.Polar=c.Radar=c.HorizontalBar=c.Bar=c.Line=c.Pie=c.Doughnut=c.Bubble=void 0;var d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},f="undefined"!=typeof window?window.React:"undefined"!=typeof b?b.React:null,g=n(f),h=a("react-dom"),i=n(h),j=a("chart.js"),k=n(j),l=a("./utils/deepEqual"),m=n(l),r=g.default.createClass({displayName:"ChartComponent",propTypes:{data:f.PropTypes.object.isRequired,height:f.PropTypes.number,legend:f.PropTypes.object,onElementsClick:f.PropTypes.func,options:f.PropTypes.object,redraw:f.PropTypes.bool,type:f.PropTypes.oneOf(["doughnut","pie","line","bar","horizontalBar","radar","polarArea","bubble"]),width:f.PropTypes.number},getDefaultProps:function(){return{legend:{display:!0,position:"bottom"},type:"doughnut",height:150,width:300,redraw:!1}},componentWillMount:function(){this.chart_instance=void 0},componentDidMount:function(){this.renderChart()},componentDidUpdate:function(){this.props.redraw?(this.chart_instance.destroy(),this.renderChart()):this.updateChart()},_objectWithoutProperties:function(b,c){var d={};for(var e in b)c.indexOf(e)>=0||Object.prototype.hasOwnProperty.call(b,e)&&(d[e]=b[e]);return d},shouldComponentUpdate:function(b,c){var d=["id","width","height","onElementsClick"],e=this._objectWithoutProperties(b,d),f=this._objectWithoutProperties(this.props,d);return!(0,m.default)(e,f,{strict:!0})},componentWillUnmount:function(){this.chart_instance.destroy()},updateChart:function(){var b=this.props,c=b.data,d=b.options;this.chart_instance&&(d&&(this.chart_instance.options=k.default.helpers.configMerge(this.chart_instance.options,d)),this.chart_instance.config.data=e({},this.chart_instance.config.data,c),this.chart_instance.update())},renderChart:function(){var b=this.props,c=b.data,d=b.options,f=(b.legend,b.type),g=i.default.findDOMNode(this);this.chart_instance=new k.default(g,{type:f,data:c,options:d})},handleOnClick:function(b){var c=this.chart_instance.getElementsAtEvent(b);if(c.length){var d=this.props.onElementsClick;d(c)}},render:function(){var b=this.props,c=b.height,d=b.width,e=b.onElementsClick;return g.default.createElement("canvas",{height:c,width:d,onClick:"function"==typeof e?this.handleOnClick:null})}});c.default=r;c.Doughnut=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"doughnut"}))}}]),b}(g.default.Component),c.Pie=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"pie"}))}}]),b}(g.default.Component),c.Line=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"line"}))}}]),b}(g.default.Component),c.Bar=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"bar"}))}}]),b}(g.default.Component),c.HorizontalBar=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"horizontalBar"}))}}]),b}(g.default.Component),c.Radar=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"radar"}))}}]),b}(g.default.Component),c.Polar=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"polarArea"}))}}]),b}(g.default.Component),c.Bubble=function(a){function b(){return o(this,b),p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return q(b,a),d(b,[{key:"render",value:function(){var b=this;return g.default.createElement(r,e({},this.props,{ref:function(c){return b.chart_instance=c&&c.chart_instance},type:"bubble"}))}}]),b}(g.default.Component)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils/deepEqual":2,"chart.js":void 0,"react-dom":void 0}],2:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol?"symbol":typeof a},e=Object.prototype.hasOwnProperty,f=function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c},g=function a(b,c){if(f(b,c))return!0;if("object"!==("undefined"==typeof b?"undefined":d(b))||null===b||"object"!==("undefined"==typeof c?"undefined":d(c))||null===c)return!1;for(var g=Object.keys(b),h=0;h<g.length;h++)if(!e.call(c,g[h]))return!1;for(var i in b){if(!c.hasOwnProperty(i))return!1;if(!a(b[i],c[i]))return!1}return!0};c.default=g},{}]},{},[1])(1)}); |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined; | ||
exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = exports.Bubble = undefined; | ||
@@ -48,3 +48,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
redraw: _react.PropTypes.bool, | ||
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea']), | ||
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']), | ||
width: _react.PropTypes.number | ||
@@ -333,2 +333,28 @@ }, | ||
return Polar; | ||
}(_react2.default.Component); | ||
var Bubble = exports.Bubble = function (_React$Component8) { | ||
_inherits(Bubble, _React$Component8); | ||
function Bubble() { | ||
_classCallCheck(this, Bubble); | ||
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments)); | ||
} | ||
_createClass(Bubble, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _this16 = this; | ||
return _react2.default.createElement(ChartComponent, _extends({}, this.props, { | ||
ref: function ref(_ref8) { | ||
return _this16.chart_instance = _ref8 && _ref8.chart_instance; | ||
}, | ||
type: 'bubble' | ||
})); | ||
} | ||
}]); | ||
return Bubble; | ||
}(_react2.default.Component); |
{ | ||
"name": "react-chartjs-2", | ||
"version": "1.2.9", | ||
"version": "1.3.0", | ||
"description": "react-chartjs-2", | ||
@@ -5,0 +5,0 @@ "main": "lib/Chart.js", |
4304224
70082