AugTang commented on issue #18859:
URL: https://github.com/apache/echarts/issues/18859#issuecomment-1623683172
轮播代码如下:
// 地图高亮轮播
mapActive() {
const mapData = ['上海', '河北', '山西', '内蒙古', '辽宁',
'吉林','黑龙江', '江苏', '浙江', '安徽', '福建', '江西', '山东','河南', '湖北', '湖南', '广东', '广西',
'海南', '四川', '贵州', '云南', '西藏', '陕西', '甘肃', '青海', '宁夏', '新疆', '北京', '天津', '重庆',
'香港', '澳门', '台湾'];
if (!this.chartMap) {
return
}
const dataLength = mapData.length
// 用定时器控制高亮
this.carouselTime = setInterval(() => {
// 清除之前的高亮
this.chartMap.dispatchAction({
type: 'downplay',
seriesIndex: 0,
// mapIndex: this.mapIndex
})
this.mapIndex++
// 当前下标高亮
this.chartMap.dispatchAction({
type: 'highlight',
seriesIndex: 0,
mapIndex: this.mapIndex
})
this.chartMap.dispatchAction({
type: 'showTip',
seriesIndex: 0,
mapIndex: this.mapIndex
})
if (this.mapIndex > dataLength) {
this.mapIndex = 0
}
console.log('this.chartMap----', this.chartMap)
console.log('this.mapIndex----', this.mapIndex)
}, 3000)
this.chartMap.on('mouseover', () => {
// 停止定时器,清除之前的高亮
clearInterval(this.carouselTime)
this.carouselTime = null
this.chartMap.dispatchAction({
type: 'downplay',
seriesIndex: 0,
mapIndex: this.mapIndex
})
})
// 鼠标划出重新定时器开始
this.chartMap.on('mouseout', () => {
clearInterval(this.carouselTime)
this.carouselTime = null
this.mapActive()
})
},
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]