配置项如下
app.title = '正负条形图';
option = {
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data:['男性-宿松县', '女性-宿松县','男性-全国','女性-全国']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'value'
}
],
yAxis : [
{
type : 'category',
axisTick : {show: true},
data : ['0~4岁','5~9岁','10~14岁','15~19岁','20~24岁','25~29岁','30~34岁','35~39岁','40~44岁','45~49岁','50~54岁','55~59岁','60~64岁','65~69岁','70~74岁','75~79岁','80~84岁','85~89岁','90~94岁','95~99岁','100以上岁']
}
],
series : [
{
name:'女性-宿松县',
type:'bar',
stack: '分量',
label: {
normal: {
show: false
}
},
data:[0.03,0.03,0.03,0.05,0.02,0.02,0.02,0.05,0.05,0.04,0.02,0.03,0.03,0.02,0.02,0.01,0.01,0.00,0.00,0.00,0.00]
},
{
name:'男性-宿松县',
type:'bar',
stack: '分量',
label: {
normal: {
show: false,
//position: 'left'
}
},
data:[-0.04,-0.05,-0.04,-0.04,-0.02,-0.02,-0.02,-0.04,-0.05,-0.04,-0.02,-0.03,-0.03,-0.02,-0.02,-0.01,-0.01,-0.00,-0.00,-0.00,-0.00]
},
{
name:'男性-全国',
type:'bar',
stack: '总量',
label: {
normal: {
show: false,
//position: 'left'
}
},
data:[-0.03,-0.03,-0.03,-0.04,-0.05,-0.04,-0.04,-0.05,-0.05,-0.04,-0.03,-0.03,-0.02,-0.02,-0.01,-0.01,-0.00,-0.00,-0.00,-0.00,-0.00]
},
{
name:'女性-全国',
type:'bar',
stack: '总量',
label: {
normal: {
show: false,
//position: 'left'
}
},
data:[0.03,0.02,0.03,0.04,0.05,0.04,0.04,0.04,0.05,0.04,0.03,0.03,0.02,0.02,0.01,0.01,0.01,0.00,0.00,0.00,0.00]
}
]
};