echarts餅圖自動顯示資料
阿新 • • 發佈:2019-02-17
在做echarts餅圖的時候,預設是不顯示資料,現在要直接把資料顯示在上面,程式碼如下:
主要是在normal中加了裡面的程式碼,就可以顯示了,效果如下:series: [ { name: '處理狀態', type: 'pie', radius: ['50%', '70%'], itemStyle: { normal: {label:{ show:true, formatter:'{b} : {c} ({d}%)' }, labelLine:{show:true}}, emphasis: { label: { show: true, formatter: "{b}\n{c} ({d}%)", position: 'center', textStyle: { fontSize: '30', fontWeight: 'bold' } } } }, data: pie_data } ]