配置项如下
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [ '再婚登记人数(万人)', '初婚登记人数(万人)']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'value'
}
],
yAxis: [
{
type: 'category',
axisTick: {
show: false
},
data: ['新疆维吾尔自治区', '宁夏回族自治区', '青海省', '甘肃省', '陕西省', '西藏自治区', '云南省','贵州省',
'四川省','重庆市','海南省','广西壮族自治区','广东省','湖南省','湖北省',
'河南省','山东省','江西省','福建省','安徽省','浙江省','江苏省','上海市',
'黑龙江省','吉林省','辽宁省','内蒙古自治区','山西省','河北省','天津市','北京市']
}
],
series: [
{
name: '初婚登记人数(万人)',
type: 'bar',
stack: 'Total',
label: {
show: true
},
emphasis: {
focus: 'series'
},
data: [40.63, 10.3, 10.83, 42.55, 54.49, 5.76, 74.41,86.7,109.36,38.06,14.09,
67.47,136.53,78.67,97.2,185.1,99.51,50.83,53.99,114.17,60.58,116.28,15.92,
52.21,39.59,55.5,28.09,53.08,85.14,16.15,20.08]
},
{
name: '再婚登记人数(万人)',
type: 'bar',
stack: 'Total',
label: {
show: true,
position: 'left'
},
emphasis: {
focus: 'series'
},
data: [-2.18,-2.11,-1.41,-1.27,-11.99,-0.26,-14.81,-3.94,-36.07,-17.64,
-1.56,-11.32,-20.69,-21.2,-5.57,-8.7,-34.63,-9.58,-8.94,-28.5,-12.79,
-26.94,-9.13,-9.05,-4.71,-7.02,-11.59,-6.94,-25.24,-3.49,-13.17]
}
]
};