配置项如下
option = {
title: [{
text: '报警、处理次数分析统计'
}, {
text: "报警次数",
left: '18%',
bottom: '8%',
textStyle: {
color: '#ccc',
fontStyle: 'normal',
fontWeight: '400',
fontFamily: 'sans-serif',
fontSize: 16
}
},
{
text: "处理次数",
right: '18%',
bottom: '8%',
textStyle: {
color: '#ccc',
fontStyle: 'normal',
fontWeight: '400',
fontFamily: 'sans-serif',
fontSize: 16
}
}
],
legend: {
data: ['A', 'B', 'C', 'D']
},
toolbox: {
id: 1,
feature: {
mark: {
show: true
},
dataView: {
show: true,
readOnly: false
},
magicType: {
show: true,
type: ['line', 'bar', ],
option: {
line: {}
}
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
grid: [{
x: '7%',
y: '7%',
width: '38%',
height: '38%'
},
{
x2: '7%',
y: '7%',
width: '38%',
height: '38%'
},
{
x: '7%',
y2: '7%',
width: '38%',
height: '38%'
},
{
x2: '7%',
y2: '7%',
width: '38%',
height: '38%'
}
],
tooltip: {
formatter: 'Group {a}: ({c})'
},
xAxis: [{
type: 'category',
boundaryGap: false,
gridIndex: 0,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
{
type: 'category',
boundaryGap: false,
gridIndex: 1,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
{
type: 'category',
boundaryGap: false,
gridIndex: 2,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
{
type: 'category',
boundaryGap: false,
gridIndex: 3,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [{
gridIndex: 0,
type: 'value'
},
{
gridIndex: 1,
type: 'value'
},
{
gridIndex: 2,
type: 'value'
},
{
gridIndex: 3,
type: 'value'
}
],
series: [{
xAxisIndex: 0,
yAxisIndex: 0,
barMaxWidth: 20, //最大宽度
name: 'A',
type: 'line',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: 'B',
type: 'line',
barMaxWidth: 20, //最大宽度
data: [120, 132, 101, 134, 90, 230, 210],
xAxisIndex: 1,
yAxisIndex: 1
},
{
xAxisIndex: 2,
yAxisIndex: 2,
barMaxWidth: 20, //最大宽度
name: 'C',
type: 'line',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
xAxisIndex: 3,
yAxisIndex: 3,
barMaxWidth: 20, //最大宽度
name: 'D',
type: 'line',
data: [120, 132, 101, 134, 90, 230, 210]
}
]
};