"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 _vmWrapper = _interopRequireDefault(require("../../../vm-wrapper"));
var _useSettings2 = _interopRequireDefault(require("../../../vm-hooks/useSettings"));
var _vmNodata = _interopRequireDefault(require("../../../vm-nodata"));
var _api = require("../../api");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 计量信息-图表-进场车次时间分布
 */

var ChartJccc = function ChartJccc(_ref) {
  var code = _ref.code,
    startDate = _ref.startDate,
    endDate = _ref.endDate;
  var _a, _b, _c;
  var _useSettings = (0, _useSettings2["default"])(),
    chartFontColor = _useSettings.chartFontColor,
    theme = _useSettings.theme;
  var _BaseService$useJcccs = _api.BaseService.useJcccsjfb(code, startDate, endDate),
    jcccsjfbRes = _BaseService$useJcccs.jcccsjfbRes;
  var option = {
    tooltip: {
      trigger: 'axis',
      formatter: '{b0}: 进场{c0}次'
    },
    grid: {
      left: '8%',
      right: '10%',
      bottom: 20,
      top: 48
    },
    legend: {
      show: false
    },
    xAxis: [{
      type: 'category',
      name: '时间段',
      data: (jcccsjfbRes === null || jcccsjfbRes === void 0 ? void 0 : jcccsjfbRes.names) || [],
      axisPointer: {
        type: 'shadow'
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      }
    }],
    yAxis: [{
      type: 'value',
      name: '(次)',
      min: 0,
      nameTextStyle: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      splitNumber: 5,
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(151,151,151,0.28)'
        }
      }
    }],
    series: [{
      type: 'bar',
      barWidth: 14,
      data: (jcccsjfbRes === null || jcccsjfbRes === void 0 ? void 0 : jcccsjfbRes.values) ? jcccsjfbRes.values[0] : [],
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
          offset: 1,
          color: '#1B89FF'
        }, {
          offset: 0,
          color: '#51d0ff6e'
        }])
      }
    }]
  };
  var dates = ((_a = jcccsjfbRes === null || jcccsjfbRes === void 0 ? void 0 : jcccsjfbRes.extraData) === null || _a === void 0 ? void 0 : _a.length) > 0 ? jcccsjfbRes.extraData.map(function (ele) {
    return ele.date;
  }) : [];
  var count = ((_b = jcccsjfbRes === null || jcccsjfbRes === void 0 ? void 0 : jcccsjfbRes.extraData) === null || _b === void 0 ? void 0 : _b.length) > 0 ? jcccsjfbRes.extraData.map(function (ele) {
    return ele.count;
  }) : [];
  return /*#__PURE__*/_react["default"].createElement(_vmWrapper["default"], {
    title: "\u8FDB\u573A\u8F66\u6B21\u65F6\u95F4\u5206\u5E03",
    needChange: false
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "metering-content-charts-jccc-desc"
  }, "\u8FDB\u573A\u9AD8\u5CF0\u96C6\u4E2D\u5728", (dates === null || dates === void 0 ? void 0 : dates.join('点、')) || 0, "\u70B9\uFF0C\u8FDB\u573A\u8F66\u6B21\u5206\u522B\u4E3A", (count === null || count === void 0 ? void 0 : count.join('次、')) || '-', "\u6B21\uFF0C\u6CE8\u610F\u5408\u7406\u8C03\u5EA6\uFF0C \u7F13\u89E3\u5382\u533A\u6392\u961F\u60C5\u51B5\u3002"), ((_c = jcccsjfbRes.values) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (/*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    notMerge: true,
    lazyUpdate: true,
    style: {
      height: '315px',
      width: '100%'
    }
  })) : (/*#__PURE__*/_react["default"].createElement(_vmNodata["default"], {
    style: {
      height: '315px',
      width: '100%'
    }
  })));
};
var _default = exports["default"] = ChartJccc;
//# sourceMappingURL=ChartJccc.js.map
