使用series里面的markArea对象即可,而markArea里面的data数据四个二维数组对象
代码如下:
// 图表标域,常用于标记图表中某个范围的数据,例如标出某段时间投放了广告。
markArea: {
// 图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。
silent: true ,
// 显示标签,且标签位于区域内部
label: {
show: true,
position: 'inside'
},
// 二维数组对象,可以理解成为从开始到结束的范围
data: [
// 第一个范围
[{
name: '0130.108.473',
xAxis: currentDatetimeb+'00:02',
yAxis: 0.1,
itemStyle: {
color: '#a7f1df',
},
label:{
color:'white'
}
},
{
xAxis: currentDatetimeb+'11:55',
yAxis:0.9,
}],
// 第二个范围
[{
name: '0130.108.472',
xAxis: currentDatetimeb+'12:02',
yAxis: 0.1,
itemStyle: {
color: '#70f7d6',
},
label:{
color:'white'
}
},
{
xAxis: currentDatetimeb+'20:58',
yAxis: 0.9,
}],
// 第三个范围
[{
name: '0130.108.474',
xAxis: currentDatetimeb+'21:00',
yAxis: 0.1,
itemStyle: {
color: '#2bf1c0',
},
label:{
color:'white'
}
},
{
xAxis: currentDatetimeb+'24:00',
yAxis: 0.9,
}]
]
}
每天都要收获一点点!