"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var AlarmType = function AlarmType(props) {
  var data = props.data,
    total = props.total;
  var color = ['#627CFC', '#33C9F6', '#FD6232', '#FDCF34', '#1890FF'];
  var option = {
    color: color,
    backgroundColor: 'transparent',
    tooltip: {
      show: true,
      trigger: 'item'
    },
    title: {
      zlevel: 0,
      text: '总数',
      top: '30%',
      left: '26%',
      textAlign: 'center',
      textStyle: {
        color: '#D4D4D4',
        fontSize: 14
      },
      subtext: "".concat(total),
      subtextStyle: {
        color: '#fafafa',
        fontSize: 28
      }
    },
    legend: {
      orient: 'vertical',
      type: 'scroll',
      left: '50%',
      top: 'center',
      align: 'left',
      itemGap: 8,
      itemWidth: 10,
      itemHeight: 10,
      formatter: function formatter(name) {
        var value = data.find(function (item) {
          return item.name === name;
        });
        if (value) {
          return "\t\t".concat(name, "\t\t").concat(value.value, "\u6B21");
        } else {
          return '';
        }
      },
      textStyle: {
        color: '#fff'
      },
      pageIconColor: '#fff',
      pageIconInactiveColor: '#fff',
      pageTextStyle: {
        color: '#fff'
      }
    },
    series: [{
      type: 'pie',
      radius: ['70%', '90%'],
      center: ['28%', '50%'],
      hoverAnimation: true,
      z: 10,
      itemStyle: {
        normal: {
          borderWidth: 2,
          borderColor: '#003359'
        }
      },
      label: {
        show: false
      },
      data: data,
      labelLine: {
        show: false
      }
    }]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--right"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u672C\u6708\u62A5\u8B66\u7C7B\u578B\u5206\u6790"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--chart"
  }, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    notMerge: true,
    lazyUpdate: true,
    style: {
      height: '100%',
      width: '100%',
      zIndex: 9
    }
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "base-top--chart-bg"
  })));
};
var _default = AlarmType;
exports["default"] = _default;
//# sourceMappingURL=AlarmType.js.map
