<template>
  <div class="inerank-container">
    <div :style="{height:'110%',width:'100%'}" ref="myLineRank"></div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Array,
      default: []
    }
  },
  data() {
    return {};
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      let myChart = this.$echarts.init(this.$refs.myLineRank);
      let dataAlias=[]
      let data2=[]
      this.data.forEach(x=>{
        if(x.Num>0){
          dataAlias.push(x.Name)
          let t={}
          t.name=x.Name
          t.value=x.Num
          data2.push(t)
        }
      })
      let option = {
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        calculable: true,
        series: [
          {
            center: ["50%", "40%"],
            name: this.$t('objFill.tuanduilx'),
            type: "pie",
            radius: ["70%", "0%"],
            itemStyle: {
              normal: {
                label: {
                  show: false
                },
                labelLine: {
                  show: false
                },
                color: function(params) {
                  //自定义颜色
                  var colorList = [
                    "#FFB822",
                    "#34BFA3",
                    "#FD3995",
                    "#5D78FF",
                    "#8e44ad",
                    "#2c3e50",
                    "#16a085"
                  ];
                  return colorList[params.dataIndex];
                }
              }
            },
            data: data2
          }
        ]
      };

      myChart.setOption(option);
    }
  }
};
</script>
<style>
.inerank-container {
  height: 100%;
  width: 100%;
}
</style>
