110,533
社区成员
设置自定义平均值方法:
添加一条新的折现,然后把线宽设置为0,添加markLine,即可按自己自定义的值,显示出平均值的效果
{
name: '平均值',
type: 'line',
data: new Array(data.length).fill(avg),//根据折线图X轴值长度填充自定义值avg
lineStyle: {
normal: {
width: 0,//线宽设置为0 !!!
},
},
symbolSize: 0,
markLine: {
silent: true,
data: [
{
type: 'average',
name: '平均里程',
},
],
precision: 0,
label: {
normal: {
position: 'middle',
color: 'rgba(248,211,81,.7)',
fontSize: 18,
formatter: '平均里程: \n {c}km',
},
},
lineStyle: {
normal: {
color: 'rgba(248,211,81,.7)',
},
},
},
},