export default function ({ seriesData }) {
  return {
    tooltip: {
      trigger: "item",
      backgroundColor: "rgba(0,0,0,0.8)",
      borderColor: "#00ffe7",
      textStyle: {
        color: "#fff",
        fontSize: 25,
      },
    },
    legend: {
      show: false, // 隐藏左侧标签列表
    },
    series: [
      {
        name: "Access From",
        type: "pie",
        radius: ["40%", "70%"],
        avoidLabelOverlap: false,
        itemStyle: {
          borderRadius: 10,
          borderColor: "#222",
          borderWidth: 4,
          // shadowBlur: 20,
          // shadowColor: "rgba(0,255,231,0.5)",
        },
        label: {
          position: "outside",
          show: true,
          fontSize: 20,
          color: "#fff",
          fontWeight: "bold",
          textShadowColor: "#00ffe7",
          textShadowBlur: 10,
          overflow: "break", // 支持换行
          width: 100, // 设置宽度以便换行生效，可根据实际调整
          formatter: function (params) {
            // 自动换行
            const maxLength = 8; // 每行最大字符数，可根据需要调整
            let name = params.name;
            let result = "";
            while (name.length > maxLength) {
              result += name.substring(0, maxLength) + "\n";
              name = name.substring(maxLength);
            }
            result += name;
            return result;
          },
        },
        labelLine: {
          length: 10,
          length2: 10,
          lineStyle: {
            color: "#00ffe7",
            width: 3,
          },
        },
        data: seriesData,
        emphasis: {
          itemStyle: {
            shadowBlur: 30,
            shadowOffsetX: 0,
            shadowColor: "rgba(0,255,231,0.8)",
          },
          label: {
            fontSize: 24,
            color: "#00ffe7",
            fontWeight: "bolder",
          },
        },
      },
    ],
  };
}
