配置项如下
var data1=[33,33,33,33,33,33,33,33,25,25,25,27,27,22,27,27,27,28,24,23,24,24,24,24,34,
35,35,35,35,35,35,35,35,35,35,39,39,39,39,40,40,39,38,37,24,24,24,24,24,24,
24,23,22,21,20,19,18,17,16,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
8,27,28,29,28,28,27,27,26,26,25,25,24,24,23,23,21,21,20,20,19,18,17,16,10,
10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,21,21,21,22,22,22,23,23,24,25,26,
26,26,26,26,26,26,26,26,27,27,27,27,27,27,28,28,29,30,31,32,32,32,32,32,32,
33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
34,34,34,34,34,34,35,35,30,30,30,30,30,30,30,30,35,35,35,28,28,28,28,28,28,
28,28,28,28,28,28,28,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,
24,24,23,23,23,23,22,22,22,22,21,21,21,20, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,11,
11,11,11,11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9];
var data2=[27,27,27,27,27,27,27,27,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,
30,30,30,32,32,32,32,32,33,33,33,33,33,34,34,34,34,35,35,35,35,35,35,35,35,
32,31,30,29,28,27,26,25,24,23,22,21,20,20,19,19,15,14,13,13,12,11,10,9,7,
8,27,28,29,28,28,27,27,26,26,25,25,24,24,23,23,21,21,20,20,19,18,17,16,7,
10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,21,21,21,22,22,22,23,23,24,25,26,
26,26,26,26,26,26,26,26,27,27,27,27,27,27,28,28,29,30,31,32,32,32,32,32,32,
33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,
34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
34,34,34,34,34,34,35,35,30,30,30,30,30,30,30,30,35,35,35,28,28,28,28,28,28,
26,26,26,26,26,26,26,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,23,23,23,23,22,22,22,22,21,21,21,20, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,11,
11,11,11,11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9];
data3=[11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]
var forecasdata=[],originaldata=[];
originaldata=[]
for(var i=0;i<700;i++){
// xdata.push(i);
if(i<data1.length){
forecasdata.push([i,data1[i]]);
originaldata.push([i,data2[i]]);
}else if(i>=data1.length && i<430){
forecasdata.push([i,Math.random()*(10-8+1)+8]);
}else if(i==430){
forecasdata.push([i,5]);
}else if(i>430 && i<600){
forecasdata.push([i,Math.random()*(11-7+1)+7]);
}
else{
forecasdata.push([i,Math.random()*(13-6+1)+6]);
}
if(i>data1.length){
if(i<600)originaldata.push([i,8*(1+(i-data1.length)/500)]);
if(i>=600)originaldata.push([i,data3[i-600]]);
}
}
option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['预测值', '原始数据'],
top:100,
right:100
},
xAxis: {
type:'value',
name:'时间/d',
nameGap:30,
nameLocation:'center',
axisLabel:{
margin :20
},
splitLine:{
show:false
}
},
yAxis: {
type:'value',
name:'压力/MPa',
nameGap:30,
nameLocation:'center',
splitLine:{
show:false
}
},
series: [{
type: 'line',
name:'原始数据',
showSymbol: false,
itemStyle:{
color:'blue'
},
lineStyle:{
type:'dashed'
},
data:originaldata,
smooth: true
},{
type: 'line',
name:'预测值',
showSymbol: false,
itemStyle:{
color:'red'
},
lineStyle:{
type:'dashed'
},
data:forecasdata,
smooth: true
}]
};