UNPKG

19.9 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en"><head>
3 <meta charset="utf-8">
4 <meta http-equiv="X-UA-Compatible" content="IE=edge">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <meta name="description" content="">
7 <meta name="author" content="">
8 <link rel="icon" HREF="favicon.ico">
9 <title>vis.js - Physics documentation.</title>
10
11 <!-- Bootstrap core CSS -->
12 <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
13 <!-- Tipue vendor css -->
14 <link href="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.css" rel="stylesheet">
15
16 <link href="../css/style.css" rel="stylesheet">
17
18
19 <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
20 <!--[if lt IE 9]>
21 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
22 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
23 <![endif]-->
24
25
26 <link href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css" type="text/css" rel="stylesheet"/>
27 <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js"></script>
28
29 <script src="https://cdnjs.cloudflare.com/ajax/libs/smooth-scroll/5.3.7/js/smooth-scroll.min.js"></script>
30 <script language="JavaScript">
31 smoothScroll.init();
32 </script>
33
34 <script type="text/javascript" src="../js/toggleTable.js"></script>
35</head>
36<body onload="prettyPrint();">
37
38<div class="navbar-wrapper">
39 <div class="container">
40 <nav class="navbar-inverse navbar-static-top" role="navigation">
41 <div class="container">
42 <div class="navbar-header">
43 <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
44 aria-expanded="false" aria-controls="navbar">
45 <span class="sr-only">Toggle navigation</span>
46 <span class="icon-bar"></span>
47 <span class="icon-bar"></span>
48 <span class="icon-bar"></span>
49 </button>
50 <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
51 </div>
52 <div id="navbar" class="navbar-collapse collapse">
53 <ul class="nav navbar-nav">
54 </ul>
55 <form class="navbar-form navbar-right" role="search">
56 <input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
57 <button type="button" class="btn btn-default" onclick="vis.initSiteSearch(true);">Go!</button>
58 </form>
59 <div id="search-results-wrapper" class="panel panel-default">
60 <div class="panel-body">
61 <div id="tipue_search_content"></div>
62 </div>
63 </div>
64 <div id="keyword-info" class="panel panel-success">
65 <div class="panel-body">
66 Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
67 </div>
68 </div>
69 </div>
70 </div>
71 </nav>
72 </div>
73</div>
74
75<div class="container full">
76 <h1>Network - physics</h1>
77 <p>Handles the physics simulation, moving the nodes and edges to show them clearly.</p>
78 <h3>Options</h3>
79 <p>The options for the physics have to be contained in an object titled 'physics'.</p>
80 <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
81 <ul class="nav nav-tabs">
82 <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
83 <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
84 <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
85 </ul>
86 <br>
87<pre class="prettyprint lang-js options top hidden" id="fullOptions">
88// these are all options in full.
89var options = {
90 physics:{
91 enabled: true,
92 barnesHut: {
93 gravitationalConstant: -2000,
94 centralGravity: 0.3,
95 springLength: 95,
96 springConstant: 0.04,
97 damping: 0.09,
98 avoidOverlap: 0
99 },
100 forceAtlas2Based: {
101 gravitationalConstant: -50,
102 centralGravity: 0.01,
103 springConstant: 0.08,
104 springLength: 100,
105 damping: 0.4,
106 avoidOverlap: 0
107 },
108 repulsion: {
109 centralGravity: 0.2,
110 springLength: 200,
111 springConstant: 0.05,
112 nodeDistance: 100,
113 damping: 0.09
114 },
115 hierarchicalRepulsion: {
116 centralGravity: 0.0,
117 springLength: 100,
118 springConstant: 0.01,
119 nodeDistance: 120,
120 damping: 0.09
121 },
122 maxVelocity: 50,
123 minVelocity: 0.1,
124 solver: 'barnesHut',
125 stabilization: {
126 enabled: true,
127 iterations: 1000,
128 updateInterval: 100,
129 onlyDynamicEdges: false,
130 fit: true
131 },
132 timestep: 0.5,
133 adaptiveTimestep: true
134 }
135}
136
137network.setOptions(options);
138</pre>
139
140<pre class="prettyprint lang-js options top hidden" id="shortOptions">
141// only the options that have shorthand notations are shown.
142var options = {
143 physics:{
144 stabilization: false
145 }
146}
147network.setOptions(options);
148</pre>
149 <p>All of the individual options are explained here:</p>
150 <table class="options" id="optionTable">
151 <tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr>
152 <tr><td>enabled</td> <td>Boolean</td> <td><code>true</code></td> <td>Toggle the physics system on or off. This property is optional. If you define any of the options below and enabled is undefined, this will be set to true.</td></tr>
153 <tr class='toggle collapsible' onclick="toggleTable('optionTable','barnesHut', this);"><td><span parent="barnesHut" class="right-caret"></span> barnesHut</td> <td>Object</td> <td><code>Object</code></td> <td>BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts.</td></tr>
154 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.gravitationalConstant</td> <td>Number</td> <td><code>-2000</code></td> <td>Gravity attracts. We like repulsion. So the value is negative. If you want the repulsion to be stronger, decrease the value (so -10000, -50000).</td></tr>
155 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.centralGravity</td> <td>Number</td> <td><code>0.3</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
156 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springLength</td> <td>Number</td> <td><code>95</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
157 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springConstant</td> <td>Number</td> <td><code>0.04</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
158 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.damping</td> <td>Number</td> <td><code>0.09</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
159 <tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.avoidOverlap</td> <td>Number</td> <td><code>0</code></td> <td>Accepted range: <code>[0 .. 1]</code>. When larger than 0, the size of the node is taken into account. The distance will be calculated from the radius of the encompassing circle of the node for both the gravity model. Value 1 is maximum overlap avoidance.</td></tr>
160
161 <tr class='toggle collapsible' onclick="toggleTable('optionTable','forceAtlas2Based', this);"><td><span parent="forceAtlas2Based" class="right-caret"></span> forceAtlas2Based</td> <td>Object</td> <td><code>Object</code></td> <td>Force Atlas 2 has been developed by <a href="http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0098679" target="_blank">Jacomi <i>et al</i> (2014)</a> for use with Gephi. The forceAtlas2Based solver makes use of some of the equations provided
162 by them and makes use of the barnesHut implementation in vis. The main differences are the central gravity model,
163 which is here distance independent, and the repulsion being linear instead of quadratic. Finally, all node masses have a
164 multiplier based on the amount of connected edges plus one.</td></tr>
165 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.gravitationalConstant</td> <td>Number</td> <td><code>-50</code></td> <td>This is similar to the barnesHut method except that the falloff is linear instead of quadratic. The connectivity is also taken into account as a factor of the mass. If you want the repulsion to be stronger, decrease the value (so -1000, -2000).</td></tr>
166 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.centralGravity</td> <td>Number</td> <td><code>0.01</code></td> <td>There is a central gravity attractor to pull the entire network back to the center. This is not dependent on distance.</td></tr>
167 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.springLength</td> <td>Number</td> <td><code>100</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
168 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.springConstant</td> <td>Number</td> <td><code>0.08</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
169 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.damping</td> <td>Number</td> <td><code>0.4</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
170 <tr parent="forceAtlas2Based" class="hidden"><td class="indent">forceAtlas2Based.avoidOverlap</td> <td>Number</td> <td><code>0</code></td> <td>Accepted range: <code>[0 .. 1]</code>. When larger than 0, the size of the node is taken into account. The distance will be calculated from the radius of the encompassing circle of the node for both the gravity model. Value 1 is maximum overlap avoidance.</td></tr>
171
172 <tr class='toggle collapsible' onclick="toggleTable('optionTable','repulsion', this);"><td><span parent="repulsion" class="right-caret"></span> repulsion</td> <td>Object</td> <td><code>Object</code></td> <td>The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).</td></tr>
173 <tr parent="repulsion" class="hidden"><td class="indent">repulsion.nodeDistance</td> <td>Number</td> <td><code>100</code></td> <td>This is the range of influence for the repulsion.</td></tr>
174 <tr parent="repulsion" class="hidden"><td class="indent">repulsion.centralGravity</td> <td>Number</td> <td><code>0.2</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
175 <tr parent="repulsion" class="hidden"><td class="indent">repulsion.springLength</td> <td>Number</td> <td><code>200</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
176 <tr parent="repulsion" class="hidden"><td class="indent">repulsion.springConstant</td> <td>Number</td> <td><code>0.05</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
177 <tr parent="repulsion" class="hidden"><td class="indent">repulsion.damping</td> <td>Number</td> <td><code>0.09</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
178
179 <tr class='toggle collapsible' onclick="toggleTable('optionTable','hierarchicalRepulsion', this);"><td><span parent="hierarchicalRepulsion" class="right-caret"></span> hierarchicalRepulsion</td> <td>Object</td> <td><code>Object</code></td> <td>This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.</td></tr>
180 <tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.nodeDistance</td> <td>Number</td> <td><code>120</code></td> <td>This is the range of influence for the repulsion.</td></tr>
181 <tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.centralGravity</td> <td>Number</td> <td><code>0.0'</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
182 <tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.springLength</td> <td>Number</td> <td><code>100</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
183 <tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.springConstant</td> <td>Number</td> <td><code>0.01</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
184 <tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.damping</td> <td>Number</td> <td><code>0.09</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
185
186 <tr><td>maxVelocity</td> <td>Number</td> <td><code>50</code></td> <td>The physics module limits the maximum velocity of the nodes to increase the time to stabilization. This is the maximium value.</td></tr>
187 <tr><td>minVelocity</td> <td>Number</td> <td><code>0.1</code></td> <td>Once the minimum velocity is reached for all nodes, we assume the network has been stabilized and the simulation stops.</td></tr>
188 <tr><td>solver</td> <td>String</td> <td><code>'barnesHut'</code></td><td>You can select your own solver. Possible options: <code>'barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'</code>. When setting the hierarchical layout, the hierarchical repulsion solver is automaticaly selected, regardless of what you fill in here.</td></tr>
189 <tr class='toggle collapsible' onclick="toggleTable('optionTable','stabilization', this);"><td><span parent="stabilization" class="right-caret"></span> stabilization</td> <td>Object | Boolean</td><td><code>Object</code></td> <td>When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.</td></tr>
190 <tr parent="stabilization" class="hidden"><td class="indent">stabilization.enabled</td> <td>Boolean</td> <td><code>true</code></td> <td>Toggle the stabilization. This is an optional property. If undefined, it is automatically set to true when any of the properties of this object are defined.</td></tr>
191 <tr parent="stabilization" class="hidden"><td class="indent">stabilization.iterations</td> <td>Number</td> <td><code>1000</code></td> <td>The physics module tries to stabilize the network on load up til a maximum number of iterations defined here. If the network stabilized with less, you are finished before the maximum number.</td></tr>
192 <tr parent="stabilization" class="hidden"><td class="indent">stabilization.updateInterval</td> <td>Number</td> <td><code>50</code></td> <td>When stabilizing, the DOM can freeze. You can chop the stabilization up into pieces to show a loading bar for instance. The interval determines after how many iterations the <code>stabilizationProgress</code> event is triggered.</td></tr>
193 <tr parent="stabilization" class="hidden"><td class="indent">stabilization.onlyDynamicEdges</td> <td>Boolean</td> <td><code>false</code></td> <td>If you have predefined the position of all nodes and only want to stabilize the dynamic smooth edges, set this to true. It freezes all nodes except the invisible dynamic smooth curve support nodes. If you want the visible nodes to move and stabilize, do not use this.</td></tr>
194 <tr parent="stabilization" class="hidden"><td class="indent">stabilization.fit</td> <td>Boolean</td> <td><code>true</code></td> <td>Toggle whether or not you want the view to zoom to fit all nodes when the stabilization is finished.</td></tr>
195 <tr><td>timestep</td> <td>Number</td> <td><code>0.5</code></td> <td>The physics simulation is discrete. This means we take a step in time, calculate the forces, move the nodes and take another step. If you increase this number the steps will be too large and the network can get unstable. If you see a lot of jittery movement in the network, you may want to reduce this value a little.</td></tr>
196 <tr><td>adaptiveTimestep</td> <td>Boolean</td> <td><code>true</code></td> <td>If this is enabled, the timestep will intelligently be adapted <b>(only during the stabilization stage if stabilization is enabled!)</b> to greatly decrease stabilization times. The timestep configured above is taken as the minimum timestep. <a href="layout.html#layout" target="_blank">This can be further improved by using the improvedLayout algorithm</a>.</td></tr>
197 </table>
198
199</div>
200
201<!-- Bootstrap core JavaScript
202================================================== -->
203<!-- Placed at the end of the document so the pages load faster -->
204<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
205<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
206<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
207<script src="../js/ie10-viewport-bug-workaround.js"></script>
208<!-- jquery extensions -->
209<script src="../js/jquery.highlight.js"></script>
210<script src="../js/jquery.url.min.js"></script>
211<!-- Tipue vendor js -->
212<script src="../js/tipuesearch.config.js"></script>
213<script src="https://cdnjs.cloudflare.com/ajax/libs/Tipue-Search/5.0.0/tipuesearch.min.js"></script>
214<!-- controller -->
215<script src="../js/main.js"></script>
\No newline at end of file