"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var getOption = function getOption(_ref) {
  var _ref$xAxis = _ref.xAxis,
    xAxis = _ref$xAxis === void 0 ? [] : _ref$xAxis,
    _ref$data = _ref.data,
    data = _ref$data === void 0 ? [] : _ref$data;
  return {
    color: ['#0E85FF', '#49FF81', '#26D4FF', '#F5D629', '#C97CFF'],
    tooltip: {
      trigger: 'axis',
      formatter: function formatter(params) {
        var _a, _b;
        //tongjia
        var unit = '次';
        var str = '';
        if (Array.isArray(params)) {
          str = "<div  style=\"text-align:left\">".concat((_a = params === null || params === void 0 ? void 0 : params[0]) === null || _a === void 0 ? void 0 : _a.axisValue, "<?div>");
          var color = (_b = params === null || params === void 0 ? void 0 : params[0].color) === null || _b === void 0 ? void 0 : _b.colorStops; // 获取系列的颜色
          params.map(function (item, index) {
            var _a;
            str += "<div  style=\"text-align:left\"><span style=\"color:".concat(item.color && typeof item.color == 'string' ? item.color : (_a = color === null || color === void 0 ? void 0 : color[index]) === null || _a === void 0 ? void 0 : _a.color, "\">\u2022</span> ").concat(item.seriesName, " &nbsp;&nbsp;&nbsp;").concat(item.value).concat(unit, "</div>");
          });
        } else {
          var _color = params === null || params === void 0 ? void 0 : params.color; // 获取系列的颜色
          str += "<div style=\"display:flex;align-items:center\"><span style=\"color:".concat(_color, ";font-size:24px \">\u2022</span>&nbsp;").concat(params === null || params === void 0 ? void 0 : params.name, "&nbsp;&nbsp;").concat(params.value).concat(unit, "</div>");
        }
        return str; // 返回带点的字符串
      }
    },
    legend: {
      type: 'scroll',
      top: 0,
      left: 'center',
      textStyle: {
        color: '#fff'
      }
    },
    grid: {
      top: 50,
      left: 20,
      right: 0,
      bottom: 0,
      containLabel: true
    },
    xAxis: {
      data: xAxis,
      axisLabel: {
        color: '#DAF1FF',
        interval: 0
      },
      axisTick: {
        show: false
      },
      axisLine: {
        show: false
      },
      z: 10
    },
    yAxis: {
      name: '单位：次',
      nameTextStyle: {
        color: '#fff'
      },
      axisLine: {
        show: false
      },
      axisTick: {
        show: false
      },
      axisLabel: {
        color: '#fff'
      },
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(255,255,255,0.2)'
        }
      }
    },
    series: data.map(function (item) {
      return {
        name: item.name,
        type: 'line',
        smooth: true,
        data: item.data
      };
    })
  };
};
var Line1 = function Line1(_ref2) {
  var xAxis = _ref2.xAxis,
    data = _ref2.data,
    style = _ref2.style;
  return /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: getOption({
      xAxis: xAxis,
      data: data
    }),
    style: Object.assign({
      height: '100%'
    }, style)
  });
};
var _default = exports["default"] = Line1;
//# sourceMappingURL=Line1.js.map
