Won*_*art 3 javascript bar-chart echarts yaxis vuejs2
在 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]
}
]
}
Run Code Online (Sandbox Code Playgroud)
})
小智 7
以以下格式设置 yAxis
yAxis: [{
type: "value",
name: "%",
axisLabel: {
formatter: "{value} %"
}
}]
Run Code Online (Sandbox Code Playgroud)