UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

23 lines (19 loc) 818 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.treemapLayout = void 0; const vlayouts_1 = require("@visactor/vlayouts"), hierarchy_1 = require("../../constant/hierarchy"), treemapLayout = (data, op) => { if (op.getViewBox()) { const res = new vlayouts_1.TreemapLayout(op).layout(data, op.getViewBox()), nodes = []; return (0, vlayouts_1.flattenNodes)(res, nodes, { maxDepth: null == op ? void 0 : op.maxDepth }), nodes.forEach(((datum, i) => { datum && [ hierarchy_1.DEFAULT_HIERARCHY_ROOT, "name" ].forEach((key => { datum[key] = datum.datum[datum.depth][op.nameField]; })); })), nodes; } return []; }; exports.treemapLayout = treemapLayout; //# sourceMappingURL=treemap.js.map