Socket
Socket
Sign inDemoInstall

react-chartjs-2

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-chartjs-2 - npm Package Compare versions

Comparing version 1.5.6 to 1.6.0

test/__tests__/Chart_spec.js

2345

dist/react-chartjs-2.js
(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.index = 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){
(function (global){
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are **not** supported.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = isEqual;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],2:[function(require,module,exports){
(function (global){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.Chart = exports.defaults = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
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; };
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; }; }();
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; };
var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);

@@ -26,8 +1679,10 @@

var _deepEqual = require('./utils/deepEqual');
var _lodash = require('lodash.isequal');
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -39,427 +1694,441 @@

function _objectWithoutProperties2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var ChartComponent = function (_React$Component) {
_inherits(ChartComponent, _React$Component);
var ChartComponent = _react2.default.createClass({
function ChartComponent() {
var _ref;
displayName: 'ChartComponent',
var _temp, _this, _ret;
propTypes: {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
},
_classCallCheck(this, ChartComponent);
getDefaultProps: function getDefaultProps() {
return {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false
};
},
componentWillMount: function componentWillMount() {
this.chart_instance = undefined;
},
componentDidMount: function componentDidMount() {
this.renderChart();
},
componentDidUpdate: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
} else {
this.updateChart();
}
},
_objectWithoutProperties: function _objectWithoutProperties(obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var ignoredProperties = ['id', 'width', 'height', 'onElementsClick'];
var compareNext = this._objectWithoutProperties(nextProps, ignoredProperties);
var compareNow = this._objectWithoutProperties(this.props, ignoredProperties);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return !(0, _deepEqual2.default)(compareNext, compareNow, { strict: true });
},
componentWillUnmount: function componentWillUnmount() {
this.chart_instance.destroy();
},
updateChart: function updateChart() {
var _props = this.props,
data = _props.data,
options = _props.options;
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ChartComponent.__proto__ || Object.getPrototypeOf(ChartComponent)).call.apply(_ref, [this].concat(args))), _this), _this.handleOnClick = function (event) {
var instance = _this.chart_instance;
var _this$props = _this.props,
getDatasetAtEvent = _this$props.getDatasetAtEvent,
getElementAtEvent = _this$props.getElementAtEvent,
getElementsAtEvent = _this$props.getElementsAtEvent,
onElementsClick = _this$props.onElementsClick;
if (!this.chart_instance) return;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
}, _temp), _possibleConstructorReturn(_this, _ret);
}
var currentData = this.chart_instance.config.data.datasets;
var nextData = data.datasets;
_createClass(ChartComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.chart_instance = undefined;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.renderChart();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
return;
}
nextData.forEach(function (dataset, sid) {
if (currentData[sid] && currentData[sid].data) {
currentData[sid].data.splice(nextData[sid].data.length);
this.updateChart();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
var _props = this.props,
redraw = _props.redraw,
type = _props.type,
options = _props.options,
legend = _props.legend,
height = _props.height,
width = _props.width;
dataset.data.forEach(function (point, pid) {
currentData[sid].data[pid] = nextData[sid].data[pid];
});
var _data = dataset.data,
otherProps = _objectWithoutProperties2(dataset, ['data']);
if (nextProps.redraw === true) {
return true;
}
currentData[sid] = _extends({
data: currentData[sid].data
}, currentData[sid], otherProps);
} else {
currentData[sid] = nextData[sid];
}
});
delete data.datasets;
if (height !== nextProps.height || width !== nextProps.width) {
return true;
}
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, data);
if (type !== nextProps.type) {
return true;
}
this.chart_instance.update();
},
renderChart: function renderChart() {
var _props2 = this.props,
data = _props2.data,
options = _props2.options,
legend = _props2.legend,
type = _props2.type;
if (!(0, _lodash2.default)(legend, nextProps.legend)) {
return true;
}
var node = _reactDom2.default.findDOMNode(this);
if (!(0, _lodash2.default)(options, nextProps.options)) {
return true;
}
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
},
handleOnClick: function handleOnClick(event) {
var instance = this.chart_instance;
return !(0, _lodash2.default)(this.shadowDataProp, nextProps.data);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.chart_instance.destroy();
}
var _props3 = this.props,
getDatasetAtEvent = _props3.getDatasetAtEvent,
getElementAtEvent = _props3.getElementAtEvent,
getElementsAtEvent = _props3.getElementsAtEvent,
onElementsClick = _props3.onElementsClick;
// Chart.js directly mutates the data.dataset objects by adding _meta proprerty
// this makes impossible to compare the current and next data changes
// therefore we memoize the data prop while sending a fake to Chart.js for mutation.
// see https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L615-L617
}, {
key: 'memoizeDataProps',
value: function memoizeDataProps() {
var data = this.props.data;
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
},
render: function render() {
var _props4 = this.props,
height = _props4.height,
width = _props4.width,
onElementsClick = _props4.onElementsClick;
if (!data) {
return;
}
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
});
this.shadowDataProp = _extends({}, data, {
datasets: data.datasets && data.datasets.map(function (set) {
return Object.assign({}, set);
})
});
}
}, {
key: 'updateChart',
value: function updateChart() {
var _props2 = this.props,
data = _props2.data,
options = _props2.options;
exports.default = ChartComponent;
var Doughnut = exports.Doughnut = function (_React$Component) {
_inherits(Doughnut, _React$Component);
this.memoizeDataProps();
function Doughnut() {
_classCallCheck(this, Doughnut);
if (!this.chart_instance) return;
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this2 = this;
// Pipe datasets to chart instance datasets enabling
// seamless transitions
var currentDatasets = this.chart_instance.config.data && this.chart_instance.config.data.datasets || [];
var nextDatasets = data.datasets || [];
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref) {
return _this2.chart_instance = _ref && _ref.chart_instance;
},
type: 'doughnut'
}));
}
}]);
nextDatasets.forEach(function (dataset, sid) {
if (currentDatasets[sid] && currentDatasets[sid].data) {
currentDatasets[sid].data.splice(nextDatasets[sid].data.length);
return Doughnut;
}(_react2.default.Component);
dataset.data.forEach(function (point, pid) {
currentDatasets[sid].data[pid] = nextDatasets[sid].data[pid];
});
var Pie = exports.Pie = function (_React$Component2) {
_inherits(Pie, _React$Component2);
var _data = dataset.data,
otherProps = _objectWithoutProperties(dataset, ['data']);
function Pie() {
_classCallCheck(this, Pie);
currentDatasets[sid] = _extends({
data: currentDatasets[sid].data
}, currentDatasets[sid], otherProps);
} else {
currentDatasets[sid] = nextDatasets[sid];
}
});
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
var datasets = data.datasets,
rest = _objectWithoutProperties(data, ['datasets']);
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this4 = this;
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, rest);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this4.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'pie'
}));
}
}]);
this.chart_instance.update();
}
}, {
key: 'renderChart',
value: function renderChart() {
var _props3 = this.props,
data = _props3.data,
options = _props3.options,
legend = _props3.legend,
type = _props3.type,
redraw = _props3.redraw;
return Pie;
var node = _reactDom2.default.findDOMNode(this);
this.memoizeDataProps();
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
}
}, {
key: 'render',
value: function render() {
var _props4 = this.props,
height = _props4.height,
width = _props4.width,
onElementsClick = _props4.onElementsClick;
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
}]);
return ChartComponent;
}(_react2.default.Component);
var Line = exports.Line = function (_React$Component3) {
_inherits(Line, _React$Component3);
ChartComponent.propTypes = {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
};
ChartComponent.defaultProps = {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false,
options: {}
};
exports.default = ChartComponent;
function Line() {
_classCallCheck(this, Line);
var Doughnut = exports.Doughnut = function (_React$Component2) {
_inherits(Doughnut, _React$Component2);
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
function Doughnut() {
_classCallCheck(this, Doughnut);
_createClass(Line, [{
key: 'render',
value: function render() {
var _this6 = this;
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this6.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'line'
}));
}
}]);
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this3 = this;
return Line;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this3.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return Doughnut;
}(_react2.default.Component);
var Bar = exports.Bar = function (_React$Component4) {
_inherits(Bar, _React$Component4);
var Pie = exports.Pie = function (_React$Component3) {
_inherits(Pie, _React$Component3);
function Bar() {
_classCallCheck(this, Bar);
function Pie() {
_classCallCheck(this, Pie);
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this8 = this;
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this5 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this8.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'bar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this5.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'pie'
}));
}
}]);
return Bar;
return Pie;
}(_react2.default.Component);
var HorizontalBar = exports.HorizontalBar = function (_React$Component5) {
_inherits(HorizontalBar, _React$Component5);
var Line = exports.Line = function (_React$Component4) {
_inherits(Line, _React$Component4);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
function Line() {
_classCallCheck(this, Line);
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this10 = this;
_createClass(Line, [{
key: 'render',
value: function render() {
var _this7 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this10.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this7.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'line'
}));
}
}]);
return HorizontalBar;
return Line;
}(_react2.default.Component);
var Radar = exports.Radar = function (_React$Component6) {
_inherits(Radar, _React$Component6);
var Bar = exports.Bar = function (_React$Component5) {
_inherits(Bar, _React$Component5);
function Radar() {
_classCallCheck(this, Radar);
function Bar() {
_classCallCheck(this, Bar);
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this12 = this;
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this9 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this12.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'radar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this9.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'bar'
}));
}
}]);
return Radar;
return Bar;
}(_react2.default.Component);
var Polar = exports.Polar = function (_React$Component7) {
_inherits(Polar, _React$Component7);
var HorizontalBar = exports.HorizontalBar = function (_React$Component6) {
_inherits(HorizontalBar, _React$Component6);
function Polar() {
_classCallCheck(this, Polar);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this14 = this;
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this11 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this14.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this11.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return Polar;
return HorizontalBar;
}(_react2.default.Component);
var Bubble = exports.Bubble = function (_React$Component8) {
_inherits(Bubble, _React$Component8);
var Radar = exports.Radar = function (_React$Component7) {
_inherits(Radar, _React$Component7);
function Bubble() {
_classCallCheck(this, Bubble);
function Radar() {
_classCallCheck(this, Radar);
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this16 = this;
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this13 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this16.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'bubble'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this13.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'radar'
}));
}
}]);
return Bubble;
return Radar;
}(_react2.default.Component);
var defaults = exports.defaults = _chart2.default.defaults;
exports.Chart = _chart2.default;
var Polar = exports.Polar = function (_React$Component8) {
_inherits(Polar, _React$Component8);
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./utils/deepEqual":2,"chart.js":undefined,"react-dom":undefined}],2:[function(require,module,exports){
'use strict';
function Polar() {
_classCallCheck(this, Polar);
Object.defineProperty(exports, "__esModule", {
value: true
});
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this15 = this;
var hasOwnProperty = Object.prototype.hasOwnProperty;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this15.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'polarArea'
}));
}
}]);
var is = function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
};
return Polar;
}(_react2.default.Component);
var deepEqual = function deepEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
var Bubble = exports.Bubble = function (_React$Component9) {
_inherits(Bubble, _React$Component9);
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
return false;
}
function Bubble() {
_classCallCheck(this, Bubble);
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
var allKeys = keysA.concat(keysB);
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
// Verify both objects have all the keys
for (var i = 0; i < allKeys.length; i++) {
if (!hasOwnProperty.call(objB, allKeys[i])) {
return false;
}
if (!hasOwnProperty.call(objA, allKeys[i])) {
return false;
}
}
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this17 = this;
for (var propty in objA) {
if (objB.hasOwnProperty(propty)) {
if (!deepEqual(objA[propty], objB[propty])) {
return false;
}
} else {
return false;
}
}
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref9) {
return _this17.chart_instance = _ref9 && _ref9.chart_instance;
},
type: 'bubble'
}));
}
}]);
return true;
};
return Bubble;
}(_react2.default.Component);
exports.default = deepEqual;
var defaults = exports.defaults = _chart2.default.defaults;
exports.Chart = _chart2.default;
},{}]},{},[1])(1)
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"chart.js":undefined,"lodash.isequal":1,"react-dom":undefined}]},{},[2])(2)
});

2

dist/react-chartjs-2.min.js

@@ -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.index=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)}function u(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}Object.defineProperty(n,"__esModule",{value:!0}),n.Chart=n.defaults=n.Bubble=n.Polar=n.Radar=n.HorizontalBar=n.Bar=n.Line=n.Pie=n.Doughnut=void 0;var c=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}}(),f=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},s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,p=r(s),l=t("react-dom"),d=r(l),h=t("chart.js"),y=r(h),_=t("./utils/deepEqual"),b=r(_),v=p["default"].createClass({displayName:"ChartComponent",propTypes:{data:s.PropTypes.object.isRequired,getDatasetAtEvent:s.PropTypes.func,getElementAtEvent:s.PropTypes.func,getElementsAtEvent:s.PropTypes.func,height:s.PropTypes.number,legend:s.PropTypes.object,onElementsClick:s.PropTypes.func,options:s.PropTypes.object,redraw:s.PropTypes.bool,type:s.PropTypes.oneOf(["doughnut","pie","line","bar","horizontalBar","radar","polarArea","bubble"]),width:s.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,b["default"])(r,o,{strict:!0})},componentWillUnmount:function(){this.chart_instance.destroy()},updateChart:function(){var t=this.props,e=t.data,n=t.options;if(this.chart_instance){n&&(this.chart_instance.options=y["default"].helpers.configMerge(this.chart_instance.options,n));var r=this.chart_instance.config.data.datasets,o=e.datasets;o.forEach(function(t,e){if(r[e]&&r[e].data){r[e].data.splice(o[e].data.length),t.data.forEach(function(t,n){r[e].data[n]=o[e].data[n]});var n=(t.data,u(t,["data"]));r[e]=f({data:r[e].data},r[e],n)}else r[e]=o[e]}),delete e.datasets,this.chart_instance.config.data=f({},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=d["default"].findDOMNode(this);this.chart_instance=new y["default"](o,{type:r,data:e,options:n})},handleOnClick:function(t){var e=this.chart_instance,n=this.props,r=n.getDatasetAtEvent,o=n.getElementAtEvent,i=n.getElementsAtEvent,a=n.onElementsClick;r&&r(e.getDatasetAtEvent(t),t),o&&o(e.getElementAtEvent(t),t),i&&i(e.getElementsAtEvent(t),t),a&&a(e.getElementsAtEvent(t),t)},render:function(){var t=this.props,e=t.height,n=t.width;t.onElementsClick;return p["default"].createElement("canvas",{height:e,width:n,onClick:this.handleOnClick})}});n["default"]=v;n.Doughnut=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"doughnut"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"pie"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"line"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"bar"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"horizontalBar"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"radar"}))}}]),e}(p["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),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"polarArea"}))}}]),e}(p["default"].Component),n.Bubble=function(t){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"render",value:function(){var t=this;return p["default"].createElement(v,f({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"bubble"}))}}]),e}(p["default"].Component),n.defaults=y["default"].defaults;n.Chart=y["default"]}).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&&t!==Symbol.prototype?"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=Object.keys(e),c=n.concat(a),f=0;f<c.length;f++){if(!o.call(e,c[f]))return!1;if(!o.call(t,c[f]))return!1}for(var s in t){if(!e.hasOwnProperty(s))return!1;if(!u(t[s],e[s]))return!1}return!0};n["default"]=a},{}]},{},[1])(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.index=t()}}(function(){return function t(e,n,r){function o(i,u){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!u&&c)return c(i,!0);if(a)return a(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var f=n[i]={exports:{}};e[i][0].call(f.exports,function(t){var n=e[i][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,e,n){(function(t){function r(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function o(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function a(t){return function(e){return t(e)}}function i(t,e){return null==t?void 0:t[e]}function u(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(n){}return e}function c(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function s(t,e){return function(n){return t(e(n))}}function f(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function l(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function p(){this.__data__=we?we(null):{}}function h(t){return this.has(t)&&delete this.__data__[t]}function d(t){var e=this.__data__;if(we){var n=e[t];return n===ht?void 0:n}return se.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return we?void 0!==e[t]:se.call(e,t)}function y(t,e){var n=this.__data__;return n[t]=we&&void 0===e?ht:e,this}function v(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function b(){this.__data__=[]}function g(t){var e=this.__data__,n=F(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():_e.call(e,n,1),!0}function m(t){var e=this.__data__,n=F(e,t);return n<0?void 0:e[n][1]}function j(t){return F(this.__data__,t)>-1}function w(t,e){var n=this.__data__,r=F(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function O(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function E(){this.__data__={hash:new l,map:new(be||v),string:new l}}function P(t){return K(this,t)["delete"](t)}function A(t){return K(this,t).get(t)}function k(t){return K(this,t).has(t)}function C(t,e){return K(this,t).set(t,e),this}function T(t){var e=-1,n=t?t.length:0;for(this.__data__=new O;++e<n;)this.add(t[e])}function D(t){return this.__data__.set(t,ht),this}function x(t){return this.__data__.has(t)}function z(t){this.__data__=new v(t)}function B(){this.__data__=new v}function M(t){return this.__data__["delete"](t)}function S(t){return this.__data__.get(t)}function U(t){return this.__data__.has(t)}function R(t,e){var n=this.__data__;if(n instanceof v){var r=n.__data__;if(!be||r.length<pt-1)return r.push([t,e]),this;n=this.__data__=new O(r)}return n.set(t,e),this}function q(t,e){var n=xe(t)||rt(t)?o(t.length,String):[],r=n.length,a=!!r;for(var i in t)!e&&!se.call(t,i)||a&&("length"==i||X(i,r))||n.push(i);return n}function F(t,e){for(var n=t.length;n--;)if(nt(t[n][0],e))return n;return-1}function L(t){return fe.call(t)}function $(t,e,n,r,o){return t===e||(null==t||null==e||!st(t)&&!ft(e)?t!==t&&e!==e:I(t,e,$,n,r,o))}function I(t,e,n,r,o,a){var i=xe(t),c=xe(e),s=bt,f=bt;i||(s=De(t),s=s==vt?At:s),c||(f=De(e),f=f==vt?At:f);var l=s==At&&!u(t),p=f==At&&!u(e),h=s==f;if(h&&!l)return a||(a=new z),i||ze(t)?V(t,e,n,r,o,a):G(t,e,s,n,r,o,a);if(!(o&_t)){var d=l&&se.call(t,"__wrapped__"),_=p&&se.call(e,"__wrapped__");if(d||_){var y=d?t.value():t,v=_?e.value():e;return a||(a=new z),n(y,v,r,o,a)}}return!!h&&(a||(a=new z),J(t,e,n,r,o,a))}function N(t){if(!st(t)||Z(t))return!1;var e=ut(t)||u(t)?le:Ht;return e.test(et(t))}function W(t){return ft(t)&&ct(t.length)&&!!Gt[fe.call(t)]}function H(t){if(!tt(t))return ye(t);var e=[];for(var n in Object(t))se.call(t,n)&&"constructor"!=n&&e.push(n);return e}function V(t,e,n,o,a,i){var u=a&_t,c=t.length,s=e.length;if(c!=s&&!(u&&s>c))return!1;var f=i.get(t);if(f&&i.get(e))return f==e;var l=-1,p=!0,h=a&dt?new T:void 0;for(i.set(t,e),i.set(e,t);++l<c;){var d=t[l],_=e[l];if(o)var y=u?o(_,d,l,e,t,i):o(d,_,l,t,e,i);if(void 0!==y){if(y)continue;p=!1;break}if(h){if(!r(e,function(t,e){if(!h.has(e)&&(d===t||n(d,t,o,a,i)))return h.add(e)})){p=!1;break}}else if(d!==_&&!n(d,_,o,a,i)){p=!1;break}}return i["delete"](t),i["delete"](e),p}function G(t,e,n,r,o,a,i){switch(n){case Mt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Bt:return!(t.byteLength!=e.byteLength||!r(new he(t),new he(e)));case gt:case mt:case Pt:return nt(+t,+e);case jt:return t.name==e.name&&t.message==e.message;case Ct:case Dt:return t==e+"";case Et:var u=c;case Tt:var s=a&_t;if(u||(u=f),t.size!=e.size&&!s)return!1;var l=i.get(t);if(l)return l==e;a|=dt,i.set(t,e);var p=V(u(t),u(e),r,o,a,i);return i["delete"](t),p;case xt:if(Te)return Te.call(t)==Te.call(e)}return!1}function J(t,e,n,r,o,a){var i=o&_t,u=lt(t),c=u.length,s=lt(e),f=s.length;if(c!=f&&!i)return!1;for(var l=c;l--;){var p=u[l];if(!(i?p in e:se.call(e,p)))return!1}var h=a.get(t);if(h&&a.get(e))return h==e;var d=!0;a.set(t,e),a.set(e,t);for(var _=i;++l<c;){p=u[l];var y=t[p],v=e[p];if(r)var b=i?r(v,y,p,e,t,a):r(y,v,p,t,e,a);if(!(void 0===b?y===v||n(y,v,r,o,a):b)){d=!1;break}_||(_="constructor"==p)}if(d&&!_){var g=t.constructor,m=e.constructor;g!=m&&"constructor"in t&&"constructor"in e&&!("function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m)&&(d=!1)}return a["delete"](t),a["delete"](e),d}function K(t,e){var n=t.__data__;return Y(e)?n["string"==typeof e?"string":"hash"]:n.map}function Q(t,e){var n=i(t,e);return N(n)?n:void 0}function X(t,e){return e=null==e?yt:e,!!e&&("number"==typeof t||Vt.test(t))&&t>-1&&t%1==0&&t<e}function Y(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function Z(t){return!!ue&&ue in t}function tt(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||ae;return t===n}function et(t){if(null!=t){try{return ce.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function nt(t,e){return t===e||t!==t&&e!==e}function rt(t){return at(t)&&se.call(t,"callee")&&(!de.call(t,"callee")||fe.call(t)==vt)}function ot(t){return null!=t&&ct(t.length)&&!ut(t)}function at(t){return ft(t)&&ot(t)}function it(t,e){return $(t,e)}function ut(t){var e=st(t)?fe.call(t):"";return e==wt||e==Ot}function ct(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=yt}function st(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ft(t){return!!t&&"object"==typeof t}function lt(t){return ot(t)?q(t):H(t)}var pt=200,ht="__lodash_hash_undefined__",dt=1,_t=2,yt=9007199254740991,vt="[object Arguments]",bt="[object Array]",gt="[object Boolean]",mt="[object Date]",jt="[object Error]",wt="[object Function]",Ot="[object GeneratorFunction]",Et="[object Map]",Pt="[object Number]",At="[object Object]",kt="[object Promise]",Ct="[object RegExp]",Tt="[object Set]",Dt="[object String]",xt="[object Symbol]",zt="[object WeakMap]",Bt="[object ArrayBuffer]",Mt="[object DataView]",St="[object Float32Array]",Ut="[object Float64Array]",Rt="[object Int8Array]",qt="[object Int16Array]",Ft="[object Int32Array]",Lt="[object Uint8Array]",$t="[object Uint8ClampedArray]",It="[object Uint16Array]",Nt="[object Uint32Array]",Wt=/[\\^$.*+?()[\]{}|]/g,Ht=/^\[object .+?Constructor\]$/,Vt=/^(?:0|[1-9]\d*)$/,Gt={};Gt[St]=Gt[Ut]=Gt[Rt]=Gt[qt]=Gt[Ft]=Gt[Lt]=Gt[$t]=Gt[It]=Gt[Nt]=!0,Gt[vt]=Gt[bt]=Gt[Bt]=Gt[gt]=Gt[Mt]=Gt[mt]=Gt[jt]=Gt[wt]=Gt[Et]=Gt[Pt]=Gt[At]=Gt[Ct]=Gt[Tt]=Gt[Dt]=Gt[zt]=!1;var Jt="object"==typeof t&&t&&t.Object===Object&&t,Kt="object"==typeof self&&self&&self.Object===Object&&self,Qt=Jt||Kt||Function("return this")(),Xt="object"==typeof n&&n&&!n.nodeType&&n,Yt=Xt&&"object"==typeof e&&e&&!e.nodeType&&e,Zt=Yt&&Yt.exports===Xt,te=Zt&&Jt.process,ee=function(){try{return te&&te.binding("util")}catch(t){}}(),ne=ee&&ee.isTypedArray,re=Array.prototype,oe=Function.prototype,ae=Object.prototype,ie=Qt["__core-js_shared__"],ue=function(){var t=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ce=oe.toString,se=ae.hasOwnProperty,fe=ae.toString,le=RegExp("^"+ce.call(se).replace(Wt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pe=Qt.Symbol,he=Qt.Uint8Array,de=ae.propertyIsEnumerable,_e=re.splice,ye=s(Object.keys,Object),ve=Q(Qt,"DataView"),be=Q(Qt,"Map"),ge=Q(Qt,"Promise"),me=Q(Qt,"Set"),je=Q(Qt,"WeakMap"),we=Q(Object,"create"),Oe=et(ve),Ee=et(be),Pe=et(ge),Ae=et(me),ke=et(je),Ce=pe?pe.prototype:void 0,Te=Ce?Ce.valueOf:void 0;l.prototype.clear=p,l.prototype["delete"]=h,l.prototype.get=d,l.prototype.has=_,l.prototype.set=y,v.prototype.clear=b,v.prototype["delete"]=g,v.prototype.get=m,v.prototype.has=j,v.prototype.set=w,O.prototype.clear=E,O.prototype["delete"]=P,O.prototype.get=A,O.prototype.has=k,O.prototype.set=C,T.prototype.add=T.prototype.push=D,T.prototype.has=x,z.prototype.clear=B,z.prototype["delete"]=M,z.prototype.get=S,z.prototype.has=U,z.prototype.set=R;var De=L;(ve&&De(new ve(new ArrayBuffer(1)))!=Mt||be&&De(new be)!=Et||ge&&De(ge.resolve())!=kt||me&&De(new me)!=Tt||je&&De(new je)!=zt)&&(De=function(t){var e=fe.call(t),n=e==At?t.constructor:void 0,r=n?et(n):void 0;if(r)switch(r){case Oe:return Mt;case Ee:return Et;case Pe:return kt;case Ae:return Tt;case ke:return zt}return e});var xe=Array.isArray,ze=ne?a(ne):W;e.exports=it}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){(function(e){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(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}function a(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 u(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.Chart=n.defaults=n.Bubble=n.Polar=n.Radar=n.HorizontalBar=n.Bar=n.Line=n.Pie=n.Doughnut=void 0;var 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},s=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}}(),f="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,l=r(f),p=t("react-dom"),h=r(p),d=t("chart.js"),_=r(d),y=t("lodash.isequal"),v=r(y),b=function(t){function e(){var t,n,r,o;a(this,e);for(var u=arguments.length,c=Array(u),s=0;s<u;s++)c[s]=arguments[s];return n=r=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(c))),r.handleOnClick=function(t){var e=r.chart_instance,n=r.props,o=n.getDatasetAtEvent,a=n.getElementAtEvent,i=n.getElementsAtEvent,u=n.onElementsClick;o&&o(e.getDatasetAtEvent(t),t),a&&a(e.getElementAtEvent(t),t),i&&i(e.getElementsAtEvent(t),t),u&&u(e.getElementsAtEvent(t),t)},o=n,i(r,o)}return u(e,t),s(e,[{key:"componentWillMount",value:function(){this.chart_instance=void 0}},{key:"componentDidMount",value:function(){this.renderChart()}},{key:"componentDidUpdate",value:function(){return this.props.redraw?(this.chart_instance.destroy(),void this.renderChart()):void this.updateChart()}},{key:"shouldComponentUpdate",value:function(t){var e=this.props,n=(e.redraw,e.type),r=e.options,o=e.legend,a=e.height,i=e.width;return t.redraw===!0||(a!==t.height||i!==t.width||(n!==t.type||(!(0,v["default"])(o,t.legend)||(!(0,v["default"])(r,t.options)||!(0,v["default"])(this.shadowDataProp,t.data)))))}},{key:"componentWillUnmount",value:function(){this.chart_instance.destroy()}},{key:"memoizeDataProps",value:function(){var t=this.props.data;t&&(this.shadowDataProp=c({},t,{datasets:t.datasets&&t.datasets.map(function(t){return Object.assign({},t)})}))}},{key:"updateChart",value:function(){var t=this.props,e=t.data,n=t.options;if(this.memoizeDataProps(),this.chart_instance){n&&(this.chart_instance.options=_["default"].helpers.configMerge(this.chart_instance.options,n));var r=this.chart_instance.config.data&&this.chart_instance.config.data.datasets||[],a=e.datasets||[];a.forEach(function(t,e){if(r[e]&&r[e].data){r[e].data.splice(a[e].data.length),t.data.forEach(function(t,n){r[e].data[n]=a[e].data[n]});var n=(t.data,o(t,["data"]));r[e]=c({data:r[e].data},r[e],n)}else r[e]=a[e]});var i=(e.datasets,o(e,["datasets"]));this.chart_instance.config.data=c({},this.chart_instance.config.data,i),this.chart_instance.update()}}},{key:"renderChart",value:function(){var t=this.props,e=t.data,n=t.options,r=(t.legend,t.type),o=(t.redraw,h["default"].findDOMNode(this));this.memoizeDataProps(),this.chart_instance=new _["default"](o,{type:r,data:e,options:n})}},{key:"render",value:function(){var t=this.props,e=t.height,n=t.width;t.onElementsClick;return l["default"].createElement("canvas",{height:e,width:n,onClick:this.handleOnClick})}}]),e}(l["default"].Component);b.propTypes={data:f.PropTypes.object.isRequired,getDatasetAtEvent:f.PropTypes.func,getElementAtEvent:f.PropTypes.func,getElementsAtEvent:f.PropTypes.func,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},b.defaultProps={legend:{display:!0,position:"bottom"},type:"doughnut",height:150,width:300,redraw:!1,options:{}},n["default"]=b;n.Doughnut=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"doughnut"}))}}]),e}(l["default"].Component),n.Pie=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"pie"}))}}]),e}(l["default"].Component),n.Line=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"line"}))}}]),e}(l["default"].Component),n.Bar=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"bar"}))}}]),e}(l["default"].Component),n.HorizontalBar=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"horizontalBar"}))}}]),e}(l["default"].Component),n.Radar=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"radar"}))}}]),e}(l["default"].Component),n.Polar=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"polarArea"}))}}]),e}(l["default"].Component),n.Bubble=function(t){function e(){return a(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return u(e,t),s(e,[{key:"render",value:function(){var t=this;return l["default"].createElement(b,c({},this.props,{ref:function(e){return t.chart_instance=e&&e.chart_instance},type:"bubble"}))}}]),e}(l["default"].Component),n.defaults=_["default"].defaults;n.Chart=_["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"chart.js":void 0,"lodash.isequal":1,"react-dom":void 0}]},{},[2])(2)});
require=(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){
'use strict';
(function (global){
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
var is = function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
};
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
var deepEqual = function deepEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
return false;
}
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
var allKeys = keysA.concat(keysB);
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
// Verify both objects have all the keys
for (var i = 0; i < allKeys.length; i++) {
if (!hasOwnProperty.call(objB, allKeys[i])) {
return false;
}
if (!hasOwnProperty.call(objA, allKeys[i])) {
return false;
}
}
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
for (var propty in objA) {
if (objB.hasOwnProperty(propty)) {
if (!deepEqual(objA[propty], objB[propty])) {
return false;
}
} else {
return false;
}
}
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
return true;
};
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
exports.default = deepEqual;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values ? values.length : 0;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
this.__data__ = new ListCache(entries);
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
return this.__data__['delete'](key);
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
* @param {boolean} [bitmask] The bitmask of comparison flags.
* The bitmask may be composed of the following flags:
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, bitmask, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag && !isHostObject(object),
othIsObj = othTag == objectTag && !isHostObject(other),
isSameTag = objTag == othTag;
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
}
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!seen.has(othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
return seen.add(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, customizer, bitmask, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
* for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are **not** supported.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = isEqual;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],"react-chartjs-2":[function(require,module,exports){

@@ -66,10 +1658,10 @@ 'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.Chart = exports.defaults = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
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; };
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; }; }();
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; };
var _react = require('react');

@@ -87,8 +1679,10 @@

var _deepEqual = require('./utils/deepEqual');
var _lodash = require('lodash.isequal');
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -100,349 +1694,434 @@

var ChartComponent = _react2.default.createClass({
var ChartComponent = function (_React$Component) {
_inherits(ChartComponent, _React$Component);
displayName: 'ChartComponent',
function ChartComponent() {
var _ref;
propTypes: {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
},
var _temp, _this, _ret;
getDefaultProps: function getDefaultProps() {
return {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false
};
},
componentWillMount: function componentWillMount() {
this.chart_instance = undefined;
},
componentDidMount: function componentDidMount() {
this.renderChart();
},
componentDidUpdate: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
} else {
this.updateChart();
}
},
_objectWithoutProperties: function _objectWithoutProperties(obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var ignoredProperties = ['id', 'width', 'height', 'onElementsClick'];
var compareNext = this._objectWithoutProperties(nextProps, ignoredProperties);
var compareNow = this._objectWithoutProperties(this.props, ignoredProperties);
_classCallCheck(this, ChartComponent);
return !(0, _deepEqual2.default)(compareNext, compareNow, { strict: true });
},
componentWillUnmount: function componentWillUnmount() {
this.chart_instance.destroy();
},
updateChart: function updateChart() {
var _props = this.props;
var data = _props.data;
var options = _props.options;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ChartComponent.__proto__ || Object.getPrototypeOf(ChartComponent)).call.apply(_ref, [this].concat(args))), _this), _this.handleOnClick = function (event) {
var instance = _this.chart_instance;
if (!this.chart_instance) return;
var _this$props = _this.props,
getDatasetAtEvent = _this$props.getDatasetAtEvent,
getElementAtEvent = _this$props.getElementAtEvent,
getElementsAtEvent = _this$props.getElementsAtEvent,
onElementsClick = _this$props.onElementsClick;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
var currentData = this.chart_instance.config.data.datasets;
var nextData = data.datasets;
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
}, _temp), _possibleConstructorReturn(_this, _ret);
}
nextData.forEach(function (dataset, sid) {
if (currentData[sid] && currentData[sid].data) {
currentData[sid].data.splice(nextData[sid].data.length);
dataset.data.forEach(function (point, pid) {
currentData[sid].data[pid] = nextData[sid].data[pid];
});
} else {
currentData[sid] = nextData[sid];
}
});
delete data.datasets;
_createClass(ChartComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.chart_instance = undefined;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.renderChart();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
return;
}
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, data);
this.updateChart();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
var _props = this.props,
redraw = _props.redraw,
type = _props.type,
options = _props.options,
legend = _props.legend,
height = _props.height,
width = _props.width;
this.chart_instance.update();
},
renderChart: function renderChart() {
var _props2 = this.props;
var data = _props2.data;
var options = _props2.options;
var legend = _props2.legend;
var type = _props2.type;
var node = _reactDom2.default.findDOMNode(this);
if (nextProps.redraw === true) {
return true;
}
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
},
handleOnClick: function handleOnClick(event) {
var instance = this.chart_instance;
if (height !== nextProps.height || width !== nextProps.width) {
return true;
}
var _props3 = this.props;
var getDatasetAtEvent = _props3.getDatasetAtEvent;
var getElementAtEvent = _props3.getElementAtEvent;
var getElementsAtEvent = _props3.getElementsAtEvent;
var onElementsClick = _props3.onElementsClick;
if (type !== nextProps.type) {
return true;
}
if (!(0, _lodash2.default)(legend, nextProps.legend)) {
return true;
}
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
},
render: function render() {
var _props4 = this.props;
var height = _props4.height;
var width = _props4.width;
var onElementsClick = _props4.onElementsClick;
if (!(0, _lodash2.default)(options, nextProps.options)) {
return true;
}
return !(0, _lodash2.default)(this.shadowDataProp, nextProps.data);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.chart_instance.destroy();
}
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
});
// Chart.js directly mutates the data.dataset objects by adding _meta proprerty
// this makes impossible to compare the current and next data changes
// therefore we memoize the data prop while sending a fake to Chart.js for mutation.
// see https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L615-L617
}, {
key: 'memoizeDataProps',
value: function memoizeDataProps() {
var data = this.props.data;
if (!data) {
return;
}
this.shadowDataProp = _extends({}, data, {
datasets: data.datasets && data.datasets.map(function (set) {
return Object.assign({}, set);
})
});
}
}, {
key: 'updateChart',
value: function updateChart() {
var _props2 = this.props,
data = _props2.data,
options = _props2.options;
this.memoizeDataProps();
if (!this.chart_instance) return;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
// Pipe datasets to chart instance datasets enabling
// seamless transitions
var currentDatasets = this.chart_instance.config.data && this.chart_instance.config.data.datasets || [];
var nextDatasets = data.datasets || [];
nextDatasets.forEach(function (dataset, sid) {
if (currentDatasets[sid] && currentDatasets[sid].data) {
currentDatasets[sid].data.splice(nextDatasets[sid].data.length);
dataset.data.forEach(function (point, pid) {
currentDatasets[sid].data[pid] = nextDatasets[sid].data[pid];
});
var _data = dataset.data,
otherProps = _objectWithoutProperties(dataset, ['data']);
currentDatasets[sid] = _extends({
data: currentDatasets[sid].data
}, currentDatasets[sid], otherProps);
} else {
currentDatasets[sid] = nextDatasets[sid];
}
});
var datasets = data.datasets,
rest = _objectWithoutProperties(data, ['datasets']);
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, rest);
this.chart_instance.update();
}
}, {
key: 'renderChart',
value: function renderChart() {
var _props3 = this.props,
data = _props3.data,
options = _props3.options,
legend = _props3.legend,
type = _props3.type,
redraw = _props3.redraw;
var node = _reactDom2.default.findDOMNode(this);
this.memoizeDataProps();
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
}
}, {
key: 'render',
value: function render() {
var _props4 = this.props,
height = _props4.height,
width = _props4.width,
onElementsClick = _props4.onElementsClick;
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
}]);
return ChartComponent;
}(_react2.default.Component);
ChartComponent.propTypes = {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
};
ChartComponent.defaultProps = {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false,
options: {}
};
exports.default = ChartComponent;
var Doughnut = exports.Doughnut = function (_React$Component) {
_inherits(Doughnut, _React$Component);
var Doughnut = exports.Doughnut = function (_React$Component2) {
_inherits(Doughnut, _React$Component2);
function Doughnut() {
_classCallCheck(this, Doughnut);
function Doughnut() {
_classCallCheck(this, Doughnut);
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this2 = this;
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this3 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref) {
return _this2.chart_instance = _ref && _ref.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this3.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return Doughnut;
return Doughnut;
}(_react2.default.Component);
var Pie = exports.Pie = function (_React$Component2) {
_inherits(Pie, _React$Component2);
var Pie = exports.Pie = function (_React$Component3) {
_inherits(Pie, _React$Component3);
function Pie() {
_classCallCheck(this, Pie);
function Pie() {
_classCallCheck(this, Pie);
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this4 = this;
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this5 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this4.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'pie'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this5.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'pie'
}));
}
}]);
return Pie;
return Pie;
}(_react2.default.Component);
var Line = exports.Line = function (_React$Component3) {
_inherits(Line, _React$Component3);
var Line = exports.Line = function (_React$Component4) {
_inherits(Line, _React$Component4);
function Line() {
_classCallCheck(this, Line);
function Line() {
_classCallCheck(this, Line);
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
_createClass(Line, [{
key: 'render',
value: function render() {
var _this6 = this;
_createClass(Line, [{
key: 'render',
value: function render() {
var _this7 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this6.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'line'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this7.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'line'
}));
}
}]);
return Line;
return Line;
}(_react2.default.Component);
var Bar = exports.Bar = function (_React$Component4) {
_inherits(Bar, _React$Component4);
var Bar = exports.Bar = function (_React$Component5) {
_inherits(Bar, _React$Component5);
function Bar() {
_classCallCheck(this, Bar);
function Bar() {
_classCallCheck(this, Bar);
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this8 = this;
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this9 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this8.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'bar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this9.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'bar'
}));
}
}]);
return Bar;
return Bar;
}(_react2.default.Component);
var HorizontalBar = exports.HorizontalBar = function (_React$Component5) {
_inherits(HorizontalBar, _React$Component5);
var HorizontalBar = exports.HorizontalBar = function (_React$Component6) {
_inherits(HorizontalBar, _React$Component6);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this10 = this;
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this11 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this10.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this11.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return HorizontalBar;
return HorizontalBar;
}(_react2.default.Component);
var Radar = exports.Radar = function (_React$Component6) {
_inherits(Radar, _React$Component6);
var Radar = exports.Radar = function (_React$Component7) {
_inherits(Radar, _React$Component7);
function Radar() {
_classCallCheck(this, Radar);
function Radar() {
_classCallCheck(this, Radar);
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this12 = this;
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this13 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this12.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'radar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this13.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'radar'
}));
}
}]);
return Radar;
return Radar;
}(_react2.default.Component);
var Polar = exports.Polar = function (_React$Component7) {
_inherits(Polar, _React$Component7);
var Polar = exports.Polar = function (_React$Component8) {
_inherits(Polar, _React$Component8);
function Polar() {
_classCallCheck(this, Polar);
function Polar() {
_classCallCheck(this, Polar);
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this14 = this;
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this15 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this14.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this15.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return Polar;
return Polar;
}(_react2.default.Component);
var Bubble = exports.Bubble = function (_React$Component8) {
_inherits(Bubble, _React$Component8);
var Bubble = exports.Bubble = function (_React$Component9) {
_inherits(Bubble, _React$Component9);
function Bubble() {
_classCallCheck(this, Bubble);
function Bubble() {
_classCallCheck(this, Bubble);
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this16 = this;
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this17 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this16.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'bubble'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref9) {
return _this17.chart_instance = _ref9 && _ref9.chart_instance;
},
type: 'bubble'
}));
}
}]);
return Bubble;
return Bubble;
}(_react2.default.Component);

@@ -453,2 +2132,2 @@

},{"./utils/deepEqual":1,"chart.js":undefined,"react":undefined,"react-dom":undefined}]},{},[]);
},{"chart.js":undefined,"lodash.isequal":1,"react":undefined,"react-dom":undefined}]},{},[]);
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.Chart = exports.defaults = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
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; };
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; }; }();
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; };
var _react = require('react');

@@ -24,8 +24,10 @@

var _deepEqual = require('./utils/deepEqual');
var _lodash = require('lodash.isequal');
var _deepEqual2 = _interopRequireDefault(_deepEqual);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -37,359 +39,434 @@

function _objectWithoutProperties2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var ChartComponent = function (_React$Component) {
_inherits(ChartComponent, _React$Component);
var ChartComponent = _react2.default.createClass({
function ChartComponent() {
var _ref;
displayName: 'ChartComponent',
var _temp, _this, _ret;
propTypes: {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
},
_classCallCheck(this, ChartComponent);
getDefaultProps: function getDefaultProps() {
return {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false
};
},
componentWillMount: function componentWillMount() {
this.chart_instance = undefined;
},
componentDidMount: function componentDidMount() {
this.renderChart();
},
componentDidUpdate: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
} else {
this.updateChart();
}
},
_objectWithoutProperties: function _objectWithoutProperties(obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var ignoredProperties = ['id', 'width', 'height', 'onElementsClick'];
var compareNext = this._objectWithoutProperties(nextProps, ignoredProperties);
var compareNow = this._objectWithoutProperties(this.props, ignoredProperties);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return !(0, _deepEqual2.default)(compareNext, compareNow, { strict: true });
},
componentWillUnmount: function componentWillUnmount() {
this.chart_instance.destroy();
},
updateChart: function updateChart() {
var _props = this.props,
data = _props.data,
options = _props.options;
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ChartComponent.__proto__ || Object.getPrototypeOf(ChartComponent)).call.apply(_ref, [this].concat(args))), _this), _this.handleOnClick = function (event) {
var instance = _this.chart_instance;
var _this$props = _this.props,
getDatasetAtEvent = _this$props.getDatasetAtEvent,
getElementAtEvent = _this$props.getElementAtEvent,
getElementsAtEvent = _this$props.getElementsAtEvent,
onElementsClick = _this$props.onElementsClick;
if (!this.chart_instance) return;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
}, _temp), _possibleConstructorReturn(_this, _ret);
}
var currentData = this.chart_instance.config.data.datasets;
var nextData = data.datasets;
_createClass(ChartComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.chart_instance = undefined;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.renderChart();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
return;
}
nextData.forEach(function (dataset, sid) {
if (currentData[sid] && currentData[sid].data) {
currentData[sid].data.splice(nextData[sid].data.length);
this.updateChart();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
var _props = this.props,
redraw = _props.redraw,
type = _props.type,
options = _props.options,
legend = _props.legend,
height = _props.height,
width = _props.width;
dataset.data.forEach(function (point, pid) {
currentData[sid].data[pid] = nextData[sid].data[pid];
});
var _data = dataset.data,
otherProps = _objectWithoutProperties2(dataset, ['data']);
if (nextProps.redraw === true) {
return true;
}
currentData[sid] = _extends({
data: currentData[sid].data
}, currentData[sid], otherProps);
} else {
currentData[sid] = nextData[sid];
}
});
delete data.datasets;
if (height !== nextProps.height || width !== nextProps.width) {
return true;
}
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, data);
if (type !== nextProps.type) {
return true;
}
this.chart_instance.update();
},
renderChart: function renderChart() {
var _props2 = this.props,
data = _props2.data,
options = _props2.options,
legend = _props2.legend,
type = _props2.type;
if (!(0, _lodash2.default)(legend, nextProps.legend)) {
return true;
}
var node = _reactDom2.default.findDOMNode(this);
if (!(0, _lodash2.default)(options, nextProps.options)) {
return true;
}
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
},
handleOnClick: function handleOnClick(event) {
var instance = this.chart_instance;
return !(0, _lodash2.default)(this.shadowDataProp, nextProps.data);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.chart_instance.destroy();
}
var _props3 = this.props,
getDatasetAtEvent = _props3.getDatasetAtEvent,
getElementAtEvent = _props3.getElementAtEvent,
getElementsAtEvent = _props3.getElementsAtEvent,
onElementsClick = _props3.onElementsClick;
// Chart.js directly mutates the data.dataset objects by adding _meta proprerty
// this makes impossible to compare the current and next data changes
// therefore we memoize the data prop while sending a fake to Chart.js for mutation.
// see https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L615-L617
}, {
key: 'memoizeDataProps',
value: function memoizeDataProps() {
var data = this.props.data;
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
},
render: function render() {
var _props4 = this.props,
height = _props4.height,
width = _props4.width,
onElementsClick = _props4.onElementsClick;
if (!data) {
return;
}
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
});
this.shadowDataProp = _extends({}, data, {
datasets: data.datasets && data.datasets.map(function (set) {
return Object.assign({}, set);
})
});
}
}, {
key: 'updateChart',
value: function updateChart() {
var _props2 = this.props,
data = _props2.data,
options = _props2.options;
this.memoizeDataProps();
if (!this.chart_instance) return;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
// Pipe datasets to chart instance datasets enabling
// seamless transitions
var currentDatasets = this.chart_instance.config.data && this.chart_instance.config.data.datasets || [];
var nextDatasets = data.datasets || [];
nextDatasets.forEach(function (dataset, sid) {
if (currentDatasets[sid] && currentDatasets[sid].data) {
currentDatasets[sid].data.splice(nextDatasets[sid].data.length);
dataset.data.forEach(function (point, pid) {
currentDatasets[sid].data[pid] = nextDatasets[sid].data[pid];
});
var _data = dataset.data,
otherProps = _objectWithoutProperties(dataset, ['data']);
currentDatasets[sid] = _extends({
data: currentDatasets[sid].data
}, currentDatasets[sid], otherProps);
} else {
currentDatasets[sid] = nextDatasets[sid];
}
});
var datasets = data.datasets,
rest = _objectWithoutProperties(data, ['datasets']);
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, rest);
this.chart_instance.update();
}
}, {
key: 'renderChart',
value: function renderChart() {
var _props3 = this.props,
data = _props3.data,
options = _props3.options,
legend = _props3.legend,
type = _props3.type,
redraw = _props3.redraw;
var node = _reactDom2.default.findDOMNode(this);
this.memoizeDataProps();
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options
});
}
}, {
key: 'render',
value: function render() {
var _props4 = this.props,
height = _props4.height,
width = _props4.width,
onElementsClick = _props4.onElementsClick;
return _react2.default.createElement('canvas', {
height: height,
width: width,
onClick: this.handleOnClick
});
}
}]);
return ChartComponent;
}(_react2.default.Component);
ChartComponent.propTypes = {
data: _react.PropTypes.object.isRequired,
getDatasetAtEvent: _react.PropTypes.func,
getElementAtEvent: _react.PropTypes.func,
getElementsAtEvent: _react.PropTypes.func,
height: _react.PropTypes.number,
legend: _react.PropTypes.object,
onElementsClick: _react.PropTypes.func,
options: _react.PropTypes.object,
redraw: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
width: _react.PropTypes.number
};
ChartComponent.defaultProps = {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false,
options: {}
};
exports.default = ChartComponent;
var Doughnut = exports.Doughnut = function (_React$Component) {
_inherits(Doughnut, _React$Component);
var Doughnut = exports.Doughnut = function (_React$Component2) {
_inherits(Doughnut, _React$Component2);
function Doughnut() {
_classCallCheck(this, Doughnut);
function Doughnut() {
_classCallCheck(this, Doughnut);
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this2 = this;
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this3 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref) {
return _this2.chart_instance = _ref && _ref.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this3.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return Doughnut;
return Doughnut;
}(_react2.default.Component);
var Pie = exports.Pie = function (_React$Component2) {
_inherits(Pie, _React$Component2);
var Pie = exports.Pie = function (_React$Component3) {
_inherits(Pie, _React$Component3);
function Pie() {
_classCallCheck(this, Pie);
function Pie() {
_classCallCheck(this, Pie);
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this4 = this;
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this5 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this4.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'pie'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this5.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'pie'
}));
}
}]);
return Pie;
return Pie;
}(_react2.default.Component);
var Line = exports.Line = function (_React$Component3) {
_inherits(Line, _React$Component3);
var Line = exports.Line = function (_React$Component4) {
_inherits(Line, _React$Component4);
function Line() {
_classCallCheck(this, Line);
function Line() {
_classCallCheck(this, Line);
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
_createClass(Line, [{
key: 'render',
value: function render() {
var _this6 = this;
_createClass(Line, [{
key: 'render',
value: function render() {
var _this7 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this6.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'line'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this7.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'line'
}));
}
}]);
return Line;
return Line;
}(_react2.default.Component);
var Bar = exports.Bar = function (_React$Component4) {
_inherits(Bar, _React$Component4);
var Bar = exports.Bar = function (_React$Component5) {
_inherits(Bar, _React$Component5);
function Bar() {
_classCallCheck(this, Bar);
function Bar() {
_classCallCheck(this, Bar);
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this8 = this;
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this9 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this8.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'bar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this9.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'bar'
}));
}
}]);
return Bar;
return Bar;
}(_react2.default.Component);
var HorizontalBar = exports.HorizontalBar = function (_React$Component5) {
_inherits(HorizontalBar, _React$Component5);
var HorizontalBar = exports.HorizontalBar = function (_React$Component6) {
_inherits(HorizontalBar, _React$Component6);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this10 = this;
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this11 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this10.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this11.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return HorizontalBar;
return HorizontalBar;
}(_react2.default.Component);
var Radar = exports.Radar = function (_React$Component6) {
_inherits(Radar, _React$Component6);
var Radar = exports.Radar = function (_React$Component7) {
_inherits(Radar, _React$Component7);
function Radar() {
_classCallCheck(this, Radar);
function Radar() {
_classCallCheck(this, Radar);
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this12 = this;
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this13 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this12.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'radar'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this13.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'radar'
}));
}
}]);
return Radar;
return Radar;
}(_react2.default.Component);
var Polar = exports.Polar = function (_React$Component7) {
_inherits(Polar, _React$Component7);
var Polar = exports.Polar = function (_React$Component8) {
_inherits(Polar, _React$Component8);
function Polar() {
_classCallCheck(this, Polar);
function Polar() {
_classCallCheck(this, Polar);
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this14 = this;
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this15 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this14.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this15.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return Polar;
return Polar;
}(_react2.default.Component);
var Bubble = exports.Bubble = function (_React$Component8) {
_inherits(Bubble, _React$Component8);
var Bubble = exports.Bubble = function (_React$Component9) {
_inherits(Bubble, _React$Component9);
function Bubble() {
_classCallCheck(this, Bubble);
function Bubble() {
_classCallCheck(this, Bubble);
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this16 = this;
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this17 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this16.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'bubble'
}));
}
}]);
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref9) {
return _this17.chart_instance = _ref9 && _ref9.chart_instance;
},
type: 'bubble'
}));
}
}]);
return Bubble;
return Bubble;
}(_react2.default.Component);

@@ -396,0 +473,0 @@

{
"name": "react-chartjs-2",
"version": "1.5.6",
"version": "1.6.0",
"description": "react-chartjs-2",

@@ -16,19 +16,27 @@ "main": "lib/index.js",

"dependencies": {
"chart.js": "^2.3.0"
"chart.js": "~2.3.0",
"lodash.isequal": "^4.4.0"
},
"devDependencies": {
"babel-core": "^6.18.2",
"babel-eslint": "^4.1.3",
"babel-jest": "^14.1.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-1": "^6.13.0",
"babel-register": "^6.18.0",
"babelify": "^7.3.0",
"brfs": "^1.4.3",
"canvas": "^1.6.2",
"chai": "^3.5.0",
"enzyme": "^2.6.0",
"eslint": "^1.6.0",
"eslint-plugin-react": "^3.5.1",
"gulp": "^3.9.0",
"jest": "^14.1.0",
"jsdom": "^9.8.3",
"mocha": "^3.1.2",
"react": "^0.14 || ^15.0.0-rc || ^15.0",
"react-addons-test-utils": "^15.3.2",
"react-component-gulp-tasks": "git+https://github.com/gor181/react-component-gulp-tasks.git",
"react-dom": "^0.14 || ^15.0.0-rc || ^15.0"
"react-dom": "^0.14 || ^15.0.0-rc || ^15.0",
"sinon": "^1.17.6"
},

@@ -49,12 +57,10 @@ "peerDependencies": {

"start": "gulp dev",
"test": "jest",
"test": "mocha test/config/setup.js test/__tests__/**/*",
"watch": "gulp watch:lib"
},
"jest": {
"automock": false
},
"keywords": [
"react",
"react-component"
"chart",
"chart-js",
"chart.js"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc