option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
markLine: {
itemStyle: {
normal: { lineStyle: { type: 'solid', color: '#000' }, label: { show: true, position: 'end' } },
},
data: [
{
name: '平均线',
// 支持 'average', 'min', 'max'
type: 'average'
},
{
name: 'Y 轴值为 100 的水平线',
yAxis: 100
}
]
},
}]
};
关于解决方法,代码里的注释有说明
效果展示