vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1236 lines
58 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <meta name="description" content="">
  9. <meta name="author" content="">
  10. <title>vis.js - A dynamic, browser based visualization library.</title>
  11. <!-- Bootstrap core CSS -->
  12. <link href="../css/bootstrap.css" rel="stylesheet">
  13. <link href="../css/newdocs.css" rel="stylesheet">
  14. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  15. <!--[if lt IE 9]>
  16. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  17. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  18. <![endif]-->
  19. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  20. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  21. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  22. <script src="../js/smooth-scroll.min.js"></script>
  23. <script language="JavaScript">
  24. smoothScroll.init();
  25. </script>
  26. <style>
  27. tr.subHeader {
  28. font-weight: bold;
  29. font-style: italic;
  30. }
  31. tr.subHeader td {
  32. padding-top: 30px;
  33. }
  34. td.midMethods {
  35. width: 150px;
  36. background-color: #ffffff;
  37. border: 1px solid #dddddd;
  38. }
  39. tr.visible td {
  40. padding: 10px;
  41. }
  42. </style>
  43. <script type="text/javascript" src="../js/toggleTable.js"></script>
  44. </head>
  45. <body onload="prettyPrint();">
  46. <!-- NAVBAR
  47. ================================================== -->
  48. <div class="navbar-wrapper">
  49. <div class="container">
  50. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  51. <div class="container">
  52. <div class="navbar-header">
  53. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  54. aria-expanded="false" aria-controls="navbar">
  55. <span class="sr-only">Toggle navigation</span>
  56. <span class="icon-bar"></span>
  57. <span class="icon-bar"></span>
  58. <span class="icon-bar"></span>
  59. </button>
  60. <a class="navbar-brand hidden-sm" href="http://www.visjs.org/index.html">vis.js</a>
  61. </div>
  62. <div id="navbar" class="navbar-collapse collapse">
  63. <ul class="nav navbar-nav">
  64. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  65. <li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
  66. src="../img/external-link-icons/external-link-icon-white.png"></a>
  67. </li>
  68. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  69. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  70. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  71. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  72. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  73. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  74. </ul>
  75. </div>
  76. </div>
  77. </nav>
  78. </div>
  79. </div>
  80. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img
  81. style="position: absolute; top: 0; right: 0; border: 0;"
  82. src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
  83. alt="Fork me on GitHub"
  84. data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  85. <div class="container full">
  86. <h1>Network</h1>
  87. <p>Network is a visualization to display networks and networks consisting of nodes and edges. The visualization
  88. is easy to use and supports custom shapes, styles, colors, sizes, images, and more.
  89. The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. To
  90. handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.</p>
  91. <p>As of 4.0, the network consists of individual modules which handle specific parts of the network. These modules
  92. have their own docs, options, methods and events which you can access
  93. by clicking on the modules in the list below.</p>
  94. <h3>Modules</h3>
  95. <table class="moduleTable">
  96. <tr>
  97. <td width="120px"><a href="./configure.html">configure</a></td>
  98. <td>Generates an interactive option editor with filtering.</td>
  99. </tr>
  100. <tr>
  101. <td><a href="./edges.html">edges</a></td>
  102. <td>Handles the creation and deletion of edges and contains the global edge options and styles.</td>
  103. </tr>
  104. <tr>
  105. <td><a href="./groups.html">groups</a></td>
  106. <td>Contains the groups and some options on how to handle nodes with non-existing groups.</td>
  107. </tr>
  108. <tr>
  109. <td><a href="./interaction.html">interaction</a></td>
  110. <td>Used for all user interaction with the network. Handles mouse and touch events and selection as well as
  111. the navigation
  112. buttons and the popups.
  113. </td>
  114. </tr>
  115. <tr>
  116. <td><a href="./layout.html">layout</a></td>
  117. <td>Governs the initial and hierarchical positioning.</td>
  118. </tr>
  119. <tr>
  120. <td><a href="./manipulation.html">manipulation</a></td>
  121. <td>Supplies an API and optional GUI to alter the data in the network.</td>
  122. </tr>
  123. <tr>
  124. <td><a href="./nodes.html">nodes</a></td>
  125. <td>Handles the creation and deletion of nodes and contains the global node options and styles.</td>
  126. </tr>
  127. <tr>
  128. <td><a href="./physics.html">physics</a></td>
  129. <td>Does all the simulation moving the nodes and edges to their final positions, also governs
  130. stabilization.
  131. </td>
  132. </tr>
  133. </table>
  134. <br>
  135. <br>
  136. <ul class="nav nav-tabs">
  137. <li role="presentation" class="active"
  138. onclick="toggleTab('optionsTab','optionsDiv','methodsTab','methodsDiv','eventsTab','eventsDiv');"
  139. id="optionsTab"><a>Options</a></li>
  140. <li role="presentation"
  141. onclick="toggleTab('methodsTab','methodsDiv','eventsTab','eventsDiv','optionsTab','optionsDiv');"
  142. id="methodsTab"><a>Methods</a></li>
  143. <li role="presentation"
  144. onclick="toggleTab('eventsTab','eventsDiv','methodsTab','methodsDiv','optionsTab','optionsDiv');"
  145. id="eventsTab"><a>Events</a></li>
  146. </ul>
  147. <br>
  148. <div id="optionsDiv">
  149. <pre class="prettyprint lang-js options">
  150. var options = {
  151. autoResize: true,
  152. height: '100%',
  153. width: '100%'
  154. locale: 'en',
  155. locales: locales,
  156. clickToUse: false,
  157. configure: {...}, // defined in the configure module.
  158. edges: {...}, // defined in the edges module.
  159. nodes: {...}, // defined in the nodes module.
  160. groups: {...}, // defined in the groups module.
  161. layout: {...}, // defined in the layout module.
  162. interaction: {...}, // defined in the interaction module.
  163. manipulation: {...}, // defined in the manipulation module.
  164. physics: {...}, // defined in the physics module.
  165. }
  166. network.setOptions(options);
  167. </pre>
  168. <p>The individual options are explained below. The ones referring to modules are explained in the corresponding
  169. module.</p>
  170. <table class="moduleTable">
  171. <tr class="header">
  172. <td>name</td>
  173. <td>type</td>
  174. <td>default</td>
  175. <td>description</td>
  176. </tr>
  177. <tr>
  178. <td>autoResize</td>
  179. <td class="mid">Boolean</td>
  180. <td class="mid"><code>true</code></td>
  181. <td>If true, the Network will automatically detect when its container is resized, and redraw itself
  182. accordingly. If false, the Network can be forced to repaint after its container has been resized
  183. using the function redraw() and setSize().
  184. </td>
  185. </tr>
  186. <tr>
  187. <td>width</td>
  188. <td class="mid">String</td>
  189. <td class="mid"><code>'100%'</code></td>
  190. <td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  191. </tr>
  192. <tr>
  193. <td>height</td>
  194. <td class="mid">String</td>
  195. <td class="mid"><code>'100%'</code></td>
  196. <td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  197. </tr>
  198. <tr>
  199. <td>locale</td>
  200. <td class="mid">String</td>
  201. <td class="mid"><code>'en'</code></td>
  202. <td>Select the locale. By default, the language is English. If you want to use another language, you
  203. will
  204. need to define your own locale and refer to it here.
  205. </td>
  206. </tr>
  207. <tr>
  208. <td>locales</td>
  209. <td class="mid">Object</td>
  210. <td class="mid">defaultLocales</td>
  211. <td>Locales object. By default only <code>'en'</code> and <code>'nl'</code> are supported. Take a look
  212. at
  213. the <a href="#locales" data-scroll=""
  214. data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }">locales
  215. section below</a> for more explaination on how to customize this.
  216. </td>
  217. </tr>
  218. <tr>
  219. <td>clickToUse</td>
  220. <td class="mid">Boolean</td>
  221. <td class="mid">false</td>
  222. <td>Locales object. By default only <code>'en'</code> and <code>'nl'</code> are supported. Take a look
  223. at
  224. the <a href="#locales" data-scroll=""
  225. data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }">locales
  226. section below</a> for more explaination on how to customize this.
  227. </td>
  228. </tr>
  229. </table>
  230. <br>
  231. <br>
  232. <h4 id="locales">Custom locales</h4>
  233. <p>The locales object has the following format:</p>
  234. <pre class="prettyprint lang-js">
  235. var locales = {
  236. en: {
  237. edit: 'Edit',
  238. del: 'Delete selected',
  239. back: 'Back',
  240. addNode: 'Add Node',
  241. addEdge: 'Add Edge',
  242. editNode: 'Edit Node',
  243. editEdge: 'Edit Edge',
  244. addDescription: 'Click in an empty space to place a new node.',
  245. edgeDescription: 'Click on a node and drag the edge to another node to connect them.',
  246. editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
  247. createEdgeError: 'Cannot link edges to a cluster.',
  248. deleteClusterError: 'Clusters cannot be deleted.',
  249. editClusterError: 'Clusters cannot be edited.'
  250. }
  251. }</pre>
  252. <p>If you want to define your own locale, you can change the key ('en' here) and change all the string. You can then use your new key in the locale option.</p>
  253. </div>
  254. <div id="methodsDiv" class=" hidden">
  255. <h3>All Methods</h3>
  256. <p>This is a list of all the methods in the public API. They have been grouped by category, which correspond to
  257. the
  258. modules listed above.</p>
  259. <table class="moduleTable" id="methodTable">
  260. <tr class="subHeader">
  261. <td colspan="2">Global methods for the network.</td>
  262. </tr>
  263. <tr class="collapsible toggle" onclick="toggleTable('methodTable','destroy', this);">
  264. <td colspan="2"><span parent="destroy" class="right-caret"></span> destroy()</td>
  265. </tr>
  266. <tr class="hidden" parent="destroy">
  267. <td class="midMethods">Returns: none</td>
  268. <td>Remove the network from the DOM and remove all Hammer bindings and references.</td>
  269. </tr>
  270. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setData', this);">
  271. <td colspan="2"><span parent="setData" class="right-caret"></span> setData({<code><i>nodes: vis
  272. DataSet/Array</i></code>,<code><i>edges: vis
  273. DataSet/Array</i></code>})
  274. </td>
  275. </tr>
  276. <tr class="hidden" parent="setData">
  277. <td class="midMethods">Returns: none</td>
  278. <td>Override all the data in the network. If stabilization is enabled in the <a href="physics.html">physics
  279. module</a>, the network will stabilize again. This method is also performed when first initializing
  280. the
  281. network.
  282. </td>
  283. </tr>
  284. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setOptions', this);">
  285. <td colspan="2"><span parent="setOptions" class="right-caret"></span> setOptions(<code>Object
  286. options</code>)
  287. </td>
  288. </tr>
  289. <tr class="hidden" parent="setOptions">
  290. <td class="midMethods">Returns: none</td>
  291. <td>Set the options. All available options can be found in the modules above. Each module requires it's
  292. own
  293. container with the module name to contain its options.
  294. </td>
  295. </tr>
  296. <tr class="subHeader">
  297. <td colspan="2">Methods related to the canvas.</td>
  298. </tr>
  299. <tr class="collapsible toggle" onclick="toggleTable('methodTable','canvasToDOM', this);">
  300. <td colspan="2"><span parent="canvasToDOM" class="right-caret"></span> canvasToDOM({<code><i>x:
  301. Number</i></code>,<code><i>y:
  302. Number</i></code>})
  303. </td>
  304. </tr>
  305. <tr class="hidden" parent="canvasToDOM">
  306. <td class="midMethods">Returns: Object</td>
  307. <td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the
  308. form of
  309. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  310. </td>
  311. </tr>
  312. <tr class="collapsible toggle" onclick="toggleTable('methodTable','DOMtoCanvas', this);">
  313. <td colspan="2"><span parent="DOMtoCanvas" class="right-caret"></span> DOMtoCanvas({<code><i>x:
  314. Number</i></code>,<code><i>y:
  315. Number</i></code>})
  316. </td>
  317. </tr>
  318. <tr class="hidden" parent="DOMtoCanvas">
  319. <td class="midMethods">Returns: Object</td>
  320. <td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the
  321. form of
  322. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  323. </td>
  324. </tr>
  325. <tr class="collapsible toggle" onclick="toggleTable('methodTable','redraw', this);">
  326. <td colspan="2"><span parent="redraw" class="right-caret"></span> redraw()</td>
  327. </tr>
  328. <tr class="hidden" parent="redraw">
  329. <td class="midMethods">Returns: none</td>
  330. <td>Redraw the network.</td>
  331. </tr>
  332. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setSize', this);">
  333. <td colspan="2"><span parent="setSize" class="right-caret"></span> setSize(<code><i>String
  334. width</i></code>,<code><i>String
  335. height</i></code>)
  336. </td>
  337. </tr>
  338. <tr class="hidden" parent="setSize">
  339. <td class="midMethods">Returns: none</td>
  340. <td>Set the size of the canvas. This is automatically done on a window resize.</td>
  341. </tr>
  342. <tr class="subHeader">
  343. <td colspan="2">Clustering</td>
  344. </tr>
  345. <tr class="collapsible toggle" onclick="toggleTable('methodTable','cluster', this);">
  346. <td colspan="2"><span parent="cluster" class="right-caret"></span> cluster(
  347. <code>Object options</code>)
  348. </td>
  349. </tr>
  350. <tr class="hidden" parent="cluster">
  351. <td class="midMethods">Returns: none</td>
  352. <td>The options object is explained in full <a data-scroll=""
  353. data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }"
  354. href="#optionsObject">below</a>. The joinCondition
  355. function
  356. is presented with all nodes.
  357. </td>
  358. </tr>
  359. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByConnection', this);">
  360. <td colspan="2"><span parent="clusterByConnection" class="right-caret"></span> clusterByConnection(
  361. <code>String nodeId</code>,
  362. <code>[Object options]</code>
  363. )
  364. </td>
  365. </tr>
  366. <tr class="hidden" parent="clusterByConnection">
  367. <td class="midMethods">Returns: none</td>
  368. <td>This method looks at the provided node and makes a cluster of it and all it's connected nodes. The
  369. behaviour can be customized by proving the options object. All options of this object are explained
  370. <a
  371. data-scroll="" data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }"
  372. href="#optionsObject">below</a>. The joinCondition is only presented with the connected
  373. nodes.
  374. </td>
  375. </tr>
  376. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByHubsize', this);">
  377. <td colspan="2"><span parent="clusterByHubsize" class="right-caret"></span> clusterByHubsize(
  378. <code>Number hubsize</code>,
  379. <code>[Object options]</code>)
  380. </td>
  381. </tr>
  382. <tr class="hidden" parent="clusterByHubsize">
  383. <td class="midMethods">Returns: none</td>
  384. <td>This method checks all nodes in the network and those with a equal or higher amount of edges than
  385. specified with the <code>hubsize</code> qualify. Cluster by connection is performed on each of them.
  386. The
  387. options object is described for <code>clusterByConnection</code> and does the same here.
  388. </td>
  389. </tr>
  390. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterOutliers', this);">
  391. <td colspan="2"><span parent="clusterOutliers" class="right-caret"></span> clusterOutliers(
  392. <code>[Object options]</code>)
  393. </tr>
  394. <tr class="hidden" parent="clusterOutliers">
  395. <td class="midMethods">Returns: none</td>
  396. <td>This method will cluster all nodes with 1 edge with their respective connected node.</td>
  397. </tr>
  398. <tr class="collapsible toggle" onclick="toggleTable('methodTable','findNode', this);">
  399. <td colspan="2"><span parent="findNode" class="right-caret"></span> findNode(
  400. <code>String nodeId</code>)
  401. </tr>
  402. <tr class="hidden" parent="findNode">
  403. <td class="midMethods">Returns: Array</td>
  404. <td>Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of
  405. nodeIds
  406. showing where the node is. <br><br> Example:
  407. cluster 'A' contains cluster 'B',
  408. cluster 'B' contains cluster 'C',
  409. cluster 'C' contains node 'fred'.
  410. <code>network.clustering.findNode('fred')</code> will return <code>['A','B','C','fred']</code>.
  411. </td>
  412. </tr>
  413. <tr class="collapsible toggle" onclick="toggleTable('methodTable','isCluster', this);">
  414. <td colspan="2"><span parent="isCluster" class="right-caret"></span> isCluster(
  415. <code>String nodeId</code>)
  416. </tr>
  417. <tr class="hidden" parent="isCluster">
  418. <td class="midMethods">Returns: Boolean</td>
  419. <td>Returns true if the node whose ID has been supplied is a cluster.</td>
  420. </tr>
  421. <tr class="collapsible toggle" onclick="toggleTable('methodTable','openCluster', this);">
  422. <td colspan="2"><span parent="openCluster" class="right-caret"></span> openCluster(
  423. <code>String nodeId</code>)
  424. </tr>
  425. <tr class="hidden" parent="openCluster">
  426. <td class="midMethods">Returns: none</td>
  427. <td>Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster
  428. edges.
  429. </td>
  430. </tr>
  431. <tr class="subHeader">
  432. <td colspan="2">Layout</td>
  433. </tr>
  434. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSeed', this);">
  435. <td colspan="2"><span parent="getSeed" class="right-caret"></span> getSeed()</td>
  436. </tr>
  437. <tr class="hidden" parent="clusterByHubsize">
  438. </tr>
  439. <tr class="hidden" parent="getSeed">
  440. <td class="midMethods">Returns: Number</td>
  441. <td>If you like the layout of your network and would like it to start in the same way next time, ask for
  442. the
  443. seed using this method and put it in the <code>layout.randomSeed</code> option.
  444. </td>
  445. </tr>
  446. <tr class="subHeader">
  447. <td colspan="2">Manipulation methods to use the manipulation system without GUI.</td>
  448. </tr>
  449. <tr class="collapsible toggle" onclick="toggleTable('methodTable','enableEditMode', this);">
  450. <td colspan="2"><span parent="enableEditMode" class="right-caret"></span> enableEditMode()</td>
  451. </tr>
  452. <tr class="hidden" parent="enableEditMode">
  453. <td class="midMethods">Returns: none</td>
  454. <td>Programatically enable the edit mode. Similar effect to pressing the edit button.</td>
  455. </tr>
  456. <tr class="collapsible toggle" onclick="toggleTable('methodTable','disableEditMode', this);">
  457. <td colspan="2"><span parent="disableEditMode" class="right-caret"></span> disableEditMode()</td>
  458. </tr>
  459. <tr class="hidden" parent="disableEditMode">
  460. <td class="midMethods">Returns: none</td>
  461. <td>Programatically disable the edit mode. Similar effect to pressing the close icon (small cross in the
  462. corner of the toolbar).
  463. </td>
  464. </tr>
  465. <tr class="collapsible toggle" onclick="toggleTable('methodTable','addNodeMode', this);">
  466. <td colspan="2"><span parent="addNodeMode" class="right-caret"></span> addNodeMode()</td>
  467. </tr>
  468. <tr class="hidden" parent="addNodeMode">
  469. <td class="midMethods">Returns: none</td>
  470. <td>Go into addNode mode. Having edit mode or manipulation enabled is not required. To get out of this
  471. mode,
  472. call <code>disableEditMode()</code>. The callback functions defined in <code>handlerFunctions</code>
  473. still apply. To use these methods without having the manipulation GUI, make sure you set
  474. <code>enabled</code> to false.
  475. </td>
  476. </tr>
  477. <tr class="collapsible toggle" onclick="toggleTable('methodTable','editNodeMode', this);">
  478. <td colspan="2"><span parent="editNodeMode" class="right-caret"></span> editNodeMode()</td>
  479. </tr>
  480. <tr class="hidden" parent="editNodeMode">
  481. <td class="midMethods">Returns: none</td>
  482. <td>Go into editNode mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
  483. </tr>
  484. <tr class="collapsible toggle" onclick="toggleTable('methodTable','addEdgeMode', this);">
  485. <td colspan="2"><span parent="addEdgeMode" class="right-caret"></span> addEdgeMode()</td>
  486. </tr>
  487. <tr class="hidden" parent="addEdgeMode">
  488. <td class="midMethods">Returns: none</td>
  489. <td>Go into addEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
  490. </tr>
  491. <tr class="collapsible toggle" onclick="toggleTable('methodTable','editEdgeMode', this);">
  492. <td colspan="2"><span parent="editEdgeMode" class="right-caret"></span> editEdgeMode()</td>
  493. </tr>
  494. <tr class="hidden" parent="editEdgeMode">
  495. <td class="midMethods">Returns: none</td>
  496. <td>Go into editEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
  497. </tr>
  498. <tr class="collapsible toggle" onclick="toggleTable('methodTable','deleteSelected', this);">
  499. <td colspan="2"><span parent="deleteSelected" class="right-caret"></span> deleteSelected()</td>
  500. </tr>
  501. <tr class="hidden" parent="deleteSelected">
  502. <td class="midMethods">Returns: none</td>
  503. <td>Delete selected. Having edit mode or manipulation enabled is not required.</td>
  504. </tr>
  505. <tr class="subHeader">
  506. <td colspan="2">Methods to get information on nodes.</td>
  507. </tr>
  508. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getPositions', this);">
  509. <td colspan="2"><span parent="getPositions" class="right-caret"></span> getPositions(<code><i>[Array of
  510. nodeIds]</i></code>)
  511. </td>
  512. </tr>
  513. <tr class="hidden" parent="getPositions">
  514. <td class="midMethods">Returns: Object</td>
  515. <td>Returns the x y positions in canvas space of the nodes with the supplied nodeIds as an object:
  516. <pre class="code">
  517. {
  518. nodeId1: {x: xValue, y:yValue},
  519. nodeId2: {x: xValue, y:yValue},
  520. ...
  521. }
  522. </pre>
  523. Alternative inputs are a String containing a nodeId or nothing. When a String is supplied, the
  524. position
  525. of the node corresponding to the ID is returned. When nothing is supplied, the positions of all
  526. nodes
  527. are returned.
  528. </td>
  529. </tr>
  530. <tr class="collapsible toggle" onclick="toggleTable('methodTable','storePositions', this);">
  531. <td colspan="2"><span parent="storePositions" class="right-caret"></span> storePositions()</td>
  532. </tr>
  533. <tr class="hidden" parent="storePositions">
  534. <td class="midMethods">Returns: none</td>
  535. <td>When using the vis.DataSet to load your nodes into the network, this method will put the X and Y
  536. positions of all nodes into that dataset. If you're loading your nodes from a database and have
  537. this dynamically coupled with
  538. the DataSet, you can
  539. use this to stablize your network once, then save the positions in that database through the DataSet
  540. so
  541. the next
  542. time you load the nodes, stabilization will be near instantaneous.
  543. <br><br>
  544. If the nodes are still moving and you're using dynamic smooth edges (which is on by default), you
  545. can
  546. use the option <code>stabilization.onlyDynamicEdges</code> in the <a href="physics.html">physics
  547. module</a>
  548. to improve initialization time.
  549. <br><br>
  550. <b>This method does not support clustering. At the moment it is not possible to cache
  551. positions when using clusters since they cannot be correctly initialized from just the
  552. positions.</b>
  553. </td>
  554. </tr>
  555. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getBoundingBox', this);">
  556. <td colspan="2"><span parent="getBoundingBox" class="right-caret"></span> getBoundingBox(<code><i>String
  557. nodeId</i></code>)
  558. </td>
  559. </tr>
  560. <tr class="hidden" parent="getBoundingBox">
  561. <td class="midMethods">Returns: Object</td>
  562. <td> Returns a bounding box for the node including label in the format:
  563. <pre class="code">
  564. {
  565. top: Number,
  566. left: Number,
  567. right: Number,
  568. bottom: Number
  569. }
  570. </pre>
  571. These values are in canvas space.
  572. </td>
  573. </tr>
  574. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getConnectedNodes', this);">
  575. <td colspan="2"><span parent="getConnectedNodes" class="right-caret"></span> getConnectedNodes(<code><i>String
  576. nodeId</i></code>)
  577. </td>
  578. </tr>
  579. <tr class="hidden" parent="getConnectedNodes">
  580. <td class="midMethods">Returns: Array</td>
  581. <td>Returns an array of nodeIds of the all the nodes that are directly connected to this node.</td>
  582. </tr>
  583. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getEdges', this);">
  584. <td colspan="2"><span parent="getEdges" class="right-caret"></span> getEdges(<code><i>String
  585. nodeId</i></code>)
  586. </td>
  587. </tr>
  588. <tr class="hidden" parent="getEdges">
  589. <td class="midMethods">Returns: Array</td>
  590. <td>Returns an array of edgeIds of the edges connected to this node.</td>
  591. </tr>
  592. <tr class="subHeader">
  593. <td colspan="2">Physics methods to control when the simulation should run.</td>
  594. </tr>
  595. <tr class="collapsible toggle" onclick="toggleTable('methodTable','startSimulation', this);">
  596. <td colspan="2"><span parent="startSimulation" class="right-caret"></span> startSimulation()</td>
  597. </tr>
  598. <tr class="hidden" parent="startSimulation">
  599. <td class="midMethods">Returns: none</td>
  600. <td>Start the physics simulation. This is normally done whenever needed and is only really useful if you
  601. stop the simulation yourself and wish to continue it afterwards.
  602. </td>
  603. .</td></tr>
  604. <tr class="collapsible toggle" onclick="toggleTable('methodTable','stopSimulation', this);">
  605. <td colspan="2"><span parent="stopSimulation" class="right-caret"></span> stopSimulation()</td>
  606. </tr>
  607. <tr class="hidden" parent="stopSimulation">
  608. <td class="midMethods">Returns: none</td>
  609. <td>This stops the physics simulation and triggers a <code>stabilized</code> event. It can be restarted
  610. by
  611. dragging a node, altering the dataset or calling <code>startSimulation()</code>.
  612. </td>
  613. </tr>
  614. <tr class="collapsible toggle" onclick="toggleTable('methodTable','stabilize', this);">
  615. <td colspan="2"><span parent="stabilize" class="right-caret"></span> stabilize()</td>
  616. </tr>
  617. <tr class="hidden" parent="stabilize">
  618. <td class="midMethods">Returns: none</td>
  619. <td>You can manually call stabilize at any time. All the stabilization options above are used.</td>
  620. </tr>
  621. <tr class="subHeader">
  622. <td colspan="2">Selection methods for nodes and edges.</td>
  623. </tr>
  624. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelection', this);">
  625. <td colspan="2"><span parent="getSelection" class="right-caret"></span> getSelection()</td>
  626. </tr>
  627. <tr class="hidden" parent="getSelection">
  628. <td class="midMethods">Returns: Object</td>
  629. <td>Returns an object with selected nodes and edges ids like this:
  630. <pre class="code">
  631. {
  632. nodes: [Array of selected nodeIds],
  633. edges: [Array of selected edgeIds]
  634. }</pre>
  635. </td>
  636. </tr>
  637. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelectedNodes', this);">
  638. <td colspan="2"><span parent="getSelectedNodes" class="right-caret"></span> getSelectedNodes()</td>
  639. </tr>
  640. <tr class="hidden" parent="getSelectedNodes">
  641. <td class="midMethods">Returns: Array</td>
  642. <td>Returns an array of selected node ids like so:
  643. <code>[nodeId1, nodeId2, ..]</code>.
  644. </td>
  645. </tr>
  646. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelectedEdges', this);">
  647. <td colspan="2"><span parent="getSelectedEdges" class="right-caret"></span> getSelectedEdges()</td>
  648. </tr>
  649. <tr class="hidden" parent="getSelectedEdges">
  650. <td class="midMethods">Returns: Array</td>
  651. <td>Returns an array of selected edge ids like so: <code>[edgeId1, edgeId2, ..]</code>.</td>
  652. </tr>
  653. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getNodeAt', this);">
  654. <td colspan="2"><span parent="getNodeAt" class="right-caret"></span> getNodeAt(<code><i>{x: xPosition
  655. DOM, y: yPosition DOM}</i></code>)
  656. </td>
  657. </tr>
  658. <tr class="hidden" parent="getNodeAt">
  659. <td class="midMethods">Returns: String</td>
  660. <td>Returns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left
  661. corner
  662. of the canvas.
  663. </td>
  664. </tr>
  665. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getEdgeAt', this);">
  666. <td colspan="2"><span parent="getEdgeAt" class="right-caret"></span> getEdgeAt(<code><i>{x: xPosition
  667. DOM, y: yPosition DOM}</i></code>)
  668. </td>
  669. </tr>
  670. <tr class="hidden" parent="getEdgeAt">
  671. <td class="midMethods">Returns: String</code></td>
  672. <td>Returns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left
  673. corner
  674. of the canvas..
  675. </td>
  676. </tr>
  677. <tr class="collapsible toggle" onclick="toggleTable('methodTable','selectNodes', this);">
  678. <td colspan="2"><span parent="selectNodes" class="right-caret"></span> selectNodes(<code><i>Array with
  679. nodeIds</i></code>,<code><i>[Boolean
  680. highlightEdges]</i></code>)
  681. </td>
  682. </tr>
  683. <tr class="hidden" parent="selectNodes">
  684. <td class="midMethods">Returns: none</td>
  685. <td>Selects the nodes corresponding to the id's in the input array. If highlightEdges is true or
  686. undefined,
  687. the neighbouring edges will also be selected. This method unselects all other objects before
  688. selecting
  689. its own objects. <i>Does not fire events</i>.
  690. </td>
  691. </tr>
  692. <tr class="collapsible toggle" onclick="toggleTable('methodTable','selectEdges', this);">
  693. <td colspan="2"><span parent="selectEdges" class="right-caret"></span> selectEdges(<code><i>Array with
  694. edgeIds</i></code>)
  695. </td>
  696. </tr>
  697. <tr class="hidden" parent="selectEdges">
  698. <td class="midMethods">Returns: none</td>
  699. <td>Selects the edges corresponding to the id's in the input array. This method unselects all other
  700. objects
  701. before selecting its own objects. <i>Does not fire events</i>.
  702. </td>
  703. </tr>
  704. <tr class="collapsible toggle" onclick="toggleTable('methodTable','unselectAll', this);">
  705. <td colspan="2"><span parent="unselectAll" class="right-caret"></span> unselectAll()</td>
  706. </tr>
  707. <tr class="hidden" parent="unselectAll">
  708. <td class="midMethods">Returns: none</td>
  709. <td>Unselect all objects. <i>Does not fire events</i>.</td>
  710. </tr>
  711. <tr class="subHeader">
  712. <td colspan="2">Methods to control the viewport for zoom and animation.</td>
  713. </tr>
  714. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getScale', this);">
  715. <td colspan="2"><span parent="getScale" class="right-caret"></span> getScale()</td>
  716. </tr>
  717. <tr class="hidden" parent="getScale">
  718. <td class="midMethods">Returns: Number</td>
  719. <td>Returns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.
  720. </td>
  721. </tr>
  722. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByHubsize', this);">
  723. <td colspan="2"><span parent="clusterByHubsize" class="right-caret"></span> getPosition()</td>
  724. </tr>
  725. <tr class="hidden" parent="clusterByHubsize">
  726. <td class="midMethods">Returns: Number</td>
  727. <td>Returns the current central focus point of the camera.</td>
  728. </tr>
  729. <tr class="collapsible toggle" onclick="toggleTable('methodTable','fit', this);">
  730. <td colspan="2"><span parent="fit" class="right-caret"></span> fit(<code>[Object
  731. options]</code>)
  732. </td>
  733. </tr>
  734. <tr class="hidden" parent="fit">
  735. <td class="midMethods">Returns: none</td>
  736. <td>Zooms out so all nodes fit on the canvas. You can supply options to customize this:
  737. <pre class="code">
  738. {
  739. nodes:[Array of nodeIds],
  740. animation: { // -------------------> can be a boolean too!
  741. duration: Number
  742. easingFunction: String
  743. }
  744. }
  745. </pre>
  746. The nodes can be used to zoom to fit only specific nodes in the view. <br/><br/>
  747. The other options are explained in the <code>moveTo()</code> description below.
  748. All options are optional for the fit method.
  749. </td>
  750. </tr>
  751. <tr class="collapsible toggle" onclick="toggleTable('methodTable','focus', this);">
  752. <td colspan="2"><span parent="focus" class="right-caret"></span> focus(
  753. <code>String nodeId</code>,
  754. <code>[Object options]</code>)
  755. </td>
  756. </tr>
  757. <tr class="hidden" parent="focus">
  758. <td class="midMethods">Returns: none</td>
  759. <td>You can focus on a node with this function. What that means is the view will lock onto that node, if
  760. it
  761. is moving, the view will also move accordingly. If the view is dragged by the user, the focus is
  762. broken.
  763. You can supply options to customize the effect:
  764. <pre class="code">
  765. {
  766. scale: Number,
  767. offset: {x:Number, y:Number}
  768. locked: boolean
  769. animation: { // -------------------> can be a boolean too!
  770. duration: Number
  771. easingFunction: String
  772. }
  773. }
  774. </pre>
  775. All options except for locked are explained in the <code>moveTo()</code> description below. Locked
  776. denotes whether or not the view remains locked to the node once the zoom-in animation is finished.
  777. Default value is true. The options object is optional in the focus method.
  778. </td>
  779. </tr>
  780. <tr class="collapsible toggle" onclick="toggleTable('methodTable','moveTo', this);">
  781. <td colspan="2"><span parent="moveTo" class="right-caret"></span> moveTo(<code>Object
  782. options</code>)
  783. </td>
  784. </tr>
  785. <tr class="hidden" parent="moveTo">
  786. <td class="midMethods">Returns: none</td>
  787. <td>You can animate or move the camera using the moveTo method. Options are:
  788. <pre class="code">
  789. {
  790. position: {x:Number, y:Number},
  791. scale: Number,
  792. offset: {x:Number, y:Number}
  793. animation: { // -------------------> can be a boolean too!
  794. duration: Number
  795. easingFunction: String
  796. }
  797. }
  798. </pre>
  799. The position (in canvas units!) is the position of the central focus point of the camera.
  800. The scale is the target zoomlevel. Default value is 1.0.
  801. The offset (in DOM units) is how many pixels from the center the view is focussed. Default value is
  802. {x:0,y:0}.
  803. For animation you can either use a Boolean to use it with the default options or disable it or you
  804. can
  805. define the duration (in milliseconds) and easing function manually. Available are:
  806. <code>linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic,
  807. easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint</code>.
  808. <i>You will have to define at least a scale or a position. Otherwise, there is nothing to move
  809. to.</i>
  810. </td>
  811. </tr>
  812. <tr class="collapsible toggle" onclick="toggleTable('methodTable','releaseNode', this);">
  813. <td colspan="2"><span parent="releaseNode" class="right-caret"></span> releaseNode()</td>
  814. </tr>
  815. <tr class="hidden" parent="releaseNode">
  816. <td class="midMethods">Returns: none</td>
  817. <td>Programatically release the focussed node.</td>
  818. </tr>
  819. </table>
  820. <br>
  821. <br>
  822. <h4 id="optionsObject">Cluster methods options object</h4>
  823. <p>The options object supplied to the cluster functions can contain these properties:</p>
  824. <table class="moduleTable">
  825. <tr class="header">
  826. <td class="name">name</td>
  827. <td>Type</td>
  828. <td>description</td>
  829. </tr>
  830. <tr>
  831. <td>joinCondition(<br>&nbsp;&nbsp;<code>Object nodeOptions</code><br>)</td>
  832. <td class="midMethods">Function</td>
  833. <td><i>Optional for all but the cluster method. </i> The cluster module loops over all nodes that are
  834. selected to be in the cluster and calls this function with their data as argument.
  835. If this function returns true, this node will be added to the cluster. You have access to all
  836. options
  837. (including the default)
  838. as well as any custom fields you may have added to the node to determine whether or not to include
  839. it in
  840. the cluster. Example:
  841. <pre class="prettyprint lang-js">
  842. var nodes = [
  843. {id: 4, label: 'Node 4'},
  844. {id: 5, label: 'Node 5'},
  845. {id: 6, label: 'Node 6', cid:1},
  846. {id: 7, label: 'Node 7', cid:1}
  847. ]
  848. var options = {
  849. joinCondition:function(nodeOptions) {
  850. return nodeOptions.cid === 1;
  851. }
  852. }
  853. network.clustering.cluster(options);
  854. </pre>
  855. </td>
  856. </tr>
  857. <tr>
  858. <td>processProperties(<br>&nbsp;&nbsp;<code>Object nodeOptions</code><br>)</td>
  859. <td class="midMethods">Function</td>
  860. <td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with
  861. the
  862. properties supplied by you (<code>clusterNodeProperties</code>), all contained nodes and all
  863. contained
  864. edges. You can use this to update the
  865. properties of the cluster based on which items it contains. The function should return the
  866. properties to
  867. create the cluster node. In the example below, we ensure preservation of mass and value when forming
  868. the
  869. cluster:
  870. <pre class="prettyprint lang-js">
  871. var options = {
  872. processProperties: function (clusterOptions, childNodes, childEdges) {
  873. var totalMass = 0;
  874. var totalValue = 0;
  875. for (var i = 0; i < childNodes.length; i++) {
  876. totalMass += childNodes[i].mass;
  877. totalValue = childNodes[i].value ? totalValue + childNodes[i].value : totalValue;
  878. }
  879. clusterOptions.mass = totalMass;
  880. if (totalValue > 0) {
  881. clusterOptions.value = totalValue;
  882. }
  883. return clusterOptions;
  884. },
  885. }
  886. </pre>
  887. </td>
  888. </tr>
  889. <tr>
  890. <td>clusterNodeProperties</td>
  891. <td class="midMethods">Object</td>
  892. <td><i>Optional. </i> This is an object containing the options for the cluster node. All options
  893. described
  894. in the <a href="./nodes.html">nodes module</a> are allowed. This allows you to style your cluster
  895. node
  896. any way you want. This is also the style object that is provided in the processProperties function
  897. for
  898. fine tuning. If undefined, default node options will be used.
  899. </td>
  900. </tr>
  901. <tr>
  902. <td>clusterEdgeProperties</td>
  903. <td class="midMethods">Object</td>
  904. <td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster.
  905. All
  906. options described in the <a href="./edges.html">edges module</a> are allowed. Using this, you can
  907. style
  908. the edges connecting to the cluster any way you want. If none are provided, the optoins from the
  909. edges
  910. that are replaced are used. If undefined, default edge options will be used.
  911. </td>
  912. </tr>
  913. </table>
  914. </div>
  915. <div id="eventsDiv" class=" hidden">
  916. <h3>All Events</h3>
  917. <p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
  918. <p>These events are fired by the interaction module. They are related to user input.</p>
  919. <table class="moduleTable">
  920. <tr class="header">
  921. <td class="eventName">name</td>
  922. <td class="eventProperties">properties</td>
  923. <td>description</td>
  924. </tr>
  925. <tr class="subHeader">
  926. <td colspan="3">Events triggered by human interaction, selection, dragging etc.</td>
  927. </tr>
  928. <tr class="">
  929. <td>click</td>
  930. <td class="mid">
  931. <pre class="code">
  932. {
  933. nodes: [Array of selected nodeIds],
  934. edges: [Array of selected edgeIds],
  935. event: [Object] original click event,
  936. pointer: {
  937. DOM: {x:pointer_x, y:pointer_y},
  938. canvas: {x:canvas_x, y:canvas_y}
  939. }
  940. }
  941. </pre>
  942. </td>
  943. <td>Fired when the user clicks the mouse or taps on a touchscreen device.</td>
  944. </tr>
  945. <tr class="">
  946. <td>doubleClick</td>
  947. <td class="mid">same as <code>click</code>.</td>
  948. <td>Fired when the user double clicks the mouse or double taps on a touchscreen device. Since a double
  949. click
  950. is in fact 2 clicks, 2 click events are fired, followed by a double click event. If you do not want
  951. to
  952. use the click events if a double click event is fired, just check the time between click events
  953. before
  954. processing them.
  955. </td>
  956. </tr>
  957. <tr class="">
  958. <td>oncontext</td>
  959. <td class="mid">same as <code>click</code>.</td>
  960. <td>Fired when the user click on the canvas with the right mouse button. The right mouse button does not
  961. select by default. You can use <a href="./selection.html">getNodeAt</a> to select the node if you
  962. want.
  963. </td>
  964. </tr>
  965. <tr class="">
  966. <td>hold</td>
  967. <td class="mid">same as <code>click</code>.</td>
  968. <td>Fired when the user clicks and holds the mouse or taps and holds on a touchscreen device. A click
  969. event
  970. is also fired in this case.
  971. </td>
  972. </tr>
  973. <tr class="">
  974. <td>release</td>
  975. <td class="mid">same as <code>click</code>.</td>
  976. <td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.
  977. </td>
  978. </tr>
  979. <tr class="">
  980. <td>select</td>
  981. <td class="mid">same as <code>click</code>.</td>
  982. <td>Fired when the selection has changed by user action. This means a node or edge has been selected,
  983. added
  984. to the selection or deselected. <b>All select events are only triggered on click and hold</b>.
  985. </td>
  986. </tr>
  987. <tr class="">
  988. <td>selectNode</td>
  989. <td class="mid">same as <code>click</code>.</td>
  990. <td>Fired when a node has been selected by the user.</td>
  991. </tr>
  992. <tr class="">
  993. <td>selectEdge</td>
  994. <td class="mid">same as <code>click</code>.</td>
  995. <td>Fired when a edge has been selected by the user.</td>
  996. </tr>
  997. <tr class="">
  998. <td>deselectNode</td>
  999. <td class="mid"><pre class="code">
  1000. {
  1001. nodes: [Array of selected nodeIds],
  1002. edges: [Array of selected edgeIds],
  1003. event: [Object] original click event,
  1004. pointer: {
  1005. DOM: {x:pointer_x, y:pointer_y},
  1006. canvas: {x:canvas_x, y:canvas_y}
  1007. }
  1008. },
  1009. previousSelection: {
  1010. nodes: [Array of previously selected nodeIds],
  1011. edges: [Array of previously selected edgeIds]
  1012. }
  1013. }
  1014. </pre>
  1015. </td>
  1016. <td>Fired when a node (or nodes) has (or have) been deselected by the user. The previous selection is
  1017. the
  1018. list of nodes and edges that were selected before the last user event.
  1019. </td>
  1020. </tr>
  1021. <tr class="">
  1022. <td>deselectEdge</td>
  1023. <td class="mid">same as <code>deselectNode</code>.</td>
  1024. <td>Fired when a edge (or edges) has (or have) been deselected by the user. The previous selection is
  1025. the
  1026. list of nodes and edges that were selected before the last user event.
  1027. </td>
  1028. </tr>
  1029. <tr class="">
  1030. <td>dragStart</td>
  1031. <td class="mid">same as <code>click</code>.</td>
  1032. <td>Fired when starting a drag.</td>
  1033. </tr>
  1034. <tr class="">
  1035. <td>dragging</td>
  1036. <td class="mid">same as <code>click</code>.</td>
  1037. <td>Fired when dragging node(s) or the view.</td>
  1038. </tr>
  1039. <tr class="">
  1040. <td>dragEnd</td>
  1041. <td class="mid">same as <code>click</code>.</td>
  1042. <td>Fired when the drag has finished.</td>
  1043. </tr>
  1044. <tr class="">
  1045. <td>zoom</td>
  1046. <td class="mid"><code>{direction:'+'/'-'}</code></td>
  1047. <td>Fired when the user zooms in or out. The properties tell you which direction the zoom is in.</td>
  1048. </tr>
  1049. <tr class="">
  1050. <td>showPopup</td>
  1051. <td class="mid"><code>id of item corresponding to popup</code></td>
  1052. <td>Fired when the popup is shown.</td>
  1053. </tr>
  1054. <tr class="">
  1055. <td>hidePopup</td>
  1056. <td class="mid">none</td>
  1057. <td>Fired when the popup is hidden.</td>
  1058. </tr>
  1059. <tr class="subHeader ">
  1060. <td colspan="3">Events triggered the physics simulation. Can be used to trigger GUI updates.</td>
  1061. </tr>
  1062. <tr class="">
  1063. <td>startStabilizing</td>
  1064. <td class="mid">none</td>
  1065. <td>Fired when stabilization starts. This is also the case when you drag a node and the physics
  1066. simulation
  1067. restarts to stabilize again. Stabilization does not neccesarily imply 'without showing'.
  1068. </td>
  1069. <tr class="">
  1070. <td>stabilizationProgress</td>
  1071. <td class="mid">
  1072. <pre class="code">
  1073. {
  1074. iterations: Number // iterations so far,
  1075. total: Number // total iterations in options
  1076. }
  1077. </pre>
  1078. </td>
  1079. <td>Fired when a multiple of the <code>updateInterval</code> number of iterations is reached. This only
  1080. occurs in the 'hidden' stabilization.
  1081. </td>
  1082. </tr>
  1083. <tr class="">
  1084. <td>stabilizationIterationsDone</td>
  1085. <td class="mid">none</td>
  1086. <td>Fired when the 'hidden' stabilization finishes. This does not necessarily mean the network is
  1087. stabilized; it could also mean that the amount of iterations defined in the options has been
  1088. reached.
  1089. </td>
  1090. <tr class="">
  1091. <td>stabilized</td>
  1092. <td class="mid">
  1093. <pre class="code">
  1094. {
  1095. iterations: Number // iterations it took
  1096. }
  1097. </pre>
  1098. </td>
  1099. <td>Fired when the network has stabilized or when the <code>stopSimulation()</code> has been called. The
  1100. amount of iterations it took could be used to tweak the maximum amount of iterations needed to
  1101. stabilize
  1102. the network.
  1103. </td>
  1104. <tr class="subHeader">
  1105. <td colspan="3">Event triggered by the canvas.</td>
  1106. </tr>
  1107. <tr class="">
  1108. <td>resize</td>
  1109. <td class="mid">
  1110. <pre class="code">
  1111. {
  1112. width: Number // the new width of the canvas
  1113. height: Number // the new height of the canvas
  1114. oldWidth: Number // the old width of the canvas
  1115. oldHeight: Number // the old height of the canvas
  1116. }
  1117. </pre>
  1118. <ul>
  1119. </ul>
  1120. </td>
  1121. <td>Fired when the size of the canvas has been resized, either by a redraw call when the container div
  1122. has
  1123. changed in size, a setSize() call with new values or a setOptions() with new width and/or height
  1124. values.
  1125. </td>
  1126. </tr>
  1127. <tr class="subHeader ">
  1128. <td colspan="3">Events triggered by the rendering module. Can be used to draw custom elements on the
  1129. canvas.
  1130. </td>
  1131. </tr>
  1132. <tr class="">
  1133. <td>initRedraw</td>
  1134. <td class="mid">none</td>
  1135. <td>Fired before the redrawing begins. The simulation step has completed at this point. Can be used to
  1136. move
  1137. custom elements before starting drawing the new frame.
  1138. </td>
  1139. <tr class="">
  1140. <td>beforeDrawing</td>
  1141. <td class="mid"><code>canvas context</code></td>
  1142. <td>Fired after the canvas has been cleared, scaled and translated to the viewing position but before
  1143. all
  1144. edges and nodes are drawn. Can be used to draw behind the network.
  1145. </td>
  1146. <tr class="">
  1147. <td>afterDrawing</td>
  1148. <td class="mid"><code>canvas context</code></td>
  1149. <td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.
  1150. </td>
  1151. </tr>
  1152. <tr class="subHeader">
  1153. <td colspan="3">Event triggered by the view module.</td>
  1154. </tr>
  1155. <tr class="">
  1156. <td>animationFinished</td>
  1157. <td class="mid">none</td>
  1158. <td>Fired when an animation is finished.</td>
  1159. </table>
  1160. </div>
  1161. <br>
  1162. <br>
  1163. <br>
  1164. <br>
  1165. <br>
  1166. <br>
  1167. <br>
  1168. <br>
  1169. <br>
  1170. <br>
  1171. </div>
  1172. <!-- Bootstrap core JavaScript
  1173. ================================================== -->
  1174. <!-- Placed at the end of the document so the pages load faster -->
  1175. <script src="../js/jquery.min.js"></script>
  1176. <script src="../js/bootstrap.min.js"></script>
  1177. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  1178. <script src="../js/ie10-viewport-bug-workaround.js"></script>