"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", "xdata", "ydata", "legend", "yFunc", "showDataZoom", "yTitle"];
/*
 * @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-bar-component/echart-line-component.tsx
 * @Description: echart-bar图表
 */
;
var EchartLineComponent = function EchartLineComponent(props) {
  var _props$title = props.title,
    title = _props$title === void 0 ? '' : _props$title,
    _props$xdata = props.xdata,
    xdata = _props$xdata === void 0 ? ['分组1', '分组2', '分组3', '分组4'] : _props$xdata,
    _props$ydata = props.ydata,
    ydata = _props$ydata === void 0 ? [{
      name: 'test1',
      type: "bar",
      data: [1, 2, 3, 4]
    }, {
      name: 'test3',
      type: "bar",
      data: [5, 6, 7, 8]
    }] : _props$ydata,
    _props$legend = props.legend,
    legend = _props$legend === void 0 ? ['test1', 'test3'] : _props$legend,
    _props$yFunc = props.yFunc,
    yFunc = _props$yFunc === void 0 ? function (a) {
      return a;
    } : _props$yFunc,
    _props$showDataZoom = props.showDataZoom,
    showDataZoom = _props$showDataZoom === void 0 ? true : _props$showDataZoom,
    yTitle = props.yTitle,
    others = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
  var option = {
    title: {
      text: title
    },
    legend: {
      data: legend
    },
    grid: {
      top: '15%',
      left: '2%',
      right: '2%',
      containLabel: true
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow',
        label: {
          show: true
        }
      }
    },
    xAxis: [{
      type: 'category',
      data: xdata
    }],
    yAxis: [{
      type: 'value',
      name: yTitle,
      axisLabel: {
        formatter: yFunc
      }
    }],
    dataZoom: [{
      show: showDataZoom,
      start: 0,
      end: 100
    }, {
      show: false,
      yAxisIndex: 0,
      filterMode: 'empty',
      width: 30,
      height: '80%',
      showDataShadow: false,
      left: '0%'
    }],
    series: ydata
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "Echarts"
  }, /*#__PURE__*/_react["default"].createElement(_echartsForReact["default"], {
    option: option
  }));
};
var _default = EchartLineComponent;
exports["default"] = _default;