您的位置:首页 > Web前端 > React

react+echart 体验基本图标展示

2017-09-25 14:34 120 查看
/**

 * Created by wangyan on 2017/2/22.

 */

import React from "react";

import echarts from 'echarts';

import $ from 'jquery';

import '../../../node_modules/echarts/map/js/china';

import '../../../node_modules/echarts/map/js/province/beijing';

export default class Home extends React.Component {

    componentDidMount() {

        // 基于准备好的dom,初始化echarts实例

        var myChart = echarts.init(document.getElementById('main'));

        // 绘制图表

        myChart.setOption({

            title: { text: 'ECharts 入门示例' },

            tooltip: {},

            xAxis: {

                data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]

            },

            yAxis: {},

            series: [{

                name: '销量',

                type: 'bar',

                data: [5, 20, 36, 10, 10, 20]

            }]

        });

    }

    render() {

        return (

            <div id="main" style={{ width: 400, height: 400 }}></div>

        );

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: