yx-kqzlntj-饼图

描述:当前是关于Echarts图表中的 饼图 示例。
 
            option = {
        tooltip: {
          confine: true,
          textStyle: {
            fontSize: 12 // 字体大小
          }
        },
        graphic: [//圆环中间内容
          {
            type: 'text',
            left: '35%',
            top: '43%',
            style: {
              text: '{name|天数}\n{total|' + 222 + '}',
              textAlign: 'center',
              fill: 'blue', //文字的颜色
              fontSize: 10,
              rich: {
                total: {
                  fontSize: 12,
                  padding: [5, 0],
                  fontWeight: 'bold'
                },
                name: {
                  fontSize: 14
                }
              }
            }
          }
        ],
        color: ['#00FF00', '#FFFF00', '#FF8800', '#FF0000', '#9A004B', '#88001E'],
        legend: {
          top: 20,
          right: 20,
          orient: 'vertical', //改变排列方式
          icon: 'circle', //改变legend小图标形状
          itemGap: 12, // 设置legend的间距
          itemWidth: 20, // 设置宽度
          itemHeight: 12, // 设置高度
          textStyle: {
            fontSize: 12,
            color: 'blue'
          },
          itemStyle: {
            borderColor: 'transparent'
          },
          tooltip: {
            show: true
          },
          data: [
            { 'name': '优' },
            { 'name': '良' },
            { 'name': '轻度污染' },
            { 'name': '中度污染' },
            { 'name': '重度污染' },
            { 'name': '严重污染' }
          ]
        },
        series: [
          {
            name: '',
            avoidLabelOverlap: true,//防止标签重叠
            type: 'pie',
            radius: ['50%', '65%'], //大小
            center: ['40%', '50%'], //位置
            hoverAnimation: true,
            labelLine: {
              show: true,
              lineStyle: {
                width: 2
              },
              normal: {
                length: 10, // 指示线长度
                length2: 10
              }
            },
            data: [
              {
                'value': 20,
                'name': '优',
                'percent': 0.2
              },
              {
                'value': 25,
                'name': '良',
                'percent': 0.25
              },
              {
                'value': 8,
                'name': '轻度污染',
                'percent': 0.08
              },
              {
                'value': 14,
                'name': '中度污染',
                'percent': 0.14
              },
              {
                'value': 13,
                'name': '重度污染',
                'percent': 0.13
              },
              {
                'value': 20,
                'name': '严重污染',
                'percent': 0.2
              }
            ],
            label: {
              show: true,
              formatter: function(item) { // 显示标签
                return item.value + '%'
              },
              textStyle: {
                fontSize: '12',
                fontWeight: 'normal',
                color: 'red'
              }
            },
            tooltip: {
              show: true
            }
          }
        ]
      }