1.地图高亮+显示tooltip
let myChart = this.$echarts.init(this.$refs.mapChart)
// 取消高亮
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: this.index - 1
});
// 高亮
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: this.index
});
// 显示tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0, // 显示第几个series
dataIndex: this.index // 显示第几个数据
})
2.定时器显示
timedCount (myChart) {
if (this.timer) {
clearTimeout(this.timer)
this.timer = null
}
this.timer = setTimeout(() => {
this.index < (this.data.areaData.length) ? this.index++ : this.index = 0
// 取消高亮
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: this.index - 1
});
// 高亮
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: this.index
});
// 显示tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0, // 显示第几个series
dataIndex: this.index // 显示第几个数据
})
this.timedCount(myChart)
}, 1000)
}