调整echarts中图与legend的距离

1、正常调整legend的位置,通过X改变横坐标位置,通过Y改变纵轴位置
x:‘’, //可设定图例在左、右、居中
y:‘’, //可设定图例在上、下、居中

legend: {
    
    
    y: 'bottom',
    data: ['阳性转阴性', '阴性转阳性', '阳性无症状转有症状', '未检测']
},

2、如果觉得legend离图太近了,可以通过改变两个地方,一个是改变legend自身位置,一个改变图的位置,直接去调整top/left/bottom/rifht的值,找到合适的位置,可以使用百分比,也可以直接使用数字

legend: {
    
      // top,bottom,left,right等
   y: 'bottom',
   data: ['阳性转阴性', '阴性转阳性', '阳性无症状转有症状', '未检测']
},
grid: {
    
      // top,bottom,left,right等
  left: '3%',
  right: '4%',
  bottom: 40,
  containLabel: true
},

猜你喜欢

转载自blog.csdn.net/weixin_44949068/article/details/128318151