"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var React = _interopRequireWildcard(require("react"));
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
require("./index.scss");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var RadarChart = function RadarChart(props) {
  var option = {
    // title: {
    //     text: props.title,
    //     left: 'center',

    // },
    // 图表的位置
    grid: {
      position: 'center'
    },
    tooltip: {
      show: props.show
    },
    // tooltip: {
    //     //雷达图的tooltip不会超出div，也可以设置position属性，position定位的tooltip 不会随着鼠标移动而位置变化，不友好
    //     confine: true,
    //     enterable: true, //鼠标是否可以移动到tooltip区域内
    // },
    radar: {
      splitNumber: props.splitNumber,
      // 雷达图圈数设置
      shape: props.shape,
      //图形 多边形
      indicator: props.radardata
    },
    series: [{
      type: 'radar',
      areaStyle: {
        normal: {
          color: props.areaStylecolor,
          opacity: 0.3
        }
      },
      //雷达覆盖区域
      symbol: props.showSymbol,
      //去掉折线上的小圆点
      lineStyle: {
        color: props.color //线条颜色
      },

      data: [{
        value: props.data,
        name: props.datatitle,
        itemStyle: {
          //雷达图每一个焦点的样式
          normal: {
            color: props.symbolColor //折点颜色
          }
        },

        lineStyle: {
          type: props.lineStyleType
        }
      }]
    }]
  };
  var objArr = props.objArr1 || [];
  var _useState = (0, React.useState)(false),
    flag = _useState[0],
    setFlag = _useState[1];
  // 鼠标移入
  var mouseenter = function mouseenter() {
    setFlag(true);
  };

  // 鼠标移出
  var mouseleave = function mouseleave() {
    setFlag(false);
  };
  return /*#__PURE__*/React.createElement("div", {
    style: {
      width: props.width
    }
  }, /*#__PURE__*/React.createElement("div", {
    className: "radar"
  }, /*#__PURE__*/React.createElement("div", {
    className: "radarTitle"
  }, props.titleTip, /*#__PURE__*/React.createElement("span", {
    onMouseEnter: mouseenter,
    onMouseLeave: mouseleave
  }, props.titleLevel)), flag ? /*#__PURE__*/React.createElement("ol", {
    className: "randarTip"
  }, objArr.map(function (item, idx) {
    return /*#__PURE__*/React.createElement("li", {
      key: idx
    }, /*#__PURE__*/React.createElement("span", null, item[props.titlename]), "  ", /*#__PURE__*/React.createElement("span", null, item[props.titlevalue]));
  })) : ''), /*#__PURE__*/React.createElement(_echartsForReact["default"], {
    option: option,
    theme: "clear",
    style: {
      height: props.height,
      width: props.width
    }
  }));
};
var _default = RadarChart;
exports["default"] = _default;