1+ /*!
2+ * react-charts v0.0.1
3+ * https://github.com/jhudson8/react-charts
4+ *
5+ *
6+ * Copyright (c) 2014 Joe Hudson<joehud_AT_gmail.com>
7+ *
8+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9+ * of this software and associated documentation files (the "Software"), to deal
10+ * in the Software without restriction, including without limitation the rights
11+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+ * copies of the Software, and to permit persons to whom the Software is
13+ * furnished to do so, subject to the following conditions:
14+ *
15+ * The above copyright notice and this permission notice shall be included in
16+ * all copies or substantial portions of the Software.
17+ *
18+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+ * THE SOFTWARE.
25+ */
26+ /******/ ( function ( modules ) { // webpackBootstrap
27+ /******/ // The module cache
28+ /******/ var installedModules = { } ;
29+ /******/
30+ /******/ // The require function
31+ /******/ function __webpack_require__ ( moduleId ) {
32+ /******/
33+ /******/ // Check if module is in cache
34+ /******/ if ( installedModules [ moduleId ] )
35+ /******/ return installedModules [ moduleId ] . exports ;
36+ /******/
37+ /******/ // Create a new module (and put it into the cache)
38+ /******/ var module = installedModules [ moduleId ] = {
39+ /******/ exports : { } ,
40+ /******/ id : moduleId ,
41+ /******/ loaded : false
42+ /******/ } ;
43+ /******/
44+ /******/ // Execute the module function
45+ /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
46+ /******/
47+ /******/ // Flag the module as loaded
48+ /******/ module . loaded = true ;
49+ /******/
50+ /******/ // Return the exports of the module
51+ /******/ return module . exports ;
52+ /******/ }
53+ /******/
54+ /******/
55+ /******/ // expose the modules object (__webpack_modules__)
56+ /******/ __webpack_require__ . m = modules ;
57+ /******/
58+ /******/ // expose the module cache
59+ /******/ __webpack_require__ . c = installedModules ;
60+ /******/
61+ /******/ // __webpack_public_path__
62+ /******/ __webpack_require__ . p = "" ;
63+ /******/
64+ /******/ // Load entry module and return exports
65+ /******/ return __webpack_require__ ( 0 ) ;
66+ /******/ } )
67+ /************************************************************************/
68+ /******/ ( [
69+ /* 0 */
70+ /***/ function ( module , exports , __webpack_require__ ) {
71+
72+ Chart . React = {
73+ Bar : __webpack_require__ ( 1 ) ,
74+ Doughnut : __webpack_require__ ( 2 ) ,
75+ Line : __webpack_require__ ( 3 ) ,
76+ Pie : __webpack_require__ ( 4 ) ,
77+ PolarArea : __webpack_require__ ( 5 ) ,
78+ Radar : __webpack_require__ ( 6 )
79+ } ;
80+
81+
82+
83+
84+
85+ /***/ } ,
86+ /* 1 */
87+ /***/ function ( module , exports , __webpack_require__ ) {
88+
89+ var vars = __webpack_require__ ( 7 ) ;
90+
91+ module . exports = vars . createClass ( 'Bar' , [ 'getBarsAtEvent' ] ) ;
92+
93+
94+ /***/ } ,
95+ /* 2 */
96+ /***/ function ( module , exports , __webpack_require__ ) {
97+
98+ var vars = __webpack_require__ ( 7 ) ;
99+
100+ module . exports = vars . createClass ( 'Doughnut' , [ 'getSegmentsAtEvent' ] ) ;
101+
102+
103+ /***/ } ,
104+ /* 3 */
105+ /***/ function ( module , exports , __webpack_require__ ) {
106+
107+ var vars = __webpack_require__ ( 7 ) ;
108+
109+ module . exports = vars . createClass ( 'Line' , [ 'getPointsAtEvent' ] ) ;
110+
111+
112+ /***/ } ,
113+ /* 4 */
114+ /***/ function ( module , exports , __webpack_require__ ) {
115+
116+ var vars = __webpack_require__ ( 7 ) ;
117+
118+ module . exports = vars . createClass ( 'Pie' , [ 'getSegmentsAtEvent' ] ) ;
119+
120+
121+ /***/ } ,
122+ /* 5 */
123+ /***/ function ( module , exports , __webpack_require__ ) {
124+
125+ var vars = __webpack_require__ ( 7 ) ;
126+
127+ module . exports = vars . createClass ( 'PolarArea' , [ 'getSegmentsAtEvent' ] ) ;
128+
129+
130+ /***/ } ,
131+ /* 6 */
132+ /***/ function ( module , exports , __webpack_require__ ) {
133+
134+ var vars = __webpack_require__ ( 7 ) ;
135+
136+ module . exports = vars . createClass ( 'Radar' , [ 'getPointsAtEvent' ] ) ;
137+
138+
139+ /***/ } ,
140+ /* 7 */
141+ /***/ function ( module , exports , __webpack_require__ ) {
142+
143+ /* WEBPACK VAR INJECTION */ ( function ( global ) { module . exports = {
144+ createClass : function ( chartType , methodNames ) {
145+ var classData = {
146+ displayName : chartType + 'Chart' ,
147+ getInitialState : function ( ) { return { } ; } ,
148+ render : function ( ) {
149+ var _props = { } ;
150+ for ( var name in this . props ) {
151+ if ( this . props . hasOwnProperty ( name ) ) {
152+ if ( name !== 'data' && name !== 'options' ) {
153+ _props [ name ] = this . props [ name ] ;
154+ }
155+ }
156+ }
157+ return React . createElement ( 'canvas' , _props ) ;
158+ }
159+ } ;
160+
161+ var extras = [ 'clear' , 'stop' , 'resize' , 'toBase64Image' , 'generateLegend' , 'update' , 'addData' , 'removeData' ] ;
162+ function extra ( type ) {
163+ classData [ type ] = function ( ) {
164+ this . state . chart [ name ] . apply ( this . state . chart , arguments ) ;
165+ } ;
166+ }
167+
168+ if ( global . Chart ) {
169+ classData . componentDidMount = function ( ) {
170+ this . initializeChart ( this . props ) ;
171+ } ;
172+
173+ classData . componentWillUnmount = function ( ) {
174+ var chart = this . state . chart ;
175+ chart . destroy ( ) ;
176+ } ;
177+
178+ classData . componentWillReceiveProps = function ( props ) {
179+ var chart = this . state . chart ;
180+ chart . destroy ( ) ;
181+ this . initializeChart ( props ) ;
182+ } ;
183+
184+ classData . initializeChart = function ( props ) {
185+ var el = this . getDOMNode ( ) ;
186+ var ctx = el . getContext ( "2d" ) ;
187+ var chart = new Chart ( ctx ) [ chartType ] ( this . props . data , this . props . options || { } ) ;
188+ this . state . chart = chart ;
189+ } ;
190+
191+ var i ;
192+ for ( i = 0 ; i < extras . length ; i ++ ) {
193+ extra ( extras [ i ] ) ;
194+ }
195+ for ( i = 0 ; i < methodNames . length ; i ++ ) {
196+ extra ( methodNames [ i ] ) ;
197+ }
198+ }
199+
200+ var React = this . React || global . React ;
201+ if ( ! React ) {
202+ throw new Error ( "The charts were not initialized with the React instance" ) ;
203+ }
204+
205+ return React . createClass ( classData ) ;
206+ }
207+ } ;
208+
209+ /* WEBPACK VAR INJECTION */ } . call ( exports , ( function ( ) { return this ; } ( ) ) ) )
210+
211+ /***/ }
212+ /******/ ] )
0 commit comments