本文整理汇总了TypeScript中d3-hierarchy.packEnclose函数的典型用法代码示例。如果您正苦于以下问题:TypeScript packEnclose函数的具体用法?TypeScript packEnclose怎么用?TypeScript packEnclose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了packEnclose函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
// copy() --------------------------------------------------------------------
let copiedPackNode: d3Hierarchy.HierarchyCircularNode<HierarchyDatumWithParentId>;
copiedPackNode = packRootNode.copy();
// -----------------------------------------------------------------------
// Pack Siblings and Enclosure
// -----------------------------------------------------------------------
interface CircleData extends d3Hierarchy.PackCircle {
v: string;
}
let circles: Array<CircleData> = [
{ r: 10, v: 'a' },
{ r: 1, v: 'b' },
{ r: 20, v: 'c' }
];
// packSiblings
circles = d3Hierarchy.packSiblings(circles);
// packEnclose
let enclosure: { r: number, x: number, y: number };
enclosure = d3Hierarchy.packEnclose(circles);
示例2:
{ r: 10, v: 'a' },
{ r: 30, v: 'b' },
{ r: 20, v: 'c' }
];
// packSiblings
const circles = d3Hierarchy.packSiblings(radius);
str = circles[0].v;
num = circles[0].r;
num = circles[0].x;
num = circles[0].y;
// packEnclose
const moreCircles = [
{ r: 10, v: 'a', x: 0, y: 10 },
{ r: 30, v: 'b', x: 5, y: 15 },
{ r: 20, v: 'c', x: 7, y: 30 }
];
const circle = d3Hierarchy.packEnclose(moreCircles);
num = circle.r;
num = circle.x;
num = circle.y;
// $ExpectError
str = circle.v; // fails, property 'v' does not exist
// $ExpectError
d3Hierarchy.packEnclose(radius);