option = {
axisPointer: {
link: {
xAxisIndex: "all",
},
},
title: {
text: "同比环比镜像显示"
},
tooltip: {
show: true,
trigger: "axis",
axisPointer: {
type: "line",
lineStyle: {
type: "dashed",
},
},
},
legend: {
show: true,
},
grid: [{
left: 30,
right: 20,
top: "60px",
containLabel: true,
bottom: '50%',
},
{
left: 30,
containLabel: true,
right: 20,
top: '51%',
},
],
xAxis: [{
gridIndex: 0,
type: "category",
boundaryGap: false,
axisLine: {
onZero: false,
},
axisLabel: {
formatter: (value, index) => {
let hour = new Date(value).getHours();
return (hour + "").padStart(2, 0) + "时";
},
},
data: [
"2020-10-03 01:00:00",
"2020-10-03 02:00:00",
"2020-10-03 03:00:00",
"2020-10-03 04:00:00",
"2020-10-03 05:00:00",
"2020-10-03 06:00:00",
"2020-10-03 07:00:00",
"2020-10-03 08:00:00",
"2020-10-03 09:00:00",
"2020-10-03 10:00:00",
"2020-10-03 11:00:00",
"2020-10-03 12:00:00",
"2020-10-03 13:00:00",
"2020-10-03 14:00:00",
"2020-10-03 15:00:00",
"2020-10-03 16:00:00",
"2020-10-03 17:00:00",
"2020-10-03 18:00:00",
"2020-10-03 19:00:00",
"2020-10-03 20:00:00",
"2020-10-03 21:00:00",
"2020-10-03 22:00:00",
"2020-10-03 23:00:00",
"2020-10-04 00:00:00",
],
},
{
gridIndex: 1,
type: "category",
position: 'top',
boundaryGap: false,
axisLine: {},
axisLabel: {
show: false,
formatter: (value, index) => {
let hour = new Date(value).getHours();
return (hour + "").padStart(2, 0) + "时";
},
},
data: [
"2019-10-03 01:00:00",
"2019-10-03 02:00:00",
"2019-10-03 03:00:00",
"2019-10-03 04:00:00",
"2019-10-03 05:00:00",
"2019-10-03 06:00:00",
"2019-10-03 07:00:00",
"2019-10-03 08:00:00",
"2019-10-03 09:00:00",
"2019-10-03 10:00:00",
"2019-10-03 11:00:00",
"2019-10-03 12:00:00",
"2019-10-03 13:00:00",
"2019-10-03 14:00:00",
"2019-10-03 15:00:00",
"2019-10-03 16:00:00",
"2019-10-03 17:00:00",
"2019-10-03 18:00:00",
"2019-10-03 19:00:00",
"2019-10-03 20:00:00",
"2019-10-03 21:00:00",
"2019-10-03 22:00:00",
"2019-10-03 23:00:00",
"2019-09-04 00:00:00",
],
},
],
yAxis: [{
gridIndex: 0,
scale: true,
splitLine: {
show: false,
},
},
{
gridIndex: 1,
scale: true,
inverse: true,
splitLine: {
show: false,
},
},
],
series: [{
name: "NO",
type: "line",
xAxisIndex: 0,
yAxisIndex: 0,
smooth: true,
data: [
2,
4,
4,
3,
2,
2,
5,
4,
5,
4,
3,
3,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
],
},
{
name: "NO2x",
type: "line",
xAxisIndex: 0,
yAxisIndex: 0,
smooth: true,
data: [
45,
75,
58,
41,
28,
33,
47,
32,
35,
29,
27,
28,
26,
23,
26,
28,
29,
39,
62,
67,
66,
67,
69,
78,
],
},
{
name: "NO",
type: "line",
xAxisIndex: 1,
yAxisIndex: 1,
smooth: true,
data: [
1.07,
1.23,
1.258,
1.23,
1.23,
1.216,
1.182,
1.037,
0.896,
0.949,
0.884,
0.83,
0.79,
0.76,
0.732,
0.72,
0.728,
0.767,
0.792,
0.918,
1.013,
1.118,
1.03,
1.033,
],
},
{
name: "NOx",
type: "line",
xAxisIndex: 1,
yAxisIndex: 1,
smooth: true,
data: [
49,
56,
59,
63,
64,
63,
66,
45,
40,
43,
38,
35,
33,
32,
29,
29,
32,
34,
37,
47,
60,
76,
62,
58,
],
},
],
}