@antv/f2
Version:
Charts for mobile visualization.
54 lines • 1.49 kB
JavaScript
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Rect, Polar } from '../coord';
import { isString, isFunction } from '@antv/util';
var coordMap = {
rect: Rect,
polar: Polar
};
var coordController = /*#__PURE__*/function () {
function coordController() {
_classCallCheck(this, coordController);
}
_createClass(coordController, [{
key: "getOption",
value: function getOption(cfg) {
if (isString(cfg)) {
return {
type: coordMap[cfg] || Rect
};
}
if (isFunction(cfg)) {
return {
type: cfg
};
}
var _ref = cfg || {},
type = _ref.type;
return _objectSpread(_objectSpread({}, cfg), {}, {
// 默认直角坐标系
type: isFunction(type) ? type : coordMap[type] || Rect
});
}
}, {
key: "create",
value: function create(cfg, layout) {
var option = this.getOption(cfg);
var type = option.type;
var coord = new type(_objectSpread(_objectSpread({}, option), layout));
this.coord = coord;
return coord;
}
}, {
key: "updateLayout",
value: function updateLayout(layout) {
this.coord.update(layout);
}
}, {
key: "update",
value: function update() {}
}]);
return coordController;
}();
export default coordController;