@visactor/vchart
Version:
charts lib based @visactor/VGrammar
15 lines (14 loc) • 718 B
JavaScript
export const getCombinedSizeOfRegions = regions => {
let {x: minX, y: minY} = regions[0].getLayoutStartPoint(), maxX = minX + regions[0].getLayoutRect().width, maxY = minY + regions[0].getLayoutRect().height;
for (let index = 1; index < regions.length; index++) {
const region = regions[index], {x: x, y: y} = region.getLayoutStartPoint(), {width: width, height: height} = region.getLayoutRect();
minX = Math.min(minX, x), maxX = Math.max(maxX, width + x), minY = Math.min(minY, y),
maxY = Math.max(maxY, height + y);
}
const height = Math.abs(maxY - minY);
return {
width: Math.abs(maxX - minX),
height: height
};
};
//# sourceMappingURL=region.js.map