共计 314 个字符,预计需要花费 1 分钟才能阅读完成。
echarts 提供了点击事件方法,首先需要确定点击的范围
以横向柱状图 为例,若不设置属性,添加点击事件后默认为柱型
设置可点击属性,需添加以下配置
yAxis:[{
silent: false,
triggerEvent: true,
axisLabel: {
clickable:true,
}
}]
在 init 函数中添加点击事件
其中 this.students 为当前绘图对象
this.students.on('click', function (params) {
console.log(params);
console.log('点击的是第'+params.dataIndex);
});
点击事件中参数 params
原文地址: 【可视化开发】echarts 点击事件
正文完