负值为0 时,标签跑到了正值的右边
配置项如下
app.title = '正负条形图';
option = {
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
},
legend: {
data: ['结余', '总经费', '支出']
},
grid: {
top: '10%',
left: '4%',
right: '6%',
containLabel: true
},
dataZoom: [{
show: true,
yAxisIndex: 0,
filterMode: 'empty',
width: '3%',
height: '80%',
showDataShadow: false,
left: '0%',
start: 100,
end: 60
}],
xAxis: [{
type: 'value',
name: '万元'
}],
yAxis: [{
type: 'category',
axisTick: {
show: false
},
data: ["测试1","测试2","测试3","测试4","测试5","测试6","测试7","测试8","测试9","测试10"]
}],
color: ['#00b38f', '#6699ff', '#ff1a66'],
series: [{
name: '结余',
type: 'bar',
label: {
normal: {
show: true,
position: 'right'
}
},
data: [96316, 203696, 212927, 239590, 253295, 292835, 332892, 347277, 551859, 959772]
}, {
name: '总经费',
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'right'
}
},
data: [411168, 588026, 861152, 559590, 358023, 542407, 642892, 508388, 997236, 1100763]
}, {
name: '支出',
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'left'
}
},
data: [-314852, -384330, -648225, -320000, -104728, -249572, -310000, -161111, -445377, 0]
}]
};