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 });
}
});
路過點贊,好人一生平安