如何设置两个柱根据两个X轴显示
配置项如下
option = {
color: ["#057bff", "#05c7ff"],
title: {
text: "泊位周转率利用率",
textStyle: {
color: "#81add6",
fontSize: 16,
fontWeight: 500
},
left: 15,
top: 10
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
crossStyle: {
color: "#999"
}
}
},
grid: {
width: '50%',
height: '70%',
left: '35%',
top: '20%'
},
legend: {
orient: 'vertical',
right: "2%",
top: "right",
itemWidth: 15,
itemHeight: 15,
itemGap: 15,
textStyle: {
fontSize: 14,
color: "#05c7ff"
},
data: ["周转率", "利用率"]
},
xAxis: [{
type: 'value',
boundaryGap: [0, 0.01],
name: '%',
max: 100,
axisLine: {
lineStyle: {
color: '#6a9ab2',
opacity: 0.5
}
},
axisTick: {
show: false
},
splitLine: {
lineStyle: {
opacity: 0.5
}
}
},
{
type: 'value',
name: '/次',
min: 0,
max: 1,
interval: 0.2,
axisLabel: {
formatter: '{value} 次'
},
axisLine: {
lineStyle: {
color: '#6a9ab2',
opacity: 0.5
}
},
axisTick: {
show: false
},
axisLabel: {
show: true
},
splitLine: {
lineStyle: {
opacity: 0.5
}
}
},
],
yAxis: {
type: 'category',
data: ['12-15', '12-16', '12-17', '12-18', '12-19', '12-20', '12-21'],
axisLine: {
lineStyle: {
color: '#6a9ab2'
}
},
axisTick: {
show: false
}
},
series: [{
name: '周转率',
type: 'bar',
data: [0.8, 1.2, 0.9, 1.3, 1.1],
barGap: '0',
barWidth: '15',
itemStyle: {
barBorderRadius: 15
},
xAxisIndex: 1
},
{
name: '利用率',
type: 'bar',
data: [53, 45, 35, 58, 41],
barGap: '0',
barWidth: '15',
itemStyle: {
barBorderRadius: 15
},
xAxisIndex: 0
}
]
};