配置项如下
const allData = [5000, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 4600, 3900, 3900, 3600, 3600, 3600, 3600, 3400, 3400, 3400, 3400, 2800, 2800, 2800, 2800, 2600, 2600, 2600, 2600, 2500, 2500, 2500, 2500, 2500, 2500, 1800, 1800, 1700, 1700, 1500, 1500, 1400, 1400, 1400, 1400, 1100, 1100, 1000, 1000, 1000, 1000, 900, 900, 700, 700, 600, 600, 100, 500, 600, 1300, 1900, 2300, 2800, 3500, 4300, 5000, 5600, 6000, 6500, 6800, 7300, 8100, 8700, 9000, 9700, 10400, 11100, 11500, 12000, 12700, 12800, 13200, 13600, 14300, 15000, 15400, 15800, 16000, 16000, 16000, 15800, 15800, 15500, 15500, 15500, 15500, 15400, 15400]
const xAxisData = ["2019/11/4 8:00:00", "2019/11/4 9:00:00", "2019/11/4 10:00:00", "2019/11/4 11:00:00", "2019/11/4 12:00:00", "2019/11/4 13:00:00", "2019/11/4 14:00:00", "2019/11/4 15:00:00", "2019/11/4 16:00:00", "2019/11/4 17:00:00", "2019/11/4 18:00:00", "2019/11/4 19:00:00", "2019/11/4 20:00:00", "2019/11/4 21:00:00", "2019/11/4 22:00:00", "2019/11/4 23:00:00", "2019/11/5", "2019/11/5 1:00:00", "2019/11/5 2:00:00", "2019/11/5 3:00:00", "2019/11/5 4:00:00", "2019/11/5 5:00:00", "2019/11/5 6:00:00", "2019/11/5 7:00:00", "2019/11/5 8:00:00", "2019/11/5 9:00:00", "2019/11/5 10:00:00", "2019/11/5 11:00:00", "2019/11/5 12:00:00", "2019/11/5 13:00:00", "2019/11/5 14:00:00", "2019/11/5 15:00:00", "2019/11/5 16:00:00", "2019/11/5 17:00:00", "2019/11/5 18:00:00", "2019/11/5 19:00:00", "2019/11/5 20:00:00", "2019/11/5 21:00:00", "2019/11/5 22:00:00", "2019/11/5 23:00:00", "2019/11/6", "2019/11/6 1:00:00", "2019/11/6 2:00:00", "2019/11/6 3:00:00", "2019/11/6 4:00:00", "2019/11/6 5:00:00", "2019/11/6 6:00:00", "2019/11/6 7:00:00", "2019/11/6 8:00:00", "2019/11/6 9:00:00", "2019/11/6 10:00:00", "2019/11/6 11:00:00", "2019/11/6 12:00:00", "2019/11/6 13:00:00", "2019/11/6 14:00:00", "2019/11/6 15:00:00", "2019/11/6 16:00:00", "2019/11/6 17:00:00", "2019/11/6 18:00:00", "2019/11/6 19:00:00", "2019/11/6 20:00:00", "2019/11/6 21:00:00", "2019/11/6 22:00:00", "2019/11/6 23:00:00", "2019/11/7", "2019/11/7 1:00:00", "2019/11/7 2:00:00", "2019/11/7 3:00:00", "2019/11/7 4:00:00", "2019/11/7 5:00:00", "2019/11/7 6:00:00", "2019/11/7 7:00:00", "2019/11/7 8:00:00", "2019/11/7 9:00:00", "2019/11/7 10:00:00", "2019/11/7 11:00:00", "2019/11/7 12:00:00", "2019/11/7 13:00:00", "2019/11/7 14:00:00", "2019/11/7 15:00:00", "2019/11/7 16:00:00", "2019/11/7 17:00:00", "2019/11/7 18:00:00", "2019/11/7 19:00:00", "2019/11/7 20:00:00", "2019/11/7 21:00:00", "2019/11/7 22:00:00", "2019/11/7 23:00:00", "2019/11/8", "2019/11/8 1:00:00", "2019/11/8 2:00:00", "2019/11/8 3:00:00", "2019/11/8 4:00:00", "2019/11/8 5:00:00", "2019/11/8 6:00:00", "2019/11/8 7:00:00", "2019/11/8 8:00:00", "2019/11/8 9:00:00", "2019/11/8 10:00:00", "2019/11/8 11:00:00", "2019/11/8 12:00:00", "2019/11/8 13:00:00", "2019/11/8 14:00:00", "2019/11/8 15:00:00", "2019/11/8 16:00:00", "2019/11/8 17:00:00", "2019/11/8 18:00:00", "2019/11/8 19:00:00", "2019/11/8 20:00:00", "2019/11/8 21:00:00", "2019/11/8 22:00:00", "2019/11/8 23:00:00", "2019/11/9", "2019/11/9 1:00:00", "2019/11/9 2:00:00", "2019/11/9 3:00:00", "2019/11/9 4:00:00", "2019/11/9 5:00:00", "2019/11/9 6:00:00", "2019/11/9 7:00:00", "2019/11/9 8:00:00", "2019/11/9 9:00:00", "2019/11/9 10:00:00", "2019/11/9 11:00:00", "2019/11/9 12:00:00", "2019/11/9 13:00:00", "2019/11/9 14:00:00", "2019/11/9 15:00:00", "2019/11/9 16:00:00", "2019/11/9 17:00:00", "2019/11/9 18:00:00", "2019/11/9 19:00:00", "2019/11/9 20:00:00", "2019/11/9 21:00:00", "2019/11/9 22:00:00", "2019/11/9 23:00:00", "2019/11/10"]
console.log(xAxisData)
const data1 = allData.slice(0, 100).map(function(d, i){
return [xAxisData[i], d]
})
const data2 = allData.slice(99, allData.length).map(function(d, i){
return [xAxisData[i+99], d]
})
option = {
"backgroundColor": "#fff",
"tooltip": {
"trigger": "axis"
},
"legend": {
"data": ["后梁上片的一周库存波动"],
"top": "10%"
},
"toolbox": {
"show": false,
"feature": {
"dataZoom": {}
}
},
"grid": {
"top": "30%",
"left": "0%",
"right": "0%",
"bottom": "9%"
},
"xAxis": {
"show": false,
"type": "category",
"boundaryGap": false,
"axisLabel": {
"color": "rgba(0,0,0,0.8)",
"fontSize": 30
},
// "data":
},
"yAxis": {
"show": false,
"type": "value",
"axisLabel": {
"formatter": "{value} °C",
"color": "rgba(0,0,0,0.8)",
"fontSize": 30
}
},
"series": [{
"name": "后梁上片的一周库存波动",
"type": "line",
"color": "#0b8fb066",
"areaStyle": {},
"data": data1,
}, {
"name": "后梁上片的一周库存波动",
"type": "line",
"color": "#0b8fb066",
"areaStyle": {
color: "red"
},
"data": data2,
}, {
"type": "line",
"markLine": {
"data": [{
"lineStyle": {
"color": "red"
},
"label": {
"position": "middle"
},
"name": "min",
"yAxis": 1000
}, {
"lineStyle": {
"color": "green"
},
"label": {
"position": "middle"
},
"name": "max",
"yAxis": 10000
}]
}
}]
}