amcharts / amcharts3-react

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

amcharts3-react.js:253 Uncaught ReferenceError: AmCharts is not defined #54

Closed emorling closed 7 years ago

emorling commented 7 years ago

I have followed the step-by-step instructions but get:

amcharts3-react.js:253 Uncaught ReferenceError: AmCharts is not defined
    at eval (amcharts3-react.js:253)
    at eval (amcharts3-react.js:298)
    at Object.<anonymous> (vendor.js?version=0.9.9d:2732)
    at __webpack_require__ (vendor.js?version=0.9.9d:55)
    at eval (index.js:6)
    at Object.<anonymous> (vendor.js?version=0.9.9d:2738)
    at __webpack_require__ (vendor.js?version=0.9.9d:55)
    at eval (stages.jsx:9)
    at Object.<anonymous> (loader-main.js?version=0.9.9d:1806)
    at __webpack_require__ (vendor.js?version=0.9.9d:55)

Any ideas?

Pauan commented 7 years ago

Make sure that your HTML file has this code in it:

<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>

The AmCharts <script> tags should be before all your other <script> tags.

thilinaucsc commented 7 years ago

I have same issue

I try module from https://github.com/amcharts/amcharts3 like below

import '/node_modules/amcharts3/amcharts/amcharts'
import '/node_modules/amcharts3/amcharts/serial'
import '/node_modules/amcharts3/amcharts/pie'
import '/node_modules/amcharts3/amcharts/themes/light'
import '/node_modules/amcharts3/amcharts/plugins/export/export.min'
import '/node_modules/amcharts3/amcharts/plugins/export/export.css'

Or

<script src="/node_modules/amcharts3/amcharts/amcharts.js"></script>
<script src="/node_modules/amcharts3/amcharts/serial.js"></script>
<script src="/node_modules/amcharts3/amcharts/pie.js"></script>
<script src="/node_modules/amcharts3/amcharts/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="/node_modules/amcharts3/amcharts/plugins/export/export.css" type="text/css" media="all" />
<script src="/node_modules/amcharts3/amcharts/themes/light.js"></script>
<script src="/node_modules/amcharts3/amcharts/plugins/responsive/responsive.min.js" type="text/javascript"></script>

I want to get Amcharts libs from Installing via npm ( npm install amcharts/amcharts3 ), give me advice for do this.

Pauan commented 7 years ago

@emorling It seems that you solved the problem, so I'm going to close this.

Feel free to make a new issue if you have any more problems.


@thilinaucsc You must load AmCharts using <script> tags, import will not work.

If you have installed AmCharts with npm, then you will have to host the node_modules/amcharts3 folder on your server.

We cannot help you with this, because every server is different.