ForceDirectedLayout$Typings extension
Properties
-
arrangementSpacing
↔ Size
-
Gets or sets the space between which the layout
will position the connected graphs that together compose the network.
This defaults to Size(100, 100).
These distances are used during a clustered layout;
afterwards the normal force-directed layout
will likely cause the size of any space between connected graphs to change,
perhaps considerably.
getter/setter pair
-
arrangesToOrigin
↔ bool
-
Gets or sets whether #commitNodes should move all of the
nodes so that the nodes all fit with the top-left corner at the
Layout#arrangementOrigin.
By default this is false -- the Layout#arrangementOrigin is ignored.
When this is true, nodes are moved even though #isFixed was true.
getter/setter pair
-
Gets or sets whether this layout should find all Nodes
whose category is "Comment" and
whose anchors are nodes represented in the network,
and add ForceDirectedVertexes representing those balloon comments
as nodes in the network.
The default value is false.
getter/setter pair
-
currentIteration
↔ num
-
This read-only property returns the current iteration count, valid during a call to #doLayout.
getter/setter pair
-
Gets or sets the default value computed by #electricalCharge.
The initial value is 5.
getter/setter pair
-
Gets or sets the default value computed by #springLength.
The initial value is 10.
getter/setter pair
-
defaultElectricalCharge
↔ num
-
Gets or sets the default value computed by #electricalCharge.
The initial value is 150.
getter/setter pair
-
defaultGravitationalMass
↔ num
-
Gets or sets the default value computed by #gravitationalMass.
The initial value is zero.
getter/setter pair
-
defaultSpringLength
↔ num
-
Gets or sets the default value computed by #springLength.
The initial value is 50.
getter/setter pair
-
defaultSpringStiffness
↔ num
-
Gets or sets the default value computed by #springStiffness.
The initial value is 0.05.
getter/setter pair
-
epsilonDistance
↔ num
-
Gets or sets approximately how far a node must move in order for the iterations to continue.
The default value is 1.
The value must be larger than zero.
getter/setter pair
-
infinityDistance
↔ num
-
Gets or sets a threshold for the distance beyond which the electrical charge forces may be ignored.
The default value is 1000.
The value must be larger than 1.
getter/setter pair
-
maxIterations
↔ num
-
Gets or sets the maximum number of iterations to perform when doing the
force-directed auto layout.
The value must be non-negative.
The default value is 100.
getter/setter pair
-
moveLimit
↔ num
-
Gets or sets how far a vertex may be moved in an iteration.
The default value is 10.
The value must be larger than 1.
getter/setter pair
-
randomNumberGenerator
↔ dynamic
-
Gets or sets a random number generator.
The default value is Math, which results in calling Math.random().
Change this to null in order to use an instance of an internal repeatable pseudo-random number generator,
which will become the new value of this property.
getter/setter pair
-
setsPortSpots
↔ bool
-
Gets or sets whether the fromSpot and the toSpot of every Link
should be set to Spot.Default.
The default value is true.
getter/setter pair
Methods
-
Find any associated objects to be positioned along with the LayoutVertex#node.
-
commitLayout()
→ void
-
Set the fromSpot and toSpot on each Link, position each Node according
to the vertex position, and then position/route the Links.
-
commitLinks()
→ void
-
Routes the links.
-
commitNodes()
→ void
-
Commit the position of all nodes.
-
createNetwork()
→ ForceDirectedNetwork
-
Create a new LayoutNetwork of ForceDirectedVertexes and ForceDirectedEdges.
@return {ForceDirectedNetwork} a new LayoutNetwork.
-
doLayout(Object coll)
→ void
-
Perform the force-directed layout.
-
electricalCharge(ForceDirectedVertex v)
→ num
-
Returns the charge of the vertex,
the value of ForceDirectedVertex#charge if it's a number,
or else the value of #defaultElectricalCharge.
-
electricalFieldX(num x, num y)
→ num
-
Returns the electrical field in the X direction acting on a vertex at the given point.
By default there is no electrical field at any location.
-
electricalFieldY(num x, num y)
→ num
-
Returns the electrical field in the Y direction acting on a vertex at the given point.
By default there is no electrical field at any location.
-
gravitationalFieldX(num x, num y)
→ num
-
This returns the gravitational field in the X direction acting on a vertex at the given point.
By default there is no gravitational field at any location.
-
gravitationalFieldY(num x, num y)
→ num
-
This returns the gravitational field in the Y direction acting on a vertex at the given point.
By default there is no gravitational field at any location.
-
gravitationalMass(ForceDirectedVertex v)
→ num
-
Returns the mass of the vertex,
the value of ForceDirectedVertex#mass if it's a number,
or else the value of #defaultGravitationalMass.
Please read the Introduction page on Extensions for how to override methods and how to call this base method.
@expose
@param {ForceDirectedVertex} v
@return {number}
-
isFixed(ForceDirectedVertex v)
→ bool
-
This predicate returns true if the vertex should not be moved
by the layout algorithm but still have an effect on nearby and connected vertexes.
The default implementation returns ForceDirectedVertex#isFixed.
Please read the Introduction page on Extensions for how to override methods and how to call this base method.
@expose
@param {ForceDirectedVertex} v
@return {boolean} returns true if the node should not be moved by the layout algorithm.
-
moveFixedVertex(ForceDirectedVertex v)
→ void
-
Maybe move a vertex that #isFixed.
This is called each iteration on each such vertex.
By default this does nothing.
@expose
@param {ForceDirectedVertex} v
-
moveVertex(ForceDirectedVertex v)
→ num
-
(undocumented)
Move the vertex by its ForceDirectedVertex.forceX and ForceDirectedVertex.forceY.
Return the square of the distance moved.
This can be overridden in order to constrain the vertex's actual movement.
@expose
@param {ForceDirectedVertex} v
@return {number} square of distance moved
-
springLength(ForceDirectedEdge e)
→ num
-
Returns the length of the spring representing an edge.
The two vertexes connected by the edge E are acted upon by a force of proportional to
springStiffness(E) * (getNodeDistance(E.fromVertex, E.toVertex) - springLength(E))
divided by the distance between the vertexes.
Please read the Introduction page on Extensions for how to override methods and how to call this base method.
@expose
@param {ForceDirectedEdge} e
@return {number}
Returns the length of the edge representing a link,
the value of ForceDirectedEdge#length if it's a number,
or else the value of #defaultSpringLength.
-
springStiffness(ForceDirectedEdge e)
→ num
-
Returns the stiffness of the spring representing an edge.