import * as React from 'react';
import { useEffect, useRef } from 'react';
import * as echarts from 'echarts';
import axios from 'axios';
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 = useRef();
  useEffect(function () {
    axios.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
  });
};
export default CubeLineChart;