echart.getZr().on('click', function(params) {
// var pointInPixel = [params.offsetX, params.offsetY]
const { target, topTarget } = params
//如果点击echart空白地方,topTarget 是空
if( topTarget && topTarget.z === 2){
// 获取折线的 index
// 如果是拐点,直接读取 target.seriesIndex
// 如果是折线上的点,读取 topTarget ,通过 paren获取到index
const axs = target ? target.seriesIndex : topTarget.parent.parent.__ecComponentInfo.index
dataLines.forEach((elm,index) => {
if(axs == index) {
alert('ewewewewe')
}
})
}
})
echart折线点击整条线弹出 信息
最新推荐文章于 2024-07-24 16:11:36 发布