Echarts - lengend图例自定义

 legend: {
          data: this.data,
          orient: 'vertical',
          x: 'left',
          y: 'center',
          icon: 'circle', //图例图标修改
          formatter: function(params) {
            for (let i = 0; i < option.series[0].data.length; i++) {
              if (option.series[0].data[i].name === params) {
                // return params + ':' + option.series[0].data[i].value
                let target = option.series[0].data[i].value
                let arr = ['{a}' + params + '}', '{b}' + target + '}']
                return arr.join('\n')
              }
            }
          },
          textStyle: {
            rich: {
              a: {
                fontSize: 16,
                padding: 10
              },
              b: {
                fontSize: 16,
                color: '#333'
              }
            }
          }
        },

 

你可能感兴趣的:(Echarts - lengend图例自定义)