本文整理汇总了TypeScript中d3-force.forceCollide函数的典型用法代码示例。如果您正苦于以下问题:TypeScript forceCollide函数的具体用法?TypeScript forceCollide怎么用?TypeScript forceCollide使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forceCollide函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: forceCenter
forceCenter = forceCenter.y(150);
num = forceCenter.y();
// Use Centering force -----------------------------------------------------------------
forceCenter.initialize(graph.nodes);
forceCenter(0.1); // alpha
// Collision ===========================================================================
// create Collision force --------------------------------------------------------------
let forceCollide: d3Force.ForceCollide<SimNode>;
// without radius
forceCollide = d3Force.forceCollide<SimNode>();
// with fixed radius
forceCollide = d3Force.forceCollide<SimNode>(15);
// with radius accessor function
forceCollide = d3Force.forceCollide<SimNode>(function (node, index, nodes) {
let n: SimNode = node;
let i: number = index;
let ns: SimNode[] = nodes;
return n.r;
});
// Configure Collision force -----------------------------------------------------------
示例2: forceCenter
forceCenter = forceCenter.y(150);
num = forceCenter.y();
// Use Centering force -----------------------------------------------------------------
forceCenter.initialize(graph.nodes);
forceCenter(0.1); // alpha
// Collision ===========================================================================
// create Collision force --------------------------------------------------------------
let forceCollide: d3Force.ForceCollide<SimNode>;
// without radius
forceCollide = d3Force.forceCollide<SimNode>();
// with fixed radius
forceCollide = d3Force.forceCollide<SimNode>(15);
// with radius accessor function
forceCollide = d3Force.forceCollide<SimNode>((node, index, nodes) => {
const n: SimNode = node;
const i: number = index;
const ns: SimNode[] = nodes;
return n.r;
});
// Configure Collision force -----------------------------------------------------------
let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number;