amcharts / amcharts3-react

Official amCharts V3 React component
Apache License 2.0
118 stars 50 forks source link

event example crashes on react 16 #70

Open elpinguinofrio opened 6 years ago

elpinguinofrio commented 6 years ago
ReferenceError: AmCharts is not defined
(anonymous function)
node_modules/@amcharts/amcharts3-react/amcharts3-react.js:253
  250 | 
  251 | var id = 0;
  252 | 
> 253 | AmCharts.React = createReactClass({
  254 |   getInitialState: function () {
  255 |     return {
  256 |       id: "__AmCharts_React_" + (++id) + "__",
View compiled
./node_modules/@amcharts/amcharts3-react/amcharts3-react.js
node_modules/@amcharts/amcharts3-react/amcharts3-react.js:297
  294 |       });
  295 |     }
  296 |   });
> 297 | })();
  298 | 
  299 | 
  300 | 
View compiled
__webpack_require__
/Users/Shared/simulation/webpack/bootstrap 583ffc45c54f897f5278:678
  675 | };
  676 | 
  677 | // Execute the module function
> 678 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
  679 | 
  680 | // Flag the module as loaded
  681 | module.l = true;
View compiled

looks like devs had abandoned the project.

raymondsiu commented 6 years ago

I'm using this project heavily and it has been pretty stable. Can you show how you are importing amcharts3-react and amcharts3 into your React code? I suspect it is an ordering issue. You need to import all your amcharts3 dependencies before you import amcharts3-react.

Example:

import React from 'react';
import PropTypes from 'prop-types';
import 'amcharts3';
import 'amcharts3/amcharts/serial';
import 'amcharts3/amcharts/pie';
import 'amcharts3/amcharts/themes/light';
import 'amcharts3/amcharts/plugins/export/export.min.js';
import 'amcharts3/amcharts/plugins/export/export.css';
import AmCharts from '@amcharts/amcharts3-react';
junjianglin commented 5 years ago

Sorry this is unrelated to the issue, I just want to find the user elpinguinofrio.

Hello elpinguinofrio, one of my repo you forked contains some sensitive information. Do you mind remove those information? Github does not support private message, this is the only way I can reach out to you. Please leave a message to me and we can figure out the details.