echarts隔柱换色

option = {
        tooltip: {},
        xAxis: {
          type: "category",
          data: this.echartsData.groupX,
        },
        yAxis: {
          minInterval: 1,
          type: "value",
        },
        series: [
          {
            Width: 40,
            barWidth: 40, //柱图宽度
            data: this.echartsData.groupY,
            type: "bar",
            itemStyle: {
              normal: {
                //隔柱换色,
                color: function (params) {
                  //首先定义一个数组
                  var colorList = ["#7666FF", "#00C1CC"];
                  if (params.dataIndex % 2 == 0) {
                    return colorList[0];
                  } else {
                    return colorList[1];
                  }
                },
                
              },
            },
          },
        ],
      };

上一篇:http接口上传下载文件(RestTemplate)


下一篇:react 常用方法整理