UNPKG

@antv/g6-pc

Version:

A Graph Visualization Framework in JavaScript

41 lines (40 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _hierarchy = _interopRequireDefault(require("@antv/hierarchy")); var _util = _interopRequireDefault(require("../util")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } var radialLayout = _util.default.radialLayout; var TreeLayout = /** @class */function () { function TreeLayout(cfg) { this.type = cfg.type; this.radial = cfg.radial; this.config = cfg; } TreeLayout.prototype.init = function (data) { var _this = this; this.data = data; if (this.radial) { this.layoutMethod = function (data) { var layoutData = _hierarchy.default[_this.type](data, _this.config); radialLayout(layoutData); return layoutData; }; return; } this.layoutMethod = function (data) { return _hierarchy.default[_this.type](data, _this.config); }; }; TreeLayout.prototype.execute = function () { return this.layoutMethod(this.data, this.config); }; TreeLayout.prototype.layout = function (data) { this.init(data); return this.execute(); }; return TreeLayout; }(); var _default = exports.default = TreeLayout;