柱状图上如何显示所占百分比
配置项如下
option = {
color: ['#367DA2'],
title: {
text: '推荐配置视图',
left: 'center',
textStyle: {
fontSize: 14,
fontWeight: 'normal',
},
},
legend: {
bottom: '0%',
data: ['配置比例']
},
tooltip: {
show: true
},
xAxis: [{
type: 'category',
axisLine: {
onZero: false
},
axisTick: {
show: false
},
data: ["国内固定权益", "海外固定权益", "大商品", "货币", "国内权益", "海外权益", "对冲投资", "另类投资"]
}],
yAxis: [{
type: 'value',
splitNumber: 4,
max: 80,
min: 0,
interval: 20,
axisLabel: {
formatter: function(value) {
return value.toFixed(2) + '%';
}
},
axisLine: {
show: false
},
axisTick: {
show: false
}
}],
grid: {
left: '0%',
right: '4%',
bottom: '10%',
top: '15%',
containLabel: true
},
series: [{
name: "销量",
type: "bar",
barWidth: '45%',
data: [5, null, null, null, 15, 68, null, null],
label: {
normal: {
show: true,
position: 'top',
formatter: function(param) {
return param.value.toFixed(2) + '%';
}
}
},
}]
};