UNPKG

@antv/g2plot

Version:

G2 Plot, a market of plots built with the Grammar of Graphics'

21 lines 593 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var util_1 = require("@antv/util"); function slice(root, x0, y0, x1, y1) { var height = y1 - y0; var children = root.children, value = root.value; children.sort(function (a, b) { return b.value - a.value; }); var k = height / value; var node_y = y0; util_1.each(children, function (c) { c.x0 = x0; c.x1 = x1; c.y0 = node_y; node_y += c.value * k; c.y1 = c.y0 + c.value * k; }); } exports.slice = slice; //# sourceMappingURL=slice.js.map