"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"));
var _useSettings2 = _interopRequireDefault(require("../vm-hooks/useSettings"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
 * 月度趋势分析
 */

var RmMonthTrend = function RmMonthTrend(_ref) {
  var data = _ref.data;
  var legends = data.legends,
    names = data.names,
    values = data.values;
  var _useSettings = (0, _useSettings2["default"])(),
    chartColor = _useSettings.chartColor,
    chartFontColor = _useSettings.chartFontColor,
    theme = _useSettings.theme;
  var option = {
    color: chartColor,
    tooltip: {
      trigger: 'axis',
      formatter: '维保次数: {c0}次'
    },
    legend: {
      show: true,
      itemWith: 6,
      itemHeight: 6,
      textStyle: {
        color: theme === 'blue' ? '#fff' : chartFontColor,
        fontSize: 12
      },
      data: legends || []
    },
    grid: {
      top: 28,
      left: 4,
      bottom: 14,
      right: 4,
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      data: names || []
    },
    yAxis: [{
      name: '次数(次)',
      type: 'value',
      nameTextStyle: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        color: theme === 'blue' ? '#fff' : chartFontColor
      },
      axisLine: {
        show: true
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(151,151,151,0.28)'
        }
      }
    }],
    series: [{
      // name: '维保次数',
      type: 'line',
      yAxisIndex: 0,
      data: values[0] || []
    }]
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "rm-month-trend"
  }, /*#__PURE__*/_react["default"].createElement(_vmSubTitle["default"], {
    title: "\u6708\u5EA6\u8D8B\u52BF\u5206\u6790"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "rm-month-trend-chart"
  }, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option,
    notMerge: true,
    lazyUpdate: true,
    style: {
      height: '100%',
      width: '100%'
    }
  })));
};
var _default = exports["default"] = RmMonthTrend;
//# sourceMappingURL=RmMonthTrend.js.map
