ammap3 icon indicating copy to clipboard operation
ammap3 copied to clipboard

Uncaught TypeError: Cannot read property 'areas' of undefined, Uncaught TypeError: Cannot read property 'scale' of undefined

Open gfoiani opened this issue 8 years ago • 1 comments

Hi,

I'm using trying to build a map chart following the your first map tutorial. I'm using the library inside a React application with ES6 and Babel. I created an SVG map using the Pixel Map tool you suggested and I'm using it through mapUrl option. I get the following errors:

Uncaught TypeError: Cannot read property 'areas' of undefined
Uncaught TypeError: Cannot read property 'scale' of undefined

I imported the library as suggested here This is my code:

import React, { Component } from 'react';
import AmCharts from 'exports?window.AmCharts!ammap3/ammap/ammap';

export default class Map extends Component {

  componentDidMount() {
    AmCharts.makeChart( 'mapdiv', {
      type: 'map',
      mapUrl: require('../images/amCharts.pixelMap.svg')
    });
  }

  render() {
    const style = {
      width: '600px',
      height: '400px'
    };
    return (
      <div id="mapdiv" style={style}></div>
    );
  }
}

gfoiani avatar Mar 03 '16 11:03 gfoiani

Sorry for the late reply. Would you be able to try this with our official React wrapper?

https://github.com/amcharts/amcharts3-react

martynasma avatar Oct 27 '16 05:10 martynasma