vue使用Echarts


Eacharts 使用

  • 创建

    const myChart = this.$echarts.init(document.getElementById('myChart'))
    // 调用showLoading方法
    myChart.showLoading({
    	text: '加载中...',
        color: '#1444d9',
        textColor: '#000',
        maskColor: 'rgba(255, 255, 255, 0.5)',
        zlevel: 0,
    });
    mtChart.setOption(
        // 配置对象,详见https://echarts.apache.org/zh/option.html
    	option
    )
    myChart.hideLoading();
    
  • 销毁

    // 销毁之前已存在的实例
    document.getElementById('myChart').removeAttribute('_echarts_instance_');
    
  • Echarts设置点击事件

    myChart.on('click', params => {
    	console.log(params)
    })