echarts监听图表的legend移入移出事件

1,228 阅读1分钟

移入

this.chart.getZr().on('mouseover', event => {
   const legendDataIndex = event.topTarget.parent.__legendDataIndex // 每个legend的index
})

移出

this.chart.getZr().on('mouseout', event => {
 const legendDataIndex = event.topTarget.parent.__legendDataIndex // 每个legend的index
})

来源

监听“空白处”的事件