图例垂直显示

描述:当前是关于Echarts图表中的 示例。
 
            let legendWidth = 30 
let itemWidth = 20
option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  legend: {
    show: true,
    itemWidth: itemWidth,
    data: ['图例一','图例二图例二','图例三'],
      formatter:params=>{
        // '/n' 换行
        return `\n{name|${params}}`
      },
    textStyle:{
      width: legendWidth,
      rich:{
        name:{
          padding:[20, 0, 0, -(legendWidth+ itemWidth + 10)],
          align: 'center' , // 垂直可调left
        }
      }
    }
  },
  series: [
    {
      name: '图例一',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
     {
      name: '图例二图例二',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    },
     {
      name: '图例三',
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};