const getPieChart = (data) => {
  let option = {
    series: [
      {
        type: 'pie',
        radius: [70, 100],
        height: '100%',
        left: 'center',
        width: '100%',
        itemStyle: {
          borderColor: '#fff',
          borderWidth: 1
        },
        label: {
          alignTo: 'edge',
    formatter: params => {
  const name = params.name || "";
  const value = params.value ?? "";
  const percent = params.percent != null ? Math.round(params.percent) : 0; 

  return `{name|${name}}\n{time|${value} 项 ${percent}%}`;
},
          minMargin: 10,
          edgeDistance: 20,
          lineHeight: 20,
          rich: {
           

            name: {
              fontSize: 16,
              color: 'rgba(59, 65, 75, 1)',
              fontFamily: 'Source Han Sans CN',
              fontWeight: 700,
              lineHeight:24,
            },
            time: {
              fontSize: 14,
              color: 'rgba(95, 101, 108, 1)',
              fontFamily: 'Source Han Sans CN',
           
            }
          }
        },
        labelLine: {
          length: 15,
          length2: 0,
          maxSurfaceAngle: 80
        },
        labelLayout: function (params) {
          const isLeft = params.labelRect.x < 556 / 2;
          const points = params.labelLinePoints;
          // Update the end point.
          points[2][0] = isLeft
            ? params.labelRect.x
            : params.labelRect.x + params.labelRect.width;
          return {
            labelLinePoints: points
          };
        },
        data: data
      }]
  }
  return option
}

export default getPieChart;