echarts-pie

<template>
  <div id="QualityRating">

  </div>
</template>

<script>
import echarts from 'echarts'
  export default {
    data() {
      return {
        COLORS:['#5B8FF9','#5AD8A6','#F7C739','#44D3E1','#E8684A','#A953F3']
      }
    },
    mounted () {
      let list = [
        {
          itemStyle:{color:'#5B8FF9'},
          value:0,
          name:'信用极差0-649分'
        },
        {
          itemStyle:{color:'#5AD8A6'},
          value:500,
          name:'信用较差650-849分'
        },
        {
          itemStyle:{color:'#F7C739'},
          value:600,
          name:'信用中等850-1049分'
        },
        {
          itemStyle:{color:'#44D3E1'},
          value:800,
          name:'信用良好1050-1249分'
        },
        {
          itemStyle:{color:'#E8684A'},
          value:900,
          name:'信用优秀1250-1449分'
        },
        {
          itemStyle:{color:'#A953F3'},
          value:1000,
          name:'信用极好1450-2000分'
        }
      ]
      this.getCredit(list)
    },
    methods: {
      getCredit(data){
        let mydpc = echarts.init(document.getElementById('QualityRating'))
        mydpc.setOption({
          grid: {
            show: false,
            top: '20%',
            left: '3%',
            right: '3%',
            bottom: '3%',
            containLabel: true
          },
          tooltip: {
            trigger: 'item',
            formatter: '{b} : {c}元'
          },
          legend: {
            selectedMode: false,
            orient: 'vertical',
            top: 'middle',
            right: '0%',
            height: 'auto',
            itemWidth: 10,
            itemHeight: 10,
            textStyle: {
              fontSize: 12,
              color: '#BABABA'
            },
            data: data.map(v=>v.name)
          },
          series: [
            {
              name: "信用等级",
              type: "pie",
              radius: "90%",
              center: ["30%", "50%"],
              label: {
                normal: {
                  formatter: "{c}",
                  position: "inner",
                  show: true,
                  color: "#fff",
                },
              },

              data: data,
              roseType: "radius",
              animationType: "scale",
              animationEasing: "elasticOut",
              animationDelay: function () {
                return Math.random() * 200;
              },
            },
          ],
          // series: [
          //   {
          //     name: '',
          //     type: 'pie',
          //     radius: ['50%', '75%'],
          //     center: ["30%", "50%"],
          //     hoverAnimation: false,
          //     label: {
          //       show:false,
          //       position: 'outside',
          //       color: 'red',
          //       borderColor: '#333',
          //       formatter: '{b}  \n {c}',
          //     },
          //     data: data,
          //     emphasis: {
          //       itemStyle: {
          //         shadowBlur: 10,
          //         shadowOffsetX: 0,
          //         shadowColor: 'rgba(0, 0, 0, 0.5)'
          //       }
          //     }
          //   }
          // ]
        })
      },
    },
    
  }
</script>

<style lang="stylus" scoped>
#QualityRating{
  width: 100%;
  height: 100%;
}
</style>```

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值