echarts折线图的标准线
echarts折线图的标准线 用到的是series中markLine的属性。
直接上效果和代码 ,可复制粘贴
关键代码:
markLine: {//图表标线
data: [{
label: {
position: 'end', // 表现内容展示的位置
formatter: '交易完成量标准线', // 标线展示的内容
color: '#8C8C8C' // 展示内容颜色
},
yAxis: '300'
}],
完整代码:
option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: 'shadow'
},
},
xAxis: {
show: false,
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
show: false,
type: 'value'
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
markLine: {//图表标线
data: [{
label: {
position: 'end', // 表现内容展示的位置
formatter: '交易完成量标准线', // 标线展示的内容
color: '#8C8C8C' // 展示内容颜色
},
yAxis: '300'
}],//type: 'average', 平均值, min最小值, max 最大值, median中位数
},
}
]
};