Class: ForceDirectLayout
斥力布局
当前版本暂不支持变换(缩放、平移、旋转等)
Table of contents
Constructors
Properties
Methods
- addLink
- addNode
- applyForce
- attractiveForce
- bounds
- doLayout
- getLink
- initNodes
- initialize
- originForce
- repulsiveForce
- setOriginEdgeWeight
Constructors
constructor
new ForceDirectLayout(originNode
, frame_width
, frame_height
)
Parameters
Name | Type | Description |
---|---|---|
originNode | Node | 原点 |
frame_width | number | |
frame_height | number |
Properties
frame_height
frame_height: any
frame_width
frame_width: any
gravity
gravity: number
maxForceDistance
maxForceDistance: number
origin
origin: any
originEdges
originEdges: any
[] = []
originWeight
originWeight: number
selectedNode
selectedNode: any
speed
speed: number
Methods
addLink
addLink(node1
, node2
, weight
): void
Parameters
Name | Type |
---|---|
node1 | any |
node2 | any |
weight | any |
Returns
void
addNode
addNode(node
, mass
): void
Parameters
Name | Type |
---|---|
node | any |
mass | any |
Returns
void
applyForce
applyForce(): void
应用一次,
Returns
void
attractiveForce
attractiveForce(nodeI
, nodeJ
, distance
): void
Parameters
Name | Type |
---|---|
nodeI | any |
nodeJ | any |
distance | any |
Returns
void
bounds
bounds(node
): void
Parameters
Name | Type |
---|---|
node | any |
Returns
void
doLayout
doLayout(): void
执行布局
暂时不支持动画参数
Returns
void
getLink
getLink(node1Id
, node2Id
): any
Parameters
Name | Type |
---|---|
node1Id | any |
node2Id | any |
Returns
any
initNodes
initNodes(originNode
): void
Parameters
Name | Type |
---|---|
originNode | any |
Returns
void
initialize
initialize(): void
Returns
void
originForce
originForce(nodeI
, distance
): void
Parameters
Name | Type |
---|---|
nodeI | any |
distance | any |
Returns
void
repulsiveForce
repulsiveForce(nodeI
, nodeJ
, distance
): void
Parameters
Name | Type |
---|---|
nodeI | any |
nodeJ | any |
distance | any |
Returns
void
setOriginEdgeWeight
setOriginEdgeWeight(node
, weight
): void
Parameters
Name | Type |
---|---|
node | any |
weight | any |
Returns
void