在 Vuejs2.0 组件中使用 Echarts3.0,我试图在堆积条形图中的 y 轴上分配百分比。我尝试了boundaryGap、splitnumber 等,但都没有奏效。但我无法实现它,任何人都知道我怎样才能在 y 轴上获得 % ?
export default {
data: () => ({
loading: true,
bar: {
xAxis: {
type: 'category',
data: ['Location1','Location2']
},
yAxis: {
type: 'value',
splitNumber: 10,
boundaryGap: ['0', '100%'],
min:0,
max:100,
scale:true,
splitArea : {show : true},
label: {
formatter: function(){
return 100 * value /$(this.axis.tickPositions).last()[0]
+ '%';
}
}
},
series: [
{
name: 'Location1',
type: 'bar',
stack: 'one',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [1100, 2050]
},
{
name: 'Location2',
type: 'bar',
stack: 'one',
label: {
normal: {
show: true,
position: 'insideRight'
}
},
data: [291064, 34789]
}
]
}
})