option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
interval: 1,
splitLine:{show: false},
axisTick: {
show: false,
},
axisLine: {
show: false,
},
axisLabel:{
formatter: function (value, index){
if([0,1,4, 5, 7, 8, 14].includes(index)){
return value
}
return ''
}
}
},
series: [
{
data: [2, 7, 4, 10, 13, 6],
type: 'line',
markArea:{
data: [[{
yAxis: '0',
itemStyle: {
color: '#fff',
},
},{
yAxis: '0'
}],[{ yAxis: '1', itemStyle: { color: 'green' }, },{ yAxis: '4' }],[{ yAxis: '5', itemStyle: { color: 'yellow' }, },{ yAxis: '7' }],[{ yAxis: '8', itemStyle: { color: 'red' }, },{ yAxis: 14 }]],
},
},
]
};