// 若是图形出不来 把时间格式调整一下
const time = new Date('2010-01-01 00:00:00');
const data = [];
const data1 = [];
for (let i = 0; i < 12; ++i) {
data.push([time.getTime(), i * 10 + Math.random() * 100]);
data1.push([time.getTime(), i * 10 + Math.random() * 100]);
time.setMonth(time.getMonth() + 1);
}
option = {
title: {
text: 'Apache ECharts 4.x Default Time Axis Labels'
},
xAxis: {
type: 'time'
},
yAxis: {
type: 'value'
},
visualMap:[
{
show: false,
dimension: 0,
seriesIndex:0,
pieces: [
{ gte: 1264953600000, lte: 1270051200000, color: 'transparent' }
],
outOfRange: {
color: 'red'
}
},
{
show: false,
dimension: 0,
seriesIndex:1,
pieces: [
{ gte: 1275321600000, lte: 1280592000000, color: 'transparent' }
],
outOfRange: {
color: 'blue'
}
}
],
series: [{
type: 'line',
data: data
},
{
type: 'line',
data: data1
}
]
};