饼状图echarts使用

1. 效果图

2. 在官方找类似的图

3. 配置项

 

var option = {
  title: {
      text: '购买终端',
      // 标题字体样式
      textStyle: {
          color: '#9AA8D4',
          fontSize: 22,
          fontWeight: 'normal'
      }
  },
  // hover扇面时候显示的内容 b是data的name  c是data的value
  tooltip: {
      trigger: 'item',
      formatter: '{b}数量 : {c}个;占比 ({d}%)'
  },
  // legend: {
  //     left: 'center',
  //     top: 'bottom',
  //     data: ['ios', 'PC Web', 'Android', 'Wap Web']
  // },
  // toolbox: {
  //     show: true,
  //     feature: {
  //         mark: { show: true },
  //         dataView: { show: true, readOnly: false },
  //         magicType: {
  //             show: true,
  //             type: ['pie', 'funnel']
  //         },
  //         restore: { show: true },
  //         saveAsImage: { show: true }
  //     }
  // },
  series: [
      {
          name: '面积模式',
          type: 'pie',
          // 最外圈和最内圈的比例大小
          radius: ['25%', '50%'],

          roseType: 'area',
          data: [
              {
                  value: 25,
                  name: 'Android',
                  label: {
                      normal: {
                          textStyle: {
                              // 字体颜色渐变  扇颜色保持一致
                              color: '#4B4CDC',
                              fontSize: 12
                          }
                      }
                  },
                  itemStyle: {
                      normal: {
                          // 渐变柱状图
                          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                              { offset: 0, color: '#6D48DC' }, // 柱图渐变色
                              { offset: 0.5, color: '#6D48DC' }, // 柱图渐变色
                              { offset: 1, color: '#4B4CDC' } // 柱图渐变色
                          ])
                      }
                  }
              },
              {
                  value: 20,
                  name: 'ios',
                  label: {
                      normal: {
                          // 字体颜色
                          textStyle: {
                              color: '#248DFF',
                              fontSize: 12
                          }
                      }
                  },
                  itemStyle: {
                      normal: {
                          // 渐变柱状图
                          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                              { offset: 0, color: '#24C9FF' }, // 柱图渐变色
                              { offset: 0.5, color: '#24ABFF' }, // 柱图渐变色
                              { offset: 1, color: '#248DFF' } // 柱图渐变色
                          ])
                      }
                  }
              },
              {
                  value: 15,
                  name: 'PC Web',
                  label: {
                      normal: {
                          textStyle: {
                              color: '#BD00FF',
                              fontSize: 12
                          }
                      }
                  },
                  itemStyle: {
                      normal: {
                          // 渐变柱状图
                          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                              { offset: 0, color: '#D200FF' }, // 柱图渐变色
                              { offset: 0.5, color: '#BD00FF' }, // 柱图渐变色
                              { offset: 1, color: '#BD00FF' } // 柱图渐变色
                          ])
                      }
                  }
              },

              {
                  value: 5,
                  name: 'Wap Web',
                  label: {
                      normal: {
                          textStyle: {
                              color: '#70218F',
                              fontSize: 12
                          }
                      }
                  },
                  itemStyle: {
                      normal: {
                          // 渐变柱状图
                          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                              { offset: 0, color: '#8A1D89' }, // 柱图渐变色
                              { offset: 0.5, color: '#7C1D8C' }, // 柱图渐变色
                              { offset: 1, color: '#70218F' } // 柱图渐变色
                          ])
                      }
                  }
              }
          ]
      }
  ]
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值