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);}
2023每日刷题(二十七)
Leetcode—69.x的平方根 直接法实现代码
int mySqrt(int x) {long long i 0;while(i * i < x) {i;}if(i * i > x) {return i - 1;}return i;
}运行结果 二分法实现代码
int mySqrt(int x) {long long left 0, right (l…