"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
require("./index.css");
var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
var _excluded = ["title", "legendType", "xdata", "ydata", "options", "smooth"];
/*
 * @Author: wangrongrong wangrongrong@bigo.sg
 * @Date: 2022-05-27 17:08:35
 * @LastEditors: wangrongrong wangrongrong@bigo.sg
 * @LastEditTime: 2023-03-22 12:31:54
 * @FilePath: /lowcode-material/devopsComponent/src/components/echart-line-component/echart-line-component.tsx
 * @Description: echart-line图表
 */
;
var EchartLineComponent = function EchartLineComponent(props) {
  var _props$title = props.title,
    title = _props$title === void 0 ? '' : _props$title,
    _props$legendType = props.legendType,
    legendType = _props$legendType === void 0 ? 'plain' : _props$legendType,
    _props$xdata = props.xdata,
    xdata = _props$xdata === void 0 ? ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] : _props$xdata,
    _props$ydata = props.ydata,
    ydata = _props$ydata === void 0 ? [[150, 230, 224, 218, 135, 147, 260], [153, 240, 124, 318, 35, 137, 261], [140, 260, 324, 418, 235, 142, 240], [150, 230, 224, 218, 135, 147, 260], [153, 240, 124, 318, 35, 137, 261], [140, 260, 324, 418, 235, 142, 240], [150, 230, 224, 218, 135, 147, 260], [153, 240, 124, 318, 35, 137, 261], [140, 260, 324, 418, 235, 142, 240]] : _props$ydata,
    _props$options = props.options,
    options = _props$options === void 0 ? ['test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8', 'test9'] : _props$options,
    smooth = props.smooth,
    others = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
  var series = [];
  console.log('ydata====', ydata);
  console.log('props====', props);
  for (var i = 0; i < ydata.length; i++) {
    var _options$i;
    series.push({
      name: (_options$i = options[i]) !== null && _options$i !== void 0 ? _options$i : '默认',
      data: Array.isArray(ydata[i]) ? ydata[i] : [ydata[i]],
      type: 'line',
      smooth: smooth || false
    });
  }
  var option = {
    title: {
      text: title
    },
    legend: {
      data: options,
      type: legendType
      // orient: 'vertical',
    },

    tooltip: {
      trigger: 'axis'
    },
    xAxis: {
      type: 'category',
      data: xdata
    },
    yAxis: {
      type: 'value'
    },
    series: series
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "Echarts"
  }, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option
  }));
};
var _default = EchartLineComponent;
exports["default"] = _default;