amcharts / amcharts3-react

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

JSX version misc #4

Closed msimonc closed 8 years ago

msimonc commented 8 years ago

Couple of things: <div className="height400"> <AmCharts {...config}/> </div> works better than <AmCharts.React {...config}/>

but I get 'undefined' on the X axis:

screen shot 2016-09-12 at 2 09 02 pm

Also install: $ npm install amcharts3 --save npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "amcharts3" "--save" npm ERR! node v6.1.0 npm ERR! npm v3.8.6 npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/amcharts3 npm ERR! 404 npm ERR! 404 'amcharts3' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404

but it worked when I manually edited package.json then did npm install

var AmCharts = require("amcharts3-react");

class ClassName extends React.Component {

constructor(props) {
    super(props);
    this.render = this.render.bind(this);
}

render() {
    var chartData = [{
        "country": "USA",
        "visits": 4252
    }, {

...

    var _grphs = [{
        "valueField": "visits",
        "type": "column"
    }];
    var config = {
        "type": "serial",
        "theme": "light",
        "graphs": _grphs,
        "dataProvider": chartData
    };
Pauan commented 8 years ago

If you are using the Webpack version, then yes you will need to use AmCharts rather than AmCharts.React


You cannot use npm install amcharts3 because AmCharts is not published on NPM.

Instead, you need to use the GitHub syntax: npm install amcharts/amcharts3


Are you specifying the categoryField?

"categoryField": "country"