配置项如下
option = {
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
shadowStyle: {
color: '#191c2c',
opacity: 0.5
}
},
backgroundColor: '#1b1e32',
padding: [15, 20]
},
grid: {
left: '0%',
top: '40px',
right: '0',
bottom: '0',
containLabel: true
},
xAxis: {
type: 'category',
// data: ['周一','周二','周三','周四','周五','周六','周日'],
data: ["01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00"],
axisLabel: {
color: '#b1b1b1',
margin: 14
}
},
yAxis: [{
name: '用水流量/m³/h',
max: 310,
min: 0,
interval: 62,
nameTextStyle: {
padding: [3, -12, 10, 0],
color: '#b1b1b1'
},
type: 'value',
axisLabel: {
// show: false,
color: '#b1b1b1',
margin: 21
},
axisLine: {
show: false
},
axisTick: {
show: true
},
splitLine: {
lineStyle: {
color: '#31354a',
type: 'dashed'
}
},
splitNumber: 5
},
{
name: '用水量/m³',
max: 240,
min: 0,
interval: 48,
nameTextStyle: {
padding: [3, 0, 10, 10],
color: '#b1b1b1'
},
type: 'value',
axisLabel: {
// show: false,
color: '#b1b1b1',
margin: 21
},
axisLine: {
show: false
},
axisTick: {
show: true
},
splitLine: {
lineStyle: {
color: '#31354a',
type: 'dashed'
}
},
splitNumber: 5
}
],
series: [{
name: '',
type: 'bar',
data: [301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 301.95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
barWidth: '23px',
itemStyle: {
barBorderRadius: [4, 4, 0, 0],
color: new echarts.graphic.LinearGradient(
0, 1, 0, 0, [{
offset: 0,
color: '#1083b5'
},
{
offset: 1,
color: '#12ceb3'
}
]
)
},
},
{
name: '用水量',
type: 'line',
symbol: 'none',
smooth: true,
data: [224.75, 232.58, 229.75, 236.08, 228.5, 224.08, 213.5, 219.75, 219.92, 223.83, 232.83, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
yAxisIndex: 1,
itemStyle: {
color: '#35b7f6'
}
}
]
};