Echarts 环形图颜色向四周渐变

echarts yekong

Echarts 环形图颜色向四周渐变

    drawLine() {
      var that = this
      window.addEventListener('resize', this.drawLine)
      let myChart = this.$echarts.init(this.$refs.echarts)
      var option = {
        legend: {
          selectedMode: false, // 取消图例上的点击事件
          type: 'plain',
          orient: 'vertical',
          left: '63%',
          top: 'center',
          align: 'left',
          itemGap: 15,
          itemWidth: 15, // 设置宽度
          itemHeight: 15, // 设置高度
          symbolKeepAspect: false,
          textStyle: {
            color: '#000',
            rich: {
              name: {
                verticalAlign: 'right',
                align: 'left',
                width: 90,
                fontSize: 14,
                color: '#D8DDE3',
              },
              value: {
                align: 'left',
                width: 50,
                fontSize: 14,
                padding: [5, 5, 5, -0],
                color: '#D8DDE3',
              }
            }
          },
        },
        series: [
          {
            type: 'pie',
            name: '饼状背景',
            radius: ['0%', '35%'],
            center: ['30%', '50%'],
            startAngle: 110,
            hoverAnimation: false,
            itemStyle: {
              normal: {
                color: new that.$echarts.graphic.RadialGradient(.5, .5, .8, [{
                  offset: 0,
                  color: 'rgba(255,255,255,0.05)'
                },
                  {
                    offset: 0.5,
                    color: 'rgba(255,255,255,0.2)'
                  },
                  {
                    offset: 1,
                    color: 'rgba(255,255,255,0.1)'
                  }
                ], false),
              }
            },
            tooltip: {
              show: false,
            },
            label: {
              show: false
            },
            data: [50]
          },
        ]
      }

      myChart.clear()
      myChart.resize()
      myChart.setOption(option)
    },
喜欢