Vue Echarts 餅圖設置默認選中一個


Vue Echarts 餅圖設置默認選中一個

        myChart.setOption(data) // data偉echarts所需要傳入的參數,就是配置參數最多的那個玩意
        myChart.dispatchAction({ type: 'highlight', dataIndex: 0 }); // dataIndex屬性偉data傳入的索引值
        myChart.dispatchAction({ type: 'showTip', seriesIndex: 0, position: [120, 220], dataIndex: 0 }); // 點擊生成detip工具條位置
        myChart.on('mouseover', (e) => {
          if (e.dataIndex !== 0) { // 當鼠標移除的時候 使默認的索引值去除默認選中
            myChart.dispatchAction({ type: 'downplay', dataIndex: 0 });
          }
        });

路過點贊,好人一生平安


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM