Echarts 饼状图 民族

echarts yekong 175℃

wanjunshijiecom 2021-08-29 at 15.01.05@2x

    drawLine () {
      window.addEventListener('resize', this.drawLine)
      let myChart = this.$echarts.init(this.$refs.echarts)
      var option = {
        color: ['#37CAFB', '#4DAFF9', '#4ADECB', '#2A9DDF', '#036EEC', '#488CF7'],
        title: {
          text: '民 族',
          left: '48%',
          top: 'center',
          textAlign: 'center',
          textStyle: {
            color: '#fff',
            fontSize: 16,
            fontWeight: 'bold'
          }
        },
        grid: {
          left: 0,
          top: 0,
          bottom: 0,
          right: 0,
          containLabel: true
        },
        tooltip: {
          trigger: 'item',
          formatter: '{b} : {c} ({d}%)'
        },
        series: [ {
          stack: 'a',
          type: 'pie',
          radius: ['40%', '80%'],
          roseType: 'area',
          zlevel: 10,
          label: {
            normal: {
              show: true,
              formatter: '{b} {d}%',
              textStyle: {
                fontSize: 12,
              },
              position: 'outside'
            },
            emphasis: {
              show: true
            }
          },
          labelLine: {
            normal: {
              show: true,
              length: 10,
              length2: 15
            },
            emphasis: {
              show: false
            }
          },
          data: [{
            value: 10,
            name: '蒙古族'
          },
            {
              value: 5,
              name: '汉族'
            },
            {
              value: 15,
              name: '傣族'
            },
            {
              value: 25,
              name: '维吾尔族'
            },
            {
              value: 20,
              name: '苗族'
            },
            {
              value: 35,
              name: '土家族'
            }
          ]
        },]
      }
      myChart.clear()
      myChart.resize()
      myChart.setOption(option)
    },
喜欢 (0)