echarts实现如下效果

实现代码:
let index = 0
this.myChart.dispatchAction({
type: "highlight",
seriesIndex: 0,
dataIndex: 0
})
this.myChart.on("mouseover", e => {
if (e.dataIndex != index) {
this.myChart.dispatchAction({
type: "downplay",
seriesIndex: 0,
dataIndex: index
})
}
})
this.myChart.on("mouseout", e => {
index = e.dataIndex
this.myChart.dispatchAction({
type: "highlight",
seriesIndex: 0,
dataIndex: e.dataIndex
})
})

本文介绍如何使用 ECharts 实现鼠标悬停时图表元素的高亮显示及移除高亮的交互效果,通过代码示例详细解析了系列索引和数据索引在实现过程中的应用。

1249

被折叠的 条评论
为什么被折叠?



