echart餅狀圖、柱狀圖上顯示百分比、資料值
阿新 • • 發佈:2019-02-20
柱狀圖:
echart 3.0寫法:
series:[{
label: {
normal: {
show: true,
position: 'inside',
formatter: '{c},({d}%)'//多值的巢狀
}
}
}]
echart 2.0寫法:
series: [{ type: 'bar', itemStyle: { normal: { label: { show: true, position: 'inside',//資料在中間顯示 formatter:'{c}'//百分比顯示,模板變數有 {a}、{b}、{c}、{d},分別表示系列名,數 據名,資料值,百分比。{d}資料會根據value值計算百分比 } } } }]