1+ ( function webpackUniversalModuleDefinition ( root , factory ) {
2+ if ( typeof exports === 'object' && typeof module === 'object' )
3+ module . exports = factory ( require ( "Chartjs" ) , require ( "react" ) ) ;
4+ else if ( typeof define === 'function' && define . amd )
5+ define ( [ "Chartjs" , "react" ] , factory ) ;
6+ else if ( typeof exports === 'object' )
7+ exports [ "react-chartjs" ] = factory ( require ( "Chartjs" ) , require ( "react" ) ) ;
8+ else
9+ root [ "react-chartjs" ] = factory ( root [ "Chartjs" ] , root [ "React" ] ) ;
10+ } ) ( this , function ( __WEBPACK_EXTERNAL_MODULE_8__ , __WEBPACK_EXTERNAL_MODULE_9__ ) {
11+ return /******/ ( function ( modules ) { // webpackBootstrap
12+ /******/ // The module cache
13+ /******/ var installedModules = { } ;
14+
15+ /******/ // The require function
16+ /******/ function __webpack_require__ ( moduleId ) {
17+
18+ /******/ // Check if module is in cache
19+ /******/ if ( installedModules [ moduleId ] )
20+ /******/ return installedModules [ moduleId ] . exports ;
21+
22+ /******/ // Create a new module (and put it into the cache)
23+ /******/ var module = installedModules [ moduleId ] = {
24+ /******/ exports : { } ,
25+ /******/ id : moduleId ,
26+ /******/ loaded : false
27+ /******/ } ;
28+
29+ /******/ // Execute the module function
30+ /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
31+
32+ /******/ // Flag the module as loaded
33+ /******/ module . loaded = true ;
34+
35+ /******/ // Return the exports of the module
36+ /******/ return module . exports ;
37+ /******/ }
38+
39+
40+ /******/ // expose the modules object (__webpack_modules__)
41+ /******/ __webpack_require__ . m = modules ;
42+
43+ /******/ // expose the module cache
44+ /******/ __webpack_require__ . c = installedModules ;
45+
46+ /******/ // __webpack_public_path__
47+ /******/ __webpack_require__ . p = "" ;
48+
49+ /******/ // Load entry module and return exports
50+ /******/ return __webpack_require__ ( 0 ) ;
51+ /******/ } )
52+ /************************************************************************/
53+ /******/ ( [
54+ /* 0 */
55+ /***/ function ( module , exports , __webpack_require__ ) {
56+
57+ module . exports = {
58+ Bar : __webpack_require__ ( 1 ) ,
59+ Doughnut : __webpack_require__ ( 2 ) ,
60+ Line : __webpack_require__ ( 3 ) ,
61+ Pie : __webpack_require__ ( 4 ) ,
62+ PolarArea : __webpack_require__ ( 5 ) ,
63+ Radar : __webpack_require__ ( 6 ) ,
64+ createClass : __webpack_require__ ( 7 ) . createClass
65+ } ;
66+
67+
68+ /***/ } ,
69+ /* 1 */
70+ /***/ function ( module , exports , __webpack_require__ ) {
71+
72+ var vars = __webpack_require__ ( 7 ) ;
73+
74+ module . exports = vars . createClass ( 'Bar' , [ 'getBarsAtEvent' ] ) ;
75+
76+
77+ /***/ } ,
78+ /* 2 */
79+ /***/ function ( module , exports , __webpack_require__ ) {
80+
81+ var vars = __webpack_require__ ( 7 ) ;
82+
83+ module . exports = vars . createClass ( 'Doughnut' , [ 'getSegmentsAtEvent' ] ) ;
84+
85+
86+ /***/ } ,
87+ /* 3 */
88+ /***/ function ( module , exports , __webpack_require__ ) {
89+
90+ var vars = __webpack_require__ ( 7 ) ;
91+
92+ module . exports = vars . createClass ( 'Line' , [ 'getPointsAtEvent' ] ) ;
93+
94+
95+ /***/ } ,
96+ /* 4 */
97+ /***/ function ( module , exports , __webpack_require__ ) {
98+
99+ var vars = __webpack_require__ ( 7 ) ;
100+
101+ module . exports = vars . createClass ( 'Pie' , [ 'getSegmentsAtEvent' ] ) ;
102+
103+
104+ /***/ } ,
105+ /* 5 */
106+ /***/ function ( module , exports , __webpack_require__ ) {
107+
108+ var vars = __webpack_require__ ( 7 ) ;
109+
110+ module . exports = vars . createClass ( 'PolarArea' , [ 'getSegmentsAtEvent' ] ) ;
111+
112+
113+ /***/ } ,
114+ /* 6 */
115+ /***/ function ( module , exports , __webpack_require__ ) {
116+
117+ var vars = __webpack_require__ ( 7 ) ;
118+
119+ module . exports = vars . createClass ( 'Radar' , [ 'getPointsAtEvent' ] ) ;
120+
121+
122+ /***/ } ,
123+ /* 7 */
124+ /***/ function ( module , exports , __webpack_require__ ) {
125+
126+ module . exports = {
127+ createClass : function ( chartType , methodNames , dataKey ) {
128+ var classData = {
129+ displayName : chartType + 'Chart' ,
130+ getInitialState : function ( ) { return { } ; } ,
131+ render : function ( ) {
132+ var _props = {
133+ ref : 'canvass'
134+ } ;
135+ for ( var name in this . props ) {
136+ if ( this . props . hasOwnProperty ( name ) ) {
137+ if ( name !== 'data' && name !== 'options' ) {
138+ _props [ name ] = this . props [ name ] ;
139+ }
140+ }
141+ }
142+ return React . createElement ( 'canvas' , _props ) ;
143+ }
144+ } ;
145+
146+ var extras = [ 'clear' , 'stop' , 'resize' , 'toBase64Image' , 'generateLegend' , 'update' , 'addData' , 'removeData' ] ;
147+ function extra ( type ) {
148+ classData [ type ] = function ( ) {
149+ this . state . chart [ name ] . apply ( this . state . chart , arguments ) ;
150+ } ;
151+ }
152+
153+ classData . componentDidMount = function ( ) {
154+ this . initializeChart ( this . props ) ;
155+ } ;
156+
157+ classData . componentWillUnmount = function ( ) {
158+ var chart = this . state . chart ;
159+ chart . destroy ( ) ;
160+ } ;
161+
162+ classData . componentWillReceiveProps = function ( nextProps ) {
163+ var chart = this . state . chart ;
164+ if ( this . props . redraw ) {
165+ chart . destroy ( ) ;
166+ this . initializeChart ( nextProps ) ;
167+ } else {
168+ dataKey = dataKey || dataKeys [ chart . name ] ;
169+ updatePoints ( nextProps , chart , dataKey ) ;
170+ chart . update ( ) ;
171+ }
172+ } ;
173+
174+ classData . initializeChart = function ( nextProps ) {
175+ var Chart = __webpack_require__ ( 8 ) ;
176+ var el = this . getDOMNode ( ) ;
177+ var ctx = el . getContext ( "2d" ) ;
178+ var chart = new Chart ( ctx ) [ chartType ] ( nextProps . data , nextProps . options || { } ) ;
179+ this . state . chart = chart ;
180+ } ;
181+
182+ // return the chartjs instance
183+ classData . getChart = function ( ) {
184+ return this . state . chart ;
185+ } ;
186+
187+ // return the canvass element that contains the chart
188+ classData . getCanvass = function ( ) {
189+ return this . refs . canvass . getDOMNode ( ) ;
190+ } ;
191+
192+ var i ;
193+ for ( i = 0 ; i < extras . length ; i ++ ) {
194+ extra ( extras [ i ] ) ;
195+ }
196+ for ( i = 0 ; i < methodNames . length ; i ++ ) {
197+ extra ( methodNames [ i ] ) ;
198+ }
199+
200+ var React = __webpack_require__ ( 9 ) ;
201+ return React . createClass ( classData ) ;
202+ }
203+ } ;
204+
205+ var dataKeys = {
206+ 'Line' : 'points' ,
207+ 'Radar' : 'points' ,
208+ 'Bar' : 'bars'
209+ } ;
210+
211+ var updatePoints = function ( nextProps , chart , dataKey ) {
212+ var name = chart . name ;
213+
214+ if ( name === 'PolarArea' || name === 'Pie' || name === 'Doughnut' ) {
215+ nextProps . data . forEach ( function ( segment , segmentIndex ) {
216+ chart . segments [ segmentIndex ] . value = segment . value ;
217+ } ) ;
218+ } else {
219+ nextProps . data . datasets . forEach ( function ( set , setIndex ) {
220+ set . data . forEach ( function ( val , pointIndex ) {
221+ chart . datasets [ setIndex ] [ dataKey ] [ pointIndex ] . value = val ;
222+ } ) ;
223+ } ) ;
224+ }
225+ } ;
226+
227+
228+
229+
230+
231+
232+ /***/ } ,
233+ /* 8 */
234+ /***/ function ( module , exports , __webpack_require__ ) {
235+
236+ module . exports = __WEBPACK_EXTERNAL_MODULE_8__ ;
237+
238+ /***/ } ,
239+ /* 9 */
240+ /***/ function ( module , exports , __webpack_require__ ) {
241+
242+ module . exports = __WEBPACK_EXTERNAL_MODULE_9__ ;
243+
244+ /***/ }
245+ /******/ ] )
246+ } ) ;
247+ ;
0 commit comments