配置项如下
var data = [36, 54, 10]
var titlename = ['科室', '管理所', '专业所'];
var valdata = []
var myColor = ['#1089E7', '#F57474', '#8B78F6'];
option = {
title:{
text:"2018年楼宇统计",
left:200,
top:70
},
grid: {
containLabel: true,
left: "10%",
right: "15%",
top: "25%",
bottom:"30%",
},
backgroundColor: '#ffff',
xAxis: {
show: false
},
yAxis: [{
show: true,
data: titlename,
inverse: true,
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
color: '#080808',
formatter: function(value, index) {
return [
'{title|' + value + '} '
].join('\n')
},
rich: {
lg: {
backgroundColor: '#339911',
color: '#fff',
borderRadius: 15,
// padding: 5,
align: 'center',
width: 15,
height: 15
},
}
},
}, {
show: true,
inverse: true,
data: valdata,
axisLabel: {
textStyle: {
fontSize: 12,
color: '#080808',
},
},
axisLine: {
show: false
},
splitLine: {
show: false
},
axisTick: {
show: false
},
}],
series: [{
name: '条',
type: 'bar',
yAxisIndex: 0,
data: data,
barWidth: 20,
itemStyle: {
normal: {
barBorderRadius: 30,
color: function(params) {
var num = myColor.length;
return myColor[params.dataIndex % num]
},
}
},
label: {
normal: {
show: true,
position: 'inside',
formatter: '{c}%'
}
},
}, {
name: '框',
type: 'bar',
yAxisIndex: 1,
barGap: '-100%',
data: [100, 100, 100],
barWidth: 26,
itemStyle: {
normal: {
color: 'none',
borderColor: '#00c1de',
borderWidth: 3,
barBorderRadius: 15,
}
}
}, ]
};