- 默认选中一项数据
在setOption后面加入代码 饼图会默认选中一项 移出也会选中最后停留的数据上
myChart.setOption(option, true);
myChart.dispatchAction({type: 'highlight',seriesIndex: 0,dataIndex: 0});
myChart.on('mouseover',function(e){
if(e.dataIndex != index){
myChart.dispatchAction({type: 'downplay', seriesIndex: 0, dataIndex: index });
}
});
myChart.on('mouseout',function(e){
index = e.dataIndex;
myChart.dispatchAction({type: 'highlight',seriesIndex: 0,dataIndex: e.dataIndex});
});
- 饼图圆环图移入时数据显示value在中心
emphasis: {
label: {
position: 'center',
show : true,
formatter: "{b}{c}"
}
},
label: {
normal: {
position: 'center',
show : false
}
}