"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var echarts = _interopRequireWildcard(require("echarts"));
var _axios = _interopRequireDefault(require("axios"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var CubeLineChart = function CubeLineChart(props) {
  var url = props.url,
    _props$query = props.query,
    query = _props$query === void 0 ? {
      "order": [["Deployment.count", "desc"], ["Deployment.createdAt", "asc"]],
      "measures": ["Deployment.count"],
      "timeDimensions": [{
        "dimension": "Deployment.createdAt",
        "granularity": "week"
      }],
      "limit": 5000,
      "dimensions": ["Bu.name"]
    } : _props$query;
  var nodeRef = (0, _react.useRef)();
  (0, _react.useEffect)(function () {
    _axios["default"].request({
      method: 'post',
      url: url,
      params: {
        app: 'mars',
        env: 'yktest'
      },
      data: {
        query: query
      }
    }).then(function (res) {
      console.info(res);
    });
    var myChart = echarts.init(nodeRef.current);
    // 绘制图表
    myChart.setOption({
      title: {
        text: 'ECharts 入门示例'
      },
      tooltip: {},
      xAxis: {
        data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
      },
      yAxis: {},
      series: [{
        name: '销量',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
      }]
    });
  }, []);
  return /*#__PURE__*/React.createElement("div", {
    style: {
      height: 300
    },
    ref: nodeRef
  });
};
var _default = exports["default"] = CubeLineChart;