amcharts / amcharts3-react

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

node_modules empty? #9

Open scheung38 opened 8 years ago

scheung38 commented 8 years ago

webpack/examples.js

render: function () {
    // Render the chart
    return React.createElement(AmCharts, {
      "path": "node_modules/amcharts3/amcharts",

But after npm install, node_modules is still empty?

Also why is there no makeChart here

var chart = AmCharts.makeChart("chartdiv", {...}

But it is shown in most examples? Do I not need it?

Noticed I added in package.json

"scripts": { "prepublish": "webpack" } but when removed, node_modules are generate. If not sure why we need prepublish

Pauan commented 8 years ago

Do you get any error messages when you run npm install?

Are you in the examples/webpack directory when you run npm install?


When using the amcharts3-react plugin, you must use React.createElement(AmCharts, { ... }) rather than AmCharts.makeChart("chartdiv", { ... })

The options are the same as AmCharts.makeChart, except that the id "chartdiv" is created automatically by the plugin, so you do not need to specify it.


After running npm install it needs to run webpack to bundle all of the JavaScript files into a single build/example.js file.

You can remove the prepublish, but then you need to run both npm install and webpack, rather than just npm install, so it is less convenient.