0
点赞
收藏
分享

微信扫一扫

echart动态修改每个数据的label

独兜曲 2023-08-18 阅读 72

echart可以动态修改每个数据的label 代码如下:

data: type == '01' ? this.yList[0].data.map((item, index) => {
            console.log(item, '11111');
            this.yList[1].data.map((res, it) => {
              if (index === it) {
                if (Number(item) < Number(res)) {
                  judgeFlag = true;
                }
              }
              console.log(res);
            });
            console.log('zuihou');
            return {
              value: item,
              label: {
                show: true,
                position: judgeFlag ? 'bottom' : 'top',
                distance: 2,
                offset: judgeFlag ? [0, -8] : [0, 8],
                color: '#181716',
                fontSize: 30,
                // backgroundColor: '#fff',
                backgroundColor: { image: judgeFlag ? this.topArrow : this.bottomArrow },
                borderColor: 'rgba(0,0,0,0.31)',
                // shadowColor: 'rgba(0,0,0,0.31)',
                fontFamily: 'Bebas',
                // shadowBlur: 6,
                padding: judgeFlag ? [12, 8, 6, 8] : [4, 8, 10, 8],
                lineHeight: 40,
                borderRadius: 4,
                formatter: (params) => this.numberConvert(params.value)
              },
            };
            // eslint-disable-next-line no-loop-func
          }) : this.yList[1].data.map(item => {


举报

相关推荐

0 条评论