UNPKG

gojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

1,606 lines (611 loc) 82.5 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>GoJS&reg; ForceDirectedLayout Class</title> <script src="../../assets/js/jquery.min.js"></script> <script src="../../assets/js/bootstrap.min.js"></script> <script src="../../assets/js/highlight.js"></script> <script src="../../assets/js/api.js"></script> <link href="../../assets/css/bootstrap.min.css" rel="stylesheet" > <!-- custom CSS after bootstrap --> <link href="../../assets/css/main.css" rel="stylesheet" type="text/css"/> <link href="../../assets/css/api.css" rel="stylesheet" type="text/css"/> <!--<link rel="stylesheet" href="../../assets/css/api.css" type="text/css" media="all" />--> <link rel="stylesheet" href="../../assets/css/highlight.css" type="text/css" media="all" /> </head> <body> <!-- non-fixed navbar --> <nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top"> <div class="container-fluid"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#navbar"> <a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> </div> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="../../index.html">Home</a></li> <li><a href="../../learn/index.html">Learn</a></li> <li><a href="../../samples/index.html">Samples</a></li> <li><a href="../../intro/index.html">Intro</a></li> <li><a href="../../api/index.html">API</a></li> <li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li> <li><a href="../../doc/download.html">Download</a></li> <li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li> <li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li> <li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li> <li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="container-fluid"> <!-- ============================== classes index ============================ --> <div id="navindex" class="col-md-2"> <!-- begin publish.classesIndex --> <!-- <div><a href="../index.html">GoJS Class Index</a></div> --> <div class="sidebar-nav"> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#DiagramNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#DiagramNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Diagram Classes</span> </div> </div> <div id="DiagramNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Adornment.html" class="linkConstructor">Adornment</a></li> <li><a href="../symbols/AnimationManager.html" class="linkConstructor">AnimationManager</a></li> <li><a href="../symbols/CommandHandler.html" class="linkConstructor">CommandHandler</a></li> <li><a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a></li> <li><a href="../symbols/DiagramEvent.html" class="linkConstructor">DiagramEvent</a></li> <li><a href="../symbols/GraphObject.html" class="linkConstructor">GraphObject</a></li> <li><a href="../symbols/Group.html" class="linkConstructor">Group</a></li> <li><a href="../symbols/InputEvent.html" class="linkConstructor">InputEvent</a></li> <li><a href="../symbols/Layer.html" class="linkConstructor">Layer</a></li> <li><a href="../symbols/Link.html" class="linkConstructor">Link</a></li> <li><a href="../symbols/Node.html" class="linkConstructor">Node</a></li> <li><a href="../symbols/Overview.html" class="linkConstructor">Overview</a></li> <li><a href="../symbols/Palette.html" class="linkConstructor">Palette</a></li> <li><a href="../symbols/Panel.html" class="linkConstructor">Panel</a></li> <li><a href="../symbols/Part.html" class="linkConstructor">Part</a></li> <li><a href="../symbols/Picture.html" class="linkConstructor">Picture</a></li> <li><a href="../symbols/Placeholder.html" class="linkConstructor">Placeholder</a></li> <li><a href="../symbols/RowColumnDefinition.html" class="linkConstructor">RowColumnDefinition</a></li> <li><a href="../symbols/Shape.html" class="linkConstructor">Shape</a></li> <li><a href="../symbols/TextBlock.html" class="linkConstructor">TextBlock</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#GeometryNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#GeometryNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Geometry Classes</span> </div> </div> <div id="GeometryNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Brush.html" class="linkConstructor">Brush</a></li> <li><a href="../symbols/Geometry.html" class="linkConstructor">Geometry</a></li> <li><a href="../symbols/Margin.html" class="linkConstructor">Margin</a></li> <li><a href="../symbols/PathFigure.html" class="linkConstructor">PathFigure</a></li> <li><a href="../symbols/PathSegment.html" class="linkConstructor">PathSegment</a></li> <li><a href="../symbols/Point.html" class="linkConstructor">Point</a></li> <li><a href="../symbols/Rect.html" class="linkConstructor">Rect</a></li> <li><a href="../symbols/Size.html" class="linkConstructor">Size</a></li> <li><a href="../symbols/Spot.html" class="linkConstructor">Spot</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#ModelNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ModelNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Model Classes</span> </div> </div> <div id="ModelNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Binding.html" class="linkConstructor">Binding</a></li> <li><a href="../symbols/ChangedEvent.html" class="linkConstructor">ChangedEvent</a></li> <li><a href="../symbols/GraphLinksModel.html" class="linkConstructor">GraphLinksModel</a></li> <li><a href="../symbols/Model.html" class="linkConstructor">Model</a></li> <li><a href="../symbols/Transaction.html" class="linkConstructor">Transaction</a></li> <li><a href="../symbols/TreeModel.html" class="linkConstructor">TreeModel</a></li> <li><a href="../symbols/UndoManager.html" class="linkConstructor">UndoManager</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#LayoutNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#LayoutNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Layout Classes</span> </div> </div> <div id="LayoutNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/CircularLayout.html" class="linkConstructor">CircularLayout</a></li> <li><a href="../symbols/ForceDirectedLayout.html" class="linkConstructor">ForceDirectedLayout</a></li> <li><a href="../symbols/GridLayout.html" class="linkConstructor">GridLayout</a></li> <li><a href="../symbols/LayeredDigraphLayout.html" class="linkConstructor">LayeredDigraphLayout</a></li> <li><a href="../symbols/Layout.html" class="linkConstructor">Layout</a></li> <li><a href="../symbols/LayoutNetwork.html" class="linkConstructor">LayoutNetwork</a></li> <li><a href="../symbols/TreeLayout.html" class="linkConstructor">TreeLayout</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#ToolNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#ToolNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Tool Classes</span> </div> </div> <div id="ToolNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/ActionTool.html" class="linkConstructor">ActionTool</a></li> <li><a href="../symbols/ClickCreatingTool.html" class="linkConstructor">ClickCreatingTool</a></li> <li><a href="../symbols/ClickSelectingTool.html" class="linkConstructor">ClickSelectingTool</a></li> <li><a href="../symbols/ContextMenuTool.html" class="linkConstructor">ContextMenuTool</a></li> <li><a href="../symbols/DraggingTool.html" class="linkConstructor">DraggingTool</a></li> <li><a href="../symbols/DragSelectingTool.html" class="linkConstructor">DragSelectingTool</a></li> <li><a href="../symbols/HTMLInfo.html" class="linkConstructor">HTMLInfo</a></li> <li><a href="../symbols/LinkingBaseTool.html" class="linkConstructor">LinkingBaseTool</a></li> <li><a href="../symbols/LinkingTool.html" class="linkConstructor">LinkingTool</a></li> <li><a href="../symbols/LinkReshapingTool.html" class="linkConstructor">LinkReshapingTool</a></li> <li><a href="../symbols/PanningTool.html" class="linkConstructor">PanningTool</a></li> <li><a href="../symbols/RelinkingTool.html" class="linkConstructor">RelinkingTool</a></li> <li><a href="../symbols/ResizingTool.html" class="linkConstructor">ResizingTool</a></li> <li><a href="../symbols/RotatingTool.html" class="linkConstructor">RotatingTool</a></li> <li><a href="../symbols/TextEditingTool.html" class="linkConstructor">TextEditingTool</a></li> <li><a href="../symbols/Tool.html" class="linkConstructor">Tool</a></li> <li><a href="../symbols/ToolManager.html" class="linkConstructor">ToolManager</a></li> </ul> </div> </div> <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#CollectionNavbar"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#CollectionNavbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <span class="navbar-brand">Collection Classes</span> </div> </div> <div id="CollectionNavbar" class="navbar-collapse collapse sidebar-navbar-collapse"> <ul class="classList nav navbar-nav"> <li><a href="../symbols/Iterable.html" class="linkConstructor">Iterable</a></li> <li><a href="../symbols/Iterator.html" class="linkConstructor">Iterator</a></li> <li><a href="../symbols/List.html" class="linkConstructor">List</a></li> <li><a href="../symbols/Map.html" class="linkConstructor">Map</a></li> <li><a href="../symbols/Set.html" class="linkConstructor">Set</a></li> </ul> </div> </div> </div> <!-- /class="sidebar-nav --> <!-- end publish.classesIndex --> </div> <div id="contentBody" class="col-md-10"> <!-- ============================== header ================================= --> <div id="header" class="fineprint mt30"> <b>GoJS</b>&reg; Diagramming Components<br/>version 1.7.19 for JavaScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <!-- ============================== class title ============================ --> <h2 class="classTitle mt30"> Class ForceDirectedLayout </h2> <!-- ============================== class summary ========================== --> <span class="hideshowall"> <span class="nodetails"><button id="buttonShow">Show Details</button></span> <span class="details"><button id="buttonHide">Show Summaries</button></span> </span> <p class="classsummary"> <span class="extends"> Extends <a href="../symbols/Layout.html" class="linkConstructor">Layout</a>.</span> Force-directed layout treats the graph as if it were a system of physical bodies with forces acting on them and between them. The algorithm seeks a configuration of the bodies with locally minimal energy, i.e. vertex positions such that the sum of the forces on each vertex is zero. There are many samples that use ForceDirectedLayout. The layout cannot guarantee that it provides optimal positioning of nodes. Nodes will normally not overlap each other, but when there is a dense interconnectivity overlaps might not be avoidable. <p class="boxrun"> If you want to experiment interactively with most of the properties, try the <a href="../../samples/fdLayout.html">Force Directed Layout</a> sample. See samples that make use of ForceDirectedLayout in the <a href="../../samples/index.html#forcedirectedlayout">samples index</a>. <p> This layout makes use of a <a href="../symbols/LayoutNetwork.html" class="linkConstructor">LayoutNetwork</a> of <a href="../symbols/ForceDirectedVertex.html" class="linkConstructor">ForceDirectedVertex</a>es and <a href="../symbols/ForceDirectedEdge.html" class="linkConstructor">ForceDirectedEdge</a>s that normally correspond to the <a href="../symbols/Node.html" class="linkConstructor">Node</a>s and <a href="../symbols/Link.html" class="linkConstructor">Link</a>s of the <a href="../symbols/Diagram.html" class="linkConstructor">Diagram</a>. </p> <!-- ============================== constructor summary ==================== --> <h2 id="constructor" class="summaryCaption"> Constructor <span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the constructor documented in the class ForceDirectedLayout."> <thead> <tr> <th scope="col" class="name">Name</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr> <td class="name" > <div class="name"> ForceDirectedLayout() </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>Constructs a <a href="../symbols/ForceDirectedLayout.html" class="linkConstructor">ForceDirectedLayout</a> with no <a href="../symbols/Layout.html#network" class="linkProperty">Layout.network</a> and with no owning <a href="../symbols/Layout.html#diagram" class="linkProperty">Layout.diagram</a>. </div> </td> </tr> </tbody> </table> </div><!-- class="table-responsive">--> <!-- ============================== properties summary ===================== --> <h2 class="summaryCaption">Properties<span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the properties documented in the class ForceDirectedLayout."> <thead> <tr> <th scope="col" class="name">Name, Value Type</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr id="arrangementSpacing" > <td class="name"> <div class="name"> arrangementSpacing </div> <div class="attributes"> <span class="light">{<a href="../symbols/Size.html" class="linkConstructor">Size</a>}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the space between which the layout will position the connected graphs that together compose the network.<span class="nodetails" id="xproparrangementSpacing"><a class="morelink" onclick="hst('proparrangementSpacing')">More...</a></span> <span class="details" id="proparrangementSpacing"> 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.</span> </div> </td> </tr> <tr id="arrangesToOrigin" > <td class="name"> <div class="name"> arrangesToOrigin </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether <a href="../symbols/ForceDirectedLayout.html#commitNodes" class="linkMethod">commitNodes</a> should move all of the nodes so that the nodes all fit with the top-left corner at the <a href="../symbols/Layout.html#arrangementOrigin" class="linkProperty">Layout.arrangementOrigin</a>.<span class="nodetails" id="xproparrangesToOrigin"><a class="morelink" onclick="hst('proparrangesToOrigin')">More...</a></span> <span class="details" id="proparrangesToOrigin"> By default this is false -- the <a href="../symbols/Layout.html#arrangementOrigin" class="linkProperty">Layout.arrangementOrigin</a> is ignored. When this is true, nodes are moved even though <a href="../symbols/ForceDirectedLayout.html#isFixed" class="linkMethod">isFixed</a> was true.</span> </div> </td> </tr> <tr id="comments" > <td class="name"> <div class="name"> comments </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether this layout should find all <a href="../symbols/Node.html" class="linkConstructor">Node</a>s whose category is "Comment" and whose anchors are nodes represented in the network, and add <a href="../symbols/ForceDirectedVertex.html" class="linkConstructor">ForceDirectedVertex</a>es representing those balloon comments as nodes in the network.<span class="nodetails" id="xpropcomments"><a class="morelink" onclick="hst('propcomments')">More...</a></span> <span class="details" id="propcomments"> The default value is false.</span> </div> </td> </tr> <tr id="currentIteration" > <td class="name"> <div class="name"> currentIteration </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>This read-only property returns the current iteration count, valid during a call to <a href="../symbols/ForceDirectedLayout.html#doLayout" class="linkMethod">doLayout</a>. </div> </td> </tr> <tr id="defaultCommentElectricalCharge" > <td class="name"> <div class="name"> defaultCommentElectricalCharge </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#electricalCharge" class="linkMethod">electricalCharge</a>.<span class="nodetails" id="xpropdefaultCommentElectricalCharge"><a class="morelink" onclick="hst('propdefaultCommentElectricalCharge')">More...</a></span> <span class="details" id="propdefaultCommentElectricalCharge"> The initial value is 5.</span> </div> </td> </tr> <tr id="defaultCommentSpringLength" > <td class="name"> <div class="name"> defaultCommentSpringLength </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#springLength" class="linkMethod">springLength</a>.<span class="nodetails" id="xpropdefaultCommentSpringLength"><a class="morelink" onclick="hst('propdefaultCommentSpringLength')">More...</a></span> <span class="details" id="propdefaultCommentSpringLength"> The initial value is 10.</span> </div> </td> </tr> <tr id="defaultElectricalCharge" > <td class="name"> <div class="name"> defaultElectricalCharge </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#electricalCharge" class="linkMethod">electricalCharge</a>.<span class="nodetails" id="xpropdefaultElectricalCharge"><a class="morelink" onclick="hst('propdefaultElectricalCharge')">More...</a></span> <span class="details" id="propdefaultElectricalCharge"> The initial value is 150.</span> </div> </td> </tr> <tr id="defaultGravitationalMass" > <td class="name"> <div class="name"> defaultGravitationalMass </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#gravitationalMass" class="linkMethod">gravitationalMass</a>.<span class="nodetails" id="xpropdefaultGravitationalMass"><a class="morelink" onclick="hst('propdefaultGravitationalMass')">More...</a></span> <span class="details" id="propdefaultGravitationalMass"> The initial value is zero.</span> </div> </td> </tr> <tr id="defaultSpringLength" > <td class="name"> <div class="name"> defaultSpringLength </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#springLength" class="linkMethod">springLength</a>.<span class="nodetails" id="xpropdefaultSpringLength"><a class="morelink" onclick="hst('propdefaultSpringLength')">More...</a></span> <span class="details" id="propdefaultSpringLength"> The initial value is 50.</span> </div> </td> </tr> <tr id="defaultSpringStiffness" > <td class="name"> <div class="name"> defaultSpringStiffness </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the default value computed by <a href="../symbols/ForceDirectedLayout.html#springStiffness" class="linkMethod">springStiffness</a>.<span class="nodetails" id="xpropdefaultSpringStiffness"><a class="morelink" onclick="hst('propdefaultSpringStiffness')">More...</a></span> <span class="details" id="propdefaultSpringStiffness"> The initial value is 0.05.</span> </div> </td> </tr> <tr id="epsilonDistance" > <td class="name"> <div class="name"> epsilonDistance </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets approximately how far a node must move in order for the iterations to continue.<span class="nodetails" id="xpropepsilonDistance"><a class="morelink" onclick="hst('propepsilonDistance')">More...</a></span> <span class="details" id="propepsilonDistance"> The default value is 1. The value must be larger than zero.</span> </div> </td> </tr> <tr id="infinityDistance" > <td class="name"> <div class="name"> infinityDistance </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets a threshold for the distance beyond which the electrical charge forces may be ignored.<span class="nodetails" id="xpropinfinityDistance"><a class="morelink" onclick="hst('propinfinityDistance')">More...</a></span> <span class="details" id="propinfinityDistance"> The default value is 1000. The value must be larger than 1.</span> </div> </td> </tr> <tr id="maxIterations" > <td class="name"> <div class="name"> maxIterations </div> <div class="attributes"> <span class="light">{number}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets the maximum number of iterations to perform when doing the force-directed auto layout.<span class="nodetails" id="xpropmaxIterations"><a class="morelink" onclick="hst('propmaxIterations')">More...</a></span> <span class="details" id="propmaxIterations"> The value must be non-negative. The default value is 100.</span> </div> </td> </tr> <tr id="randomNumberGenerator" > <td class="name"> <div class="name"> randomNumberGenerator </div> <div class="attributes"> <span class="light">{Object}</span> <span class="since" title="since">1.5</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets a random number generator.<span class="nodetails" id="xproprandomNumberGenerator"><a class="morelink" onclick="hst('proprandomNumberGenerator')">More...</a></span> <span class="details" id="proprandomNumberGenerator"> 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. </span><div class="details" id="dproprandomNumberGenerator"><p> The new value must be either null or an Object with a method named "random" taking zero arguments and returning a random number between zero (inclusive) and one (exclusive).</div> </div> </td> </tr> <tr id="setsPortSpots" > <td class="name"> <div class="name"> setsPortSpots </div> <div class="attributes"> <span class="light">{boolean}</span> </div> </td> <td class="description"> <div class="description"> <!--newp <p> --> <p>Gets or sets whether the fromSpot and the toSpot of every <a href="../symbols/Link.html" class="linkConstructor">Link</a> should be set to <a href="../symbols/Spot.html#Default" class="linkConstant">Spot.Default</a>.<span class="nodetails" id="xpropsetsPortSpots"><a class="morelink" onclick="hst('propsetsPortSpots')">More...</a></span> <span class="details" id="propsetsPortSpots"> The default value is true.</span> </div> </td> </tr> </tbody> </table> </div><!-- class="table-responsive">--> <dl class="inheritsList"> <dt>Properties borrowed from class <a href="../symbols/Layout.html" class="linkConstructor">Layout</a>: </dt><dd><a href="../symbols/Layout.html#arrangementOrigin" class="linkProperty">arrangementOrigin</a>, <a href="../symbols/Layout.html#diagram" class="linkProperty">diagram</a>, <a href="../symbols/Layout.html#group" class="linkProperty">group</a>, <a href="../symbols/Layout.html#isInitial" class="linkProperty">isInitial</a>, <a href="../symbols/Layout.html#isOngoing" class="linkProperty">isOngoing</a>, <a href="../symbols/Layout.html#isRealtime" class="linkProperty">isRealtime</a>, <a href="../symbols/Layout.html#isRouting" class="linkProperty">isRouting</a>, <a href="../symbols/Layout.html#isValidLayout" class="linkProperty">isValidLayout</a>, <a href="../symbols/Layout.html#isViewportSized" class="linkProperty">isViewportSized</a>, <a href="../symbols/Layout.html#network" class="linkProperty">network</a></dd> </dl> <!-- ============================== methods summary ======================== --> <h2 class="summaryCaption">Method <span class="nodetails"> Summary</span><span class="details"> Details</span></h2> <div class="table-responsive"> <table class="summaryTable table table-bordered table-condensed" summary="A summary of the methods documented in the class ForceDirectedLayout."> <thead> <tr> <th scope="col" class="name">Name, Return Type</th> <th scope="col" class="description">Description</th> </tr> </thead> <tbody> <tr id="addComments"> <td class="name"> <div class="name"> addComments(v) </div> <div class="attributes"> <span class="since" title="since">1.3</span> </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>Find any associated objects to be positioned along with the <a href="../symbols/LayoutVertex.html#node" class="linkProperty">LayoutVertex.node</a>.<span class="nodetails" id="xmethaddComments"><a class="morelink" onclick="hst('methaddComments')">More...</a></span> <span class="details" id="methaddComments"> </span><div class="details" id="dmethaddComments"><p> This method is called for each vertex in the network, when <a href="../symbols/ForceDirectedLayout.html#comments" class="linkProperty">comments</a> is true. The standard behavior is to look for <a href="../symbols/Node.html" class="linkConstructor">Node</a>s whose <a href="../symbols/Part.html#category" class="linkProperty">Part.category</a> is "Comment" and that refer to the <a href="../symbols/LayoutVertex.html#node" class="linkProperty">LayoutVertex.node</a>. By default this method will not be called unless you set <a href="../symbols/ForceDirectedLayout.html#comments" class="linkProperty">comments</a> to true. <p> You may want to override this method in order to customize how any associated objects are found and how a new <a href="../symbols/ForceDirectedVertex.html" class="linkConstructor">ForceDirectedVertex</a> and <a href="../symbols/ForceDirectedEdge.html" class="linkConstructor">ForceDirectedEdge</a> may be added to the network to represent the (balloon?) comment. This method sets the new vertex's <a href="../symbols/ForceDirectedVertex.html#charge" class="linkProperty">ForceDirectedVertex.charge</a> to the value of <a href="../symbols/ForceDirectedLayout.html#defaultCommentElectricalCharge" class="linkProperty">defaultCommentElectricalCharge</a>, and sets the new edge's <a href="../symbols/ForceDirectedEdge.html#length" class="linkProperty">ForceDirectedEdge.length</a> to the value of <a href="../symbols/ForceDirectedLayout.html#defaultCommentSpringLength" class="linkProperty">defaultCommentSpringLength</a>.</div> <dl class="detailList"> <dt class="heading">Parameters:</dt> <dt> <span class="light fixedFont">{<a href="../symbols/ForceDirectedVertex.html" class="linkConstructor">ForceDirectedVertex</a>}</span> <b>v</b> </dt> <dd></dd> </dl> </div> </td> </tr> <tr id="commitLayout"> <td class="name"> <div class="name"> commitLayout() </div> <div class="attributes"> </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>Set the fromSpot and toSpot on each Link, position each Node according to the vertex position, and then position/route the Links.<span class="nodetails" id="xmethcommitLayout"><a class="morelink" onclick="hst('methcommitLayout')">More...</a></span> <span class="details" id="methcommitLayout"> </span><div class="details" id="dmethcommitLayout"><p> This calls the <a href="../symbols/ForceDirectedLayout.html#commitNodes" class="linkMethod">commitNodes</a> and <a href="../symbols/ForceDirectedLayout.html#commitLinks" class="linkMethod">commitLinks</a> methods, the latter only if <a href="../symbols/Layout.html#isRouting" class="linkProperty">isRouting</a> is true. You should not call this method -- it is a "protected virtual" method. Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div> </div> </td> </tr> <tr id="commitLinks"> <td class="name"> <div class="name"> commitLinks() </div> <div class="attributes"> </div> </td> <td class="description"> <div class="description"> <!--newp--><p><p>Routes the links.<span class="nodetails" id="xmethcommitLinks"><a class="morelink" onclick="hst('methcommitLinks')">More...</a></span> <span class="details" id="methcommitLinks"> </span><div class="details" id="dmethcommitLinks"><p> This is called by <a href="../symbols/ForceDirectedLayout.html#commitLayout" class="linkMethod">commitLayout</a>. This is only called if <a href="../symbols/Layout.html#isRouting" class="linkProperty">Layout.isRouting</a> is true. See also <a href="../symbols/ForceDirectedLayout.html#commitNodes" class="linkMethod">commitNodes</a>. Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</div> </div> </td> </tr> <tr id="commitNodes"> <td class="name"> <div class="name"> commitNodes() </div> <div class="attributes"> </div> </td>