柱状图,颜色渐变,自定义label

描述:当前是关于Echarts图表中的 折线图 示例。
 
            const option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: { type: 'shadow' }
  },
  grid: {
    left: '0%',
    right: '4%',
    bottom: '5%',
    top: '10%',
    containLabel: true
  },
  xAxis: {
    type: 'category',
    axisLabel: {
      color: '#CEDDF2'
    },
    axisLine: {
      show: false
    },
    axisTick: {
      show: false
    },
    data: ['第一产业', '第二产业', '第三产业']
  },
  yAxis: {
    show: false
  },
  series: [{
    name: '产业贡献',
    type: 'bar',
    stack: '总数',
    barWidth: '60%',
    label: {
      show: true,
      position: 'outside'
    },
    data: [{
      value: 27.5,
      label: {
        show: true, // 开启显示
        position: 'outside',
        distance: 20,
        width: 176,
        height: 24,
        lineHeight: 22,
        formatter: '{c}%',
        backgroundColor: 'rgba(146,222,251,0.1)',
        textStyle: {
          color: '#000',
          fontSize: 14,
          fontWeight: 600
        }
      },
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: 'rgba(123, 211, 69, .5)' // 0% 处的颜色
            },
            {
              offset: 1,
              color: 'rgba(123, 211, 69, .1)' // 100% 处的颜色
            }
          ],
          global: false // 缺省为 false
        }
      }
    }, {
      value: 40,
      label: {
        show: true, // 开启显示
        position: 'outside',
        distance: 20,
        width: 176,
        height: 24,
        lineHeight: 22,
        formatter: '{c}%',
        backgroundColor: 'rgba(146,222,251,0.1)',
        textStyle: {
          color: '#000',
          fontSize: 14,
          fontWeight: 600
        }
      },
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: 'rgba(71, 236, 206, .5)' // 0% 处的颜色
            },
            {
              offset: 1,
              color: 'rgba(71, 236, 206, .1)' // 100% 处的颜色
            }
          ],
          global: false // 缺省为 false
        }
      }
    }, {
      value: 32.5,
      label: {
        show: true, // 开启显示
        position: 'outside',
        distance: 20,
        width: 176,
        height: 24,
        lineHeight: 22,
        formatter: '{c}%',
        backgroundColor: 'rgba(146,222,251,0.1)',
        textStyle: {
          color: '#000',
          fontSize: 14,
          fontWeight: 600
        }
      },
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: 'rgba(64, 186, 240, .5)' // 0% 处的颜色
            },
            {
              offset: 1,
              color: 'rgba(64, 186, 240, .1)' // 100% 处的颜色
            }
          ],
          global: false // 缺省为 false
        }
      }
    }]
  }, {
    name: 'xxxx',
    type: 'bar',
    stack: '总数',
    barWidth: '60%',
    tooltip: {
      show: false
    },
    label: {
      show: false
    },
    data: [{
      value: 1,
      itemStyle: {
        color: '#7BD345'
      }
    }, {
      value: 1,
      itemStyle: {
        color: '#49E1C5'
      }
    }, {
      value: 1,
      itemStyle: {
        color: '#00A7E7'
      }
    }]
  }]
}