Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.1.6 to 1.1.7

example/src/components/dynamic-doughnut.js

14

dist/react-chartjs-2.js

@@ -91,4 +91,4 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var compareNext = this._objectWithoutProperties(nextProps, ["id", "width", "height"]);
var compareNow = this._objectWithoutProperties(this.props, ["id", "width", "height"]);
var compareNext = this._objectWithoutProperties(nextProps, ['id', 'width', 'height']);
var compareNow = this._objectWithoutProperties(this.props, ['id', 'width', 'height']);
return !(0, _utilsDeepEqual2['default'])(compareNext, compareNow, { strict: true });

@@ -108,8 +108,10 @@ },

this.chart_instance.options.scales.xAxes[0].ticks.min = options.scales.xAxes[0].ticks.min;
this.chart_instance.options.scales.xAxes[0].ticks.max = options.scales.xAxes[0].ticks.max;
this.chart_instance.options.scales.xAxes[0].fixedBarWidth = options.scales.xAxes[0].fixedBarWidth;
if (!this.chart_instance) return;
if (options) {
_chartJs2['default'].helpers.configMerge(this.chart_instance.options, options);
}
data.datasets.forEach(function (dataset, index) {
_this.chart_instance.data.datasets[index].backgroundColor = dataset.backgroundColor;
_this.chart_instance.data.datasets[index] = dataset;
});

@@ -116,0 +118,0 @@

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Chart=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,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(e,t,n){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return p["default"].createElement(v,c({},e,{type:"doughnut"}))}function i(e){return p["default"].createElement(v,c({},e,{type:"pie"}))}function a(e){return p["default"].createElement(v,c({},e,{type:"line"}))}function u(e){return p["default"].createElement(v,c({},e,{type:"bar"}))}function s(e){return p["default"].createElement(v,c({},e,{type:"radar"}))}function d(e){return p["default"].createElement(v,c({},e,{type:"polarArea"}))}Object.defineProperty(n,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n.Doughnut=o,n.Pie=i,n.Line=a,n.Bar=u,n.Radar=s,n.Polar=d;var f="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,p=r(f),l=e("react-dom"),h=r(l),y=e("chart.js"),b=r(y),m=e("./utils/deepEqual"),w=r(m),v=p["default"].createClass({displayName:"ChartComponent",propTypes:{data:f.PropTypes.object.isRequired,height:f.PropTypes.number,legend:f.PropTypes.object,options:f.PropTypes.object,redraw:f.PropTypes.bool,type:f.PropTypes.oneOf(["doughnut","pie","line","bar","radar","polarArea"]),width:f.PropTypes.number},getDefaultProps:function(){return{legend:{display:!0,position:"bottom"},type:"doughnut",height:200,width:200,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(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},shouldComponentUpdate:function(e,t){var n=this._objectWithoutProperties(e,["id","width","height"]),r=this._objectWithoutProperties(this.props,["id","width","height"]);return!(0,w["default"])(n,r,{strict:!0})},componentWillUnmount:function(){this.chart_instance.destroy()},updateChart:function(){var e=this,t=this.props,n=t.data,r=t.options;this.chart_instance.options.scales.xAxes[0].ticks.min=r.scales.xAxes[0].ticks.min,this.chart_instance.options.scales.xAxes[0].ticks.max=r.scales.xAxes[0].ticks.max,this.chart_instance.options.scales.xAxes[0].fixedBarWidth=r.scales.xAxes[0].fixedBarWidth,n.datasets.forEach(function(t,n){e.chart_instance.data.datasets[n].backgroundColor=t.backgroundColor}),this.chart_instance.update()},renderChart:function(){var e=this.props,t=e.data,n=e.options,r=(e.legend,e.type),o=h["default"].findDOMNode(this);this.chart_instance=new b["default"](o,{type:r,data:t,options:n})},render:function(){var e=this.props,t=e.height,n=e.width;return p["default"].createElement("canvas",{height:t,width:n})}});n["default"]=v}).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(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=Object.prototype.hasOwnProperty,o=function(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t},i=function a(e,t){if(o(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;for(var n=Object.keys(e),i=0;i<n.length;i++)if(!r.call(t,n[i]))return!1;for(var u in e){if(!t.hasOwnProperty(u))return!1;if(!a(e[u],t[u]))return!1}return!0};n["default"]=i,t.exports=n["default"]},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Chart=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var d="function"==typeof require&&require;if(!u&&d)return d(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var p=n[a]={exports:{}};t[a][0].call(p.exports,function(e){var n=t[a][1][e];return o(n?n:e)},p,p.exports,e,t,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(e,t,n){(function(t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return c["default"].createElement(g,p({},e,{type:"doughnut"}))}function i(e){return c["default"].createElement(g,p({},e,{type:"pie"}))}function a(e){return c["default"].createElement(g,p({},e,{type:"line"}))}function u(e){return c["default"].createElement(g,p({},e,{type:"bar"}))}function d(e){return c["default"].createElement(g,p({},e,{type:"radar"}))}function f(e){return c["default"].createElement(g,p({},e,{type:"polarArea"}))}Object.defineProperty(n,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n.Doughnut=o,n.Pie=i,n.Line=a,n.Bar=u,n.Radar=d,n.Polar=f;var s="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,c=r(s),l=e("react-dom"),h=r(l),y=e("chart.js"),w=r(y),b=e("./utils/deepEqual"),v=r(b),g=c["default"].createClass({displayName:"ChartComponent",propTypes:{data:s.PropTypes.object.isRequired,height:s.PropTypes.number,legend:s.PropTypes.object,options:s.PropTypes.object,redraw:s.PropTypes.bool,type:s.PropTypes.oneOf(["doughnut","pie","line","bar","radar","polarArea"]),width:s.PropTypes.number},getDefaultProps:function(){return{legend:{display:!0,position:"bottom"},type:"doughnut",height:200,width:200,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(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},shouldComponentUpdate:function(e,t){var n=this._objectWithoutProperties(e,["id","width","height"]),r=this._objectWithoutProperties(this.props,["id","width","height"]);return!(0,v["default"])(n,r,{strict:!0})},componentWillUnmount:function(){this.chart_instance.destroy()},updateChart:function(){var e=this,t=this.props,n=t.data,r=t.options;this.chart_instance&&(r&&w["default"].helpers.configMerge(this.chart_instance.options,r),n.datasets.forEach(function(t,n){e.chart_instance.data.datasets[n]=t}),this.chart_instance.update())},renderChart:function(){var e=this.props,t=e.data,n=e.options,r=(e.legend,e.type),o=h["default"].findDOMNode(this);this.chart_instance=new w["default"](o,{type:r,data:t,options:n})},render:function(){var e=this.props,t=e.height,n=e.width;return c["default"].createElement("canvas",{height:t,width:n})}});n["default"]=g}).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(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=Object.prototype.hasOwnProperty,o=function(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t},i=function a(e,t){if(o(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;for(var n=Object.keys(e),i=0;i<n.length;i++)if(!r.call(t,n[i]))return!1;for(var u in e){if(!t.hasOwnProperty(u))return!1;if(!a(e[u],t[u]))return!1}return!0};n["default"]=i,t.exports=n["default"]},{}]},{},[1])(1)});

@@ -5,2 +5,3 @@ import React from 'react';

import DoughnutExample from './components/doughnut';
import DynamicDoughnutExample from './components/dynamic-doughnut';
import PieExample from './components/pie';

@@ -20,2 +21,4 @@ import LineExample from './components/line';

<hr />
<DynamicDoughnutExample />
<hr />
<PieExample />

@@ -22,0 +25,0 @@ <hr />

@@ -89,4 +89,4 @@ 'use strict';

shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
var compareNext = this._objectWithoutProperties(nextProps, ["id", "width", "height"]);
var compareNow = this._objectWithoutProperties(this.props, ["id", "width", "height"]);
var compareNext = this._objectWithoutProperties(nextProps, ['id', 'width', 'height']);
var compareNow = this._objectWithoutProperties(this.props, ['id', 'width', 'height']);
return !(0, _utilsDeepEqual2['default'])(compareNext, compareNow, { strict: true });

@@ -106,8 +106,10 @@ },

this.chart_instance.options.scales.xAxes[0].ticks.min = options.scales.xAxes[0].ticks.min;
this.chart_instance.options.scales.xAxes[0].ticks.max = options.scales.xAxes[0].ticks.max;
this.chart_instance.options.scales.xAxes[0].fixedBarWidth = options.scales.xAxes[0].fixedBarWidth;
if (!this.chart_instance) return;
if (options) {
_chartJs2['default'].helpers.configMerge(this.chart_instance.options, options);
}
data.datasets.forEach(function (dataset, index) {
_this.chart_instance.data.datasets[index].backgroundColor = dataset.backgroundColor;
_this.chart_instance.data.datasets[index] = dataset;
});

@@ -114,0 +116,0 @@

{
"name": "react-chartjs-2",
"version": "1.1.6",
"version": "1.1.7",
"description": "react-chartjs-2",

@@ -5,0 +5,0 @@ "main": "lib/Chart.js",

@@ -61,4 +61,4 @@ import React, {PropTypes} from 'react';

shouldComponentUpdate(nextProps, nextState) {
const compareNext = this._objectWithoutProperties(nextProps, ["id", "width", "height"]);
const compareNow = this._objectWithoutProperties(this.props, ["id", "width", "height"]);
const compareNext = this._objectWithoutProperties(nextProps, ['id', 'width', 'height']);
const compareNow = this._objectWithoutProperties(this.props, ['id', 'width', 'height']);
return !deepEqual(compareNext, compareNow, {strict: true});

@@ -73,13 +73,13 @@ },

const {data, options} = this.props;
if (!this.chart_instance) return;
this.chart_instance.options.scales.xAxes[0].ticks.min = options.scales.xAxes[0].ticks.min;
this.chart_instance.options.scales.xAxes[0].ticks.max = options.scales.xAxes[0].ticks.max;
this.chart_instance.options.scales.xAxes[0].fixedBarWidth = options.scales.xAxes[0].fixedBarWidth;
if (options) {
Chart.helpers.configMerge(this.chart_instance.options, options);
}
data.datasets.forEach((dataset, index) => {
this.chart_instance.data.datasets[index].backgroundColor = dataset.backgroundColor;
this.chart_instance.data.datasets[index] = dataset;
});
this.chart_instance.update();

@@ -86,0 +86,0 @@ },

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