关于echarts:echarts相关问题

34次阅读

共计 802 个字符,预计需要花费 3 分钟才能阅读完成。

1、legend 每个 label 长度不一样 须要对齐时,自定义每一项的款式

   this.legendData = [
            {data: [dataList[0].name],
              left: '20px',
              formatter: function (name) {return '{a|' +  name + '}'
              },
              textStyle: {
                color: '#78A0C2',
                backgroundColor: "transparent", 
                rich: {
                  a: {width:260}
                }
              },
              icon: 'rect', // 形态
              itemWidth: 6, // 宽
              itemHeight: 6 // 高
            },
            {data: [dataList[2].name],
              textStyle: {
                color: '#78A0C2',
                backgroundColor: "transparent", 
                width:240
              },
               left: '310px',
              icon: 'rect',
              itemWidth: 6,
              itemHeight: 6
            },
            {data: [dataList[1].name],
              left: '20px',
              top: '20px',
              textStyle: {color: '#78A0C2'},
              icon: 'rect',
              itemWidth: 6,
              itemHeight: 6
            },
            {data: [dataList[3].name],
              left: '310px',
              top: '20px',
              textStyle: {color: '#78A0C2'},
              icon: 'rect',
              itemWidth: 6,
              itemHeight: 6
            }
          ]

2、x 轴 lable 搁置不下旋转、强制显示不距离

  axisLabel: {
              // rotate: 25, // 旋转
              interval: 0, // 强制显示所有 label
              textStyle: {
                fontSize: 12,
                color: '#78A0C2'
              }
            },

正文完
 0