@@ -23,36 +23,35 @@ module.exports = {
2323 } ;
2424 }
2525
26- if ( global . Chart ) {
27- classData . componentDidMount = function ( ) {
28- this . initializeChart ( this . props ) ;
29- } ;
26+ classData . componentDidMount = function ( ) {
27+ this . initializeChart ( this . props ) ;
28+ } ;
3029
31- classData . componentWillUnmount = function ( ) {
32- var chart = this . state . chart ;
33- chart . destroy ( ) ;
34- } ;
30+ classData . componentWillUnmount = function ( ) {
31+ var chart = this . state . chart ;
32+ chart . destroy ( ) ;
33+ } ;
3534
36- classData . componentWillReceiveProps = function ( nextProps ) {
37- var chart = this . state . chart ;
38- chart . destroy ( ) ;
39- this . initializeChart ( nextProps ) ;
40- } ;
35+ classData . componentWillReceiveProps = function ( nextProps ) {
36+ var chart = this . state . chart ;
37+ chart . destroy ( ) ;
38+ this . initializeChart ( nextProps ) ;
39+ } ;
4140
42- classData . initializeChart = function ( nextProps ) {
43- var el = this . getDOMNode ( ) ;
44- var ctx = el . getContext ( "2d" ) ;
45- var chart = new Chart ( ctx ) [ chartType ] ( nextProps . data , nextProps . options || { } ) ;
46- this . state . chart = chart ;
47- } ;
41+ classData . initializeChart = function ( nextProps ) {
42+ var Chart = require ( 'chart.js' ) ;
43+ var el = this . getDOMNode ( ) ;
44+ var ctx = el . getContext ( "2d" ) ;
45+ var chart = new Chart ( ctx ) [ chartType ] ( nextProps . data , nextProps . options || { } ) ;
46+ this . state . chart = chart ;
47+ } ;
4848
49- var i ;
50- for ( i = 0 ; i < extras . length ; i ++ ) {
51- extra ( extras [ i ] ) ;
52- }
53- for ( i = 0 ; i < methodNames . length ; i ++ ) {
54- extra ( methodNames [ i ] ) ;
55- }
49+ var i ;
50+ for ( i = 0 ; i < extras . length ; i ++ ) {
51+ extra ( extras [ i ] ) ;
52+ }
53+ for ( i = 0 ; i < methodNames . length ; i ++ ) {
54+ extra ( methodNames [ i ] ) ;
5655 }
5756
5857 var React = require ( 'react' ) ;
0 commit comments