<!-- 引入echarts UMD 环境-->
<script src="js/echarts/build/dist/echarts.js"></script>
require.config({
paths:{
'echarts' : 'js/echarts/build/dist'
}
});
require(
[
'echarts',
'echarts/chart/pie' // 使用柱状图就加载bar模块,按需加载
],
function (ec) {
// 基于准备好的dom,初始化echarts图表
myChart = ec.init(document.getElementById('main'));
var option = {...};
// 为echarts对象加载数据
myChart.setOption(option);
// 添加事件
var ecConfig = require('echarts/config');
myChart.on(ecConfig.EVENT.CLICK, function (param){
...
});
});