Article From:https://www.cnblogs.com/CyLee/p/9967756.html

1、Set the legend property: selectedMode: single’

 

2、Use myCharts. dispatchAction to focus legend

broadcast (v) {
            // If false, eliminate rotation
            if (v === false) return clearInterval(this.timer) 
            // Get the data of legend
            const data = this.myChart.getOption().legend[0].data
            // The first time always starts at zero.
            let i = 0
            // Start the wheel.
            this.timer = setInterval(() => {
                // activation
                this.myChart.dispatchAction({ type: 'legendToggleSelect', name: data[ ++i % data.length ] })
            }, 3500)
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *