const getPieChart = (data) => {
  let option = {
    color: ['#69B1FF','#FFC069','#87E8DE','#597EF7','#D6E4FF','#FF7875','#B37FEB','#FFA39E'],
    series: [
      {
      type: 'pie',
      radius: [80, 100],
      height: '100%',
      left: 'center',
      width: '95%',
      itemStyle: {
        borderColor: '#fff',
        borderWidth: 1
      },
      label: {
        alignTo: 'edge',
        formatter: '{name|{b}}   {num|{c} 项   {d}%}\n',
        minMargin: 5,
        edgeDistance: 10,
        // lineHeight: 15,
        rich: {
          name: {
            fontSize: 16,
            fontWeight: 700,
            fontFamily: 'Microsoft YaHei',
            color: 'rgba(59, 65, 75, 1)',
            // lineHeight: 24,
            // height: 24
          },
          num: {
            fontSize: 14,
            color: 'rgba(95, 101, 108, 1)',
            fontWeight: 400
          }
        }
      },
      labelLine: {
        length: 15,
        length2: 0,
        maxSurfaceAngle: 80
      },
      labelLayout: function (params) {
        const isLeft = params.labelRect.x < 556 / 2;
        const points = params.labelLinePoints;
        points[2][0] = isLeft
          ? params.labelRect.x
          : params.labelRect.x + params.labelRect.width;
        return {
          labelLinePoints: points
        };
      },
      data: data
    }]
  }
  return option
}

export default getPieChart;