var graphic =[{type:'text',left:'center',top:'center',style:{text:getPieText(pieData, currentIndex),textAlign:'center',fill:'#000',fontSize:18,fontWeight:'bold',}}];
获取文字,全称太长取前两个字(关注黑龙江!!)
functiongetPieText(data, index){var name = data[index].name.substring(0,2);if(data[index].name =='黑龙江省'){name = data[index].name.substring(0,3);}return name +((data[index].value /getTotalValue(data)*100).toFixed(2))+'%';}functiongetTotalValue(data){return data.reduce((total, current)=>{return total + current.value;},0);}