1. 程式人生 > >Echarts餅圖各項數值和佔比顯示,以及字型大小調整

Echarts餅圖各項數值和佔比顯示,以及字型大小調整

series : [ {
//name : '',
name:'',
type : 'pie',
radius : '65%',
center : [ '50%', '50%' ],
label : {
normal : {
formatter: '{b}:{c}: ({d}%)',
textStyle : {
fontWeight : 'normal',
fontSize : 15
}
}
},

data:[],
itemStyle : {
emphasis : {
shadowBlur : 10,
shadowOffsetX : 0,
shadowColor : 'rgba(0, 0, 0, 0.5)'
}
}

} ]

紅色部分,字型大小以及各項數值佔比都在lable的normal{}中配置,在formatter中配置各項顯示數值百分比等,

其中{b}表示各項名稱,此項配置為預設顯示項,{c}表示此項的數量顯示,預設不顯示,({d}%)表示此項佔比,預設不顯示。

textStyle:{}用來配置字型屬性,fontWeight表示文字字型的粗細,可選'normal''bold''bolder''lighter';

fontSize表示字型大小,預設為12,通過配置此項來調節餅圖各項字型大小顯示。