UNPKG

@antv/g2plot

Version:

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

18 lines 488 B
import { each } from '@antv/util'; export function dice(root, x0, y0, x1, y1) { var width = x1 - x0; var children = root.children, value = root.value; children.sort(function (a, b) { return b.value - a.value; }); var k = width / value; var node_x = x0; each(children, function (c) { c.y0 = y0; c.y1 = y1; c.x0 = node_x; node_x += c.value * k; c.x1 = c.x0 + c.value * k; }); } //# sourceMappingURL=dice.js.map