效果如下:(贴不了视频!)..........
核心js代码:
const showTooltip = (myChart: any) => {
myChart.dispatchAction({
// 取消之前高亮的图形
type: 'downplay',
seriesIndex: 0,
dataIndex: currentIndex,
})
currentIndex = (currentIndex + 1) % dataLen
// 高亮当前图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: currentIndex,
})
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex,
})
}