/**
 * 地图组件
 */
import React, {Component} from "react";
import ReactEcharts from 'echarts-for-react';
import "echarts-amap";
import chartConfig from '../config';
import '../china';
import config from "../config";
/*盒子-父元素必须有定位属性*/
const box = {
    position: "absolute",
    top: 0,
    bottom: 0,
    right: 0,
    left: 0,
    display: "flex"
}
class map extends Component {
    state = {
        option: chartConfig.getMapOpt()
    }
    componentWillReceiveProps(props) {
        const {option = {}} = props;
        this.setState({
            option:chartConfig.assign(option || {}) || {}
        });
        this.refs.echartsReact.getEchartsInstance().setOption(option); 
    }
    render() {
        const {option} = this.state;
        return (
            <div className={box}>
                <ReactEcharts
                    ref="echartsReact"
                    option={option}
                    style={{
                    position: 'absolute',
                    top: 0,
                    height: '100%',
                    width: "100%"
                }}></ReactEcharts>
            </div>
        );
    }
}
export {
    map
}
export default map;