配置项如下
var xAxisData = [1,2,3,4,5,6,7];
var data2 = [5,-2,-3,-10,-5,-6,-1];
var MAX = 10;
option = {
legend: {
data: ['bar2'],
align: 'left'
},
xAxis: {
data: xAxisData,
type :"category",
position:"top",
boundaryGap:true
},
yAxis: {
interval:1,
type:'value',
axisLabel: {
formatter: function (value) {
return value + MAX;
}
}
},
series: [{
name: 'bar2',
type: 'bar',
data: data2.map(function (val) {
return val - MAX;
}),
label: {
normal: {
show: true,
formatter: function (params) {
return params.value + MAX;
}
}
}
}]
};