echart 实现添加警戒线
代码:
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
},
series: [
{
name: '数据系列1',
type: 'line',
data: [120, 200, 150, 80, 70, 110, 130],
markLine: {
symbol: 'none',
data: [{
yAxis: 120,
lineStyle: {
color: 'red',
type: 'dashed',
width: 2
},
label: {
show: true,
position: 'end',
formatter: '警戒线'
}
}]
}
},
{
name: '数据系列2',
type: 'line',
data: [80, 90, 100, 120, 110, 100, 90]
}
]
};
效果:


浙公网安备 33010602011771号