echarts 环形图 默认高亮展示某个数据
生活随笔
收集整理的這篇文章主要介紹了
echarts 环形图 默认高亮展示某个数据
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
環(huán)形圖默認(rèn)高亮顯示數(shù)據(jù)
?代碼:
data(){return {chart:null,} }, methods: {initChart() {this.chart = this.$echarts.init(document.getElementById(this.id))this.chart.setOption({color: color,})this.getDefaultSelected()}getDefaultSelected() {this.chart.dispatchAction({type: "highlight",seriesIndex: 0,dataIndex: 0});this.chart.on("mouseover", e => {if (e.dataIndex !== this.index) {this.chart.dispatchAction({type: "downplay",seriesIndex: 0,dataIndex: this.index});}});this.chart.on("mouseout", e => {this.index = e.dataIndex;this.chart.dispatchAction({type: "highlight",seriesIndex: 0,dataIndex: e.dataIndex});});}}解析
?type ?觸發(fā)action類型
seriesIndex ?series索引
dataIndex ? 高亮數(shù)據(jù)索
1,進(jìn)入頁面可以觸發(fā)第1條數(shù)據(jù)的選中action?
2,鼠標(biāo)指向別的圖塊時(shí),展示選中數(shù)據(jù)的圖塊信息,隱藏默認(rèn)色塊高亮信息?
3,鼠標(biāo)離開環(huán)形圖時(shí),展示默認(rèn)第一條數(shù)據(jù)
總結(jié)
以上是生活随笔為你收集整理的echarts 环形图 默认高亮展示某个数据的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小班教案《说句悄悄话》
- 下一篇: ElementUI中实现表单刷新重置,保