官方文档
option = {xAxis: {type: 'category',data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']},yAxis: {type: 'value'},series: [{data: [150, 230, 224, 218, 135, 147, 260],type: 'line',}]
};
效果:
需要添加参数markLine
option = {xAxis: {type: 'category',data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']},yAxis: {type: 'value'},series: [{data: [150, 230, 224, 218, 135, 147, 260],type: 'line',markLine: {symbol: 'none',silent: true,lineStyle: { normal: { type: 'dashed' } },label: { position: 'start' },data: [{yAxis: 250,lineStyle: { width: 1.656, color: '#ff6367' },label: { show: false }},{yAxis: 150,lineStyle: { width: 1.656, color: '#46C67F' },label: { show: false }}]},}]
};
效果: