barWidth: 15, // 设置柱体宽度
barCategoryGap : '30', // 类目间距离
barGap : '20%', // 同一类目下多个柱体间距离
option= {
title : {
text : '统计情况',
x : 'center' // 设置位置 (left,center,right)
},
tooltip : {
trigger : 'axis'
},
legend : {
data : [ '情况1', '情况2', '情况3' ],
y : 'bottom' // 设置位置(bottom,top)
},
toolbox : {
show : true,
feature : {
mark : {
show : true
},
dataView : {
show : true,
readOnly : false
},
restore : {
show : true
},
saveAsImage : {
show : true
}
}
},
calculable : true,
xAxis : [ {
type : 'category',
data : [ '数量' ]
} ],
yAxis : [ {
type : 'value'
} ],
series : [ {
name : '情况2',
type : 'bar',
barWidth : '50',
barCategoryGap : '30',
barGap : '20%',
data : [ 0 ]
}, {
name : '情况1',
type : 'bar',
barWidth : '50',
barCategoryGap : '30',
barGap : '20%',
data : [ 2 ]
}, {
name : '情况3',
type : 'bar',
barWidth : '50',
barCategoryGap : '30',
barGap : '20%',
data : [ 3 ]
} ],
label : {
normal : {
show : true,
position : 'top', // 柱体顶端显示数值
textStyle : {
color : 'black'
}
}
}
}