本文整理匯總了TypeScript中d3-hierarchy.packSiblings函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript packSiblings函數的具體用法?TypeScript packSiblings怎麽用?TypeScript packSiblings使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了packSiblings函數的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:
let copiedPackNode: d3Hierarchy.HierarchyCircularNode<HierarchyDatumWithParentId>;
copiedPackNode = packRootNode.copy();
// -----------------------------------------------------------------------
// Pack Siblings and Enclosure
// -----------------------------------------------------------------------
const radius = [
{ 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;