@@ -2,7 +2,6 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import Chart from 'chart.js' ;
44import isEqual from 'lodash/isEqual' ;
5- import find from 'lodash/find' ;
65import keyBy from 'lodash/keyBy' ;
76
87const NODE_ENV = ( typeof process !== 'undefined' ) && process . env && process . env . NODE_ENV ;
@@ -15,6 +14,7 @@ class ChartComponent extends React.Component {
1514 PropTypes . object ,
1615 PropTypes . func
1716 ] ) . isRequired ,
17+ datasetKeyProvider : PropTypes . func ,
1818 getDatasetAtEvent : PropTypes . func ,
1919 getElementAtEvent : PropTypes . func ,
2020 getElementsAtEvent : PropTypes . func ,
@@ -27,13 +27,11 @@ class ChartComponent extends React.Component {
2727 type : function ( props , propName , componentName ) {
2828 if ( ! Chart . controllers [ props [ propName ] ] ) {
2929 return new Error (
30- 'Invalid chart type `' + props [ propName ] + '` supplied to' +
31- ' `' + componentName + '`.'
30+ `Invalid chart type \`${ props [ propName ] } \` supplied to \`${ componentName } \`.`
3231 ) ;
3332 }
3433 } ,
35- width : PropTypes . number ,
36- datasetKeyProvider : PropTypes . func
34+ width : PropTypes . number
3735 }
3836
3937 static defaultProps = {
@@ -69,7 +67,6 @@ class ChartComponent extends React.Component {
6967
7068 shouldComponentUpdate ( nextProps ) {
7169 const {
72- redraw,
7370 type,
7471 options,
7572 plugins,
@@ -115,7 +112,7 @@ class ChartComponent extends React.Component {
115112
116113 transformDataProp ( props ) {
117114 const { data } = props ;
118- if ( typeof ( data ) == 'function' ) {
115+ if ( typeof ( data ) === 'function' ) {
119116 const node = this . element ;
120117 return data ( node ) ;
121118 } else {
@@ -176,7 +173,7 @@ class ChartComponent extends React.Component {
176173 var currentDatasets = this . getCurrentDatasets ( ) ;
177174 currentDatasets . forEach ( d => {
178175 this . datasets [ this . props . datasetKeyProvider ( d ) ] = d ;
179- } )
176+ } ) ;
180177 }
181178
182179 updateChart ( ) {
@@ -237,7 +234,7 @@ class ChartComponent extends React.Component {
237234 }
238235
239236 renderChart ( ) {
240- const { options, legend, type, redraw , plugins} = this . props ;
237+ const { options, legend, type, plugins} = this . props ;
241238 const node = this . element ;
242239 const data = this . memoizeDataProps ( ) ;
243240
@@ -287,7 +284,7 @@ class ChartComponent extends React.Component {
287284 }
288285
289286 render ( ) {
290- const { height, width, onElementsClick , id} = this . props ;
287+ const { height, width, id} = this . props ;
291288
292289 return (
293290 < canvas
0 commit comments