

const getRadarChart = (data) => {
  // const indicators = [
  //   { name: "集成电路", max: 10 },
  //   { name: "能源领域", max: 10 },
  //   { name: "量子科技", max: 10 },
  //   { name: "通信网络", max: 10 },
  //   { name: "人工智能", max: 10 },
  //   { name: "生物科技", max: 10 }
  // ];
  const indicators = data.title.map(item => {
    return {
      name: item, max: data.maxNum
    }
  })
  const data337 = [9, 6, 6, 6, 9, 7];
  const data301 = [5, 3, 7, 8, 7, 9];
  const data232 = [4, 10, 3, 4, 2, 5];
  const option = {
    color: ["rgba(5, 95, 194, 1)", "rgba(250, 140, 22, 1)", "rgba(146, 84, 222, 1)"],
    legend: {
      top: 8,
      left: 30,
      icon: "circle",
      itemWidth: 12,
      itemHeight: 12,
      itemGap: 24,
      textStyle: {
        color: "rgb(95, 101, 108)",
        fontSize: 16,
        fontFamily: "Microsoft YaHei",
        fontWeight: 400,
        lineHeight: 24
      },
      data: ["337调查", "301调查", "232调查"]
    },
    radar: {
      shape: "polygon",
      splitNumber: 5,
      indicator: indicators,
      center: ["50%", "56%"],
      radius: "58%",
      startAngle: 90,
      clockwise: false,
      axisName: {
        color: "rgba(59, 65, 75, 1)",
        fontSize: 16,
        fontFamily: "Microsoft YaHei",
        fontWeight: 700,
        lineHeight: 24,
        padding: [0, 5]
      },
      splitLine: {
        lineStyle: {
          color: "#d0d0d0",
          width: 1
        }
      },
      axisLine: {
        lineStyle: {
          color: "#d0d0d0",
          width: 1
        }
      },
      splitArea: {
        show: true,
        areaStyle: {
          color: ["#fff", "rgb(247, 248, 249)", "#fff", "rgb(247, 248, 249)", "#fff"]
        }
      }
    },
    series: [
      {
        // name: "337调查",
        name: data.data[0].name,
        type: "radar",
        data: [{ value: data.data[0].value }],
        lineStyle: {
          width: 2,
          color: "rgba(5, 95, 194,1)"
        },
        symbol: "none",
        areaStyle: {
          color: "rgba(5, 95, 194,0.15)"
        }
      },
      {
        name: data.data[1].name,
        type: "radar",
        data: [{ value: data.data[1].value }],
        lineStyle: {
          width: 2,
          color: "rgba(250, 140, 22, 1)"
        },
        symbol: "none",
        areaStyle: {
          color: "rgba(250, 140, 22, 0.15)"
        }
      },
      {
        name: data.data[2].name,
        type: "radar",
        data: [{ value: data.data[2].value }],
        lineStyle: {
          width: 2,
          color: "rgba(146, 84, 222, 1)"
        },
        symbol: "none",
        areaStyle: {
          color: "rgba(146, 84, 222, 0.15)"
        }
      },
    ]
  };

  return option
}

export default getRadarChart