// 路径配置
require.config({
paths: {
'echarts': '/public/echarts-2.2.7/doc/example/www/js'
}
})
// 使用
require(
[
'echarts',
'echarts/chart/pie'// 饼图
], DrawCharts)
function DrawCharts(ec) {
var char1 = ec.init(document.getElementById('p'))
var ecConfig = require('echarts/config')
char1.on(ecConfig.EVENT.CLICK, eConsole)
......//正常的echarts
}
function eConsole(param) {
if (typeof param.seriesIndex == 'undefined') {
return
}
if (param.type == 'click') {
var name = param.name
alert(name)
}
}
重点就是 :
var ecConfig = require('echarts/config')
char1.on(ecConfig.EVENT.CLICK, eConsole)
估计是用js代码循环监听页面,一旦出现了某种变化,就触发点击事件。比如document.getElementById("XXX").trigger("click")之类的。猜测而已~欢迎分享,转载请注明来源:内存溢出
评论列表(0条)