1、设置 legend 属性: selectedMode: 'single'

 

2、使用 myCharts.dispatchAction 来设置legend的聚焦

broadcast (v) {
            // 如果是false,则消灭轮播
            if (v === false) return clearInterval(this.timer) 
            // 获取legend的data
            const data = this.myChart.getOption().legend[0].data
            // 首次总是从0开始的
            let i = 0
            // 开始轮播
            this.timer = setInterval(() => {
                // 激活
                this.myChart.dispatchAction({ type: 'legendToggleSelect', name: data[ ++i % data.length ] })
            }, 3500)
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
相关资源
相似解决方案