"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
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"));
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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
 * 路段-统计信息-作业里程
 */

function Zylc(props) {
  var data = props.data;
  var planData = [],
    workMileage = [],
    xData = [];
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
    xData = data.map(function (ele) {
      return ele.workDate;
    });
    planData = data.map(function (ele) {
      return ele.planMileage;
    });
    workMileage = data.map(function (ele) {
      return ele.workMileage;
    });
  }
  var option = {
    tooltip: {
      trigger: 'axis'
    },
    grid: {
      left: '8%',
      right: '6%',
      bottom: 20
    },
    legend: {
      align: 'left',
      itemGap: 8,
      itemWidth: 10,
      itemHeight: 10,
      textStyle: {
        color: '#fff'
      },
      data: ['计划里程', '作业里程']
    },
    xAxis: [{
      type: 'category',
      data: xData,
      boundaryGap: true,
      axisPointer: {
        type: 'shadow'
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        color: '#fff'
      }
    }],
    yAxis: [{
      type: 'value',
      name: '(km)',
      min: 0,
      nameTextStyle: {
        color: '#fff'
      },
      splitNumber: 5,
      axisTick: {
        show: false
      },
      axisLabel: {
        color: '#fff'
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(151,151,151,0.28)'
        }
      }
    }],
    series: [{
      name: '计划里程',
      type: 'bar',
      barWidth: 10,
      data: planData,
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
          offset: 0,
          color: '#1B89FF'
        }, {
          offset: 1,
          color: '#51D0FF'
        }])
      }
    }, {
      name: '作业里程',
      type: 'bar',
      barWidth: 10,
      data: workMileage,
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
          offset: 0,
          color: '#00A983 '
        }, {
          offset: 1,
          color: '#44FFD1'
        }])
      }
    }]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "road-statistic-charts-lcfx"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u4F5C\u4E1A\u91CC\u7A0B\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 = Zylc;
exports["default"] = _default;
//# sourceMappingURL=Zylc.js.map
