'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../_virtual/_tslib.js');
var charts = require('echarts/charts');
var components = require('echarts/components');
var echarts = require('echarts/core');
var compFactory = require('../utils/comp-factory.js');

function _interopNamespaceDefault(e) {
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var echarts__namespace = /*#__PURE__*/_interopNamespaceDefault(echarts);

echarts__namespace.use([...compFactory.commonEchartsComponents, components.GridComponent, charts.BarChart]);
const barOption = (props) => {
    const { data, xAxisData } = props, restProps = _tslib.__rest(props, ["data", "xAxisData"]);
    let _series;
    if (data && Array.isArray(data[0])) {
        _series = Array.from({ length: data.length }, (_, idx) => (Object.assign({ type: 'bar', data: data[idx] }, restProps)));
    }
    else {
        _series = data ? [Object.assign({ type: 'bar', data }, restProps)] : undefined;
    }
    return {
        // 声明一个 X 轴，类目轴（category）。默认情况下，类目轴对应到 dataset 第一列。
        xAxis: { type: 'category', data: xAxisData },
        // 声明一个 Y 轴，数值轴。
        yAxis: {},
        series: _series,
    };
};
var bar = compFactory.defineComponent(echarts__namespace, 'bar', barOption);

exports.default = bar;
//# sourceMappingURL=bar.js.map
