"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var echarts = _interopRequireWildcard(require("echarts"));
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _vmSubTitle = _interopRequireDefault(require("../../../vm-sub-title"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 路段-统计信息-作业完成率
 */

function Zywcl(props) {
  var data = props.data;
  var _useSettings = (0, _useSettings2["default"])(),
    theme = _useSettings.theme,
    chartFontColor = _useSettings.chartFontColor;
  var xData = [],
    values = [];
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
    xData = data.map(function (ele) {
      return ele.workDate;
    });
    values = data.map(function (ele) {
      return ele.rate;
    });
  }
  var option = {
    color: ['#00FFE7'],
    tooltip: {
      trigger: 'axis',
      formatter: function formatter(params) {
        var _a;
        var str = "".concat((_a = params === null || params === void 0 ? void 0 : params[0]) === null || _a === void 0 ? void 0 : _a.axisValue);
        var color = params[0].color; // 获取系列的颜色
        params.map(function (item) {
          str += "<div ><span style=\"color:".concat(color, " \">\u2022</span> ").concat(item.seriesName, " &nbsp;&nbsp;&nbsp;").concat(item.data, "%</div>");
        });
        return str; // 返回带点的字符串
      }
    },
    legend: {
      show: false
    },
    grid: {
      left: '8%',
      right: '6%',
      bottom: 20
    },
    xAxis: {
      type: 'category',
      boundaryGap: true,
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      data: xData
    },
    yAxis: {
      type: 'value',
      name: '(%)',
      min: 0,
      nameTextStyle: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      splitNumber: 5,
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(151,151,151,0.28)'
        }
      }
    },
    series: [{
      name: '作业完成率',
      type: 'line',
      data: values,
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
          offset: 0,
          color: theme === 'dark' ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.35)'
        }, {
          offset: 1,
          color: '#00FFE7'
        }])
      }
    }]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "road-statistic-charts-zywcl"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u4F5C\u4E1A\u5B8C\u6210\u7387\u5206\u6790"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "road-statistic-charts-lcfx-contain"
  }, (data === null || data === void 0 ? void 0 : data.length) > 0 ? (/*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    notMerge: true,
    lazyUpdate: true,
    style: {
      height: '100%',
      width: '100%'
    }
  })) : (/*#__PURE__*/_react["default"].createElement(_vmNodata["default"], null))));
}
var _default = exports["default"] = Zywcl;
//# sourceMappingURL=Zywcl.js.map
