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.

1634 lines
81 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  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 - Network documentation.</title>
  11. <!-- Bootstrap core CSS -->
  12. <link href="../css/bootstrap.css" rel="stylesheet">
  13. <!-- Tipue vendor css -->
  14. <link href="../css/tipuesearch.css" rel="stylesheet">
  15. <link href="../css/style.css" rel="stylesheet">
  16. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  17. <!--[if lt IE 9]>
  18. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  19. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  20. <![endif]-->
  21. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  22. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  23. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  24. <script src="../js/smooth-scroll.min.js"></script>
  25. <script language="JavaScript">
  26. smoothScroll.init();
  27. </script>
  28. <style>
  29. tr.subHeader {
  30. font-weight: bold;
  31. font-style: italic;
  32. }
  33. tr.subHeader td {
  34. padding-top: 30px;
  35. }
  36. td.midMethods {
  37. width: 150px;
  38. background-color: #ffffff;
  39. border: 1px solid #dddddd;
  40. }
  41. tr.visible td {
  42. padding: 10px;
  43. }
  44. </style>
  45. <script>
  46. function toggleGettingStarted(aThis) {
  47. var gettingStartedDiv = document.getElementById('gettingStarted');
  48. if (aThis.innerHTML.indexOf("Show") !== -1) {
  49. gettingStartedDiv.className = '';
  50. aThis.innerHTML = 'Hide the getting started again.';
  51. }
  52. else {
  53. gettingStartedDiv.className = 'hidden';
  54. aThis.innerHTML = 'Show the getting started!';
  55. }
  56. }
  57. </script>
  58. <script type="text/javascript" src="../js/toggleTable.js"></script>
  59. </head>
  60. <body onload="prettyPrint();">
  61. <div class="navbar-wrapper">
  62. <div class="container">
  63. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  64. <div class="container">
  65. <div class="navbar-header">
  66. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  67. aria-expanded="false" aria-controls="navbar">
  68. <span class="sr-only">Toggle navigation</span>
  69. <span class="icon-bar"></span>
  70. <span class="icon-bar"></span>
  71. <span class="icon-bar"></span>
  72. </button>
  73. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  74. </div>
  75. <div id="navbar" class="navbar-collapse collapse">
  76. <ul class="nav navbar-nav">
  77. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  78. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  79. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  80. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  81. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  82. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  83. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  84. </ul>
  85. <form class="navbar-form navbar-right" role="search">
  86. <input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
  87. <button type="button" class="btn btn-default" onclick="vis.initSiteSearch(true);">Go!</button>
  88. </form>
  89. <div id="search-results-wrapper" class="panel panel-default">
  90. <div class="panel-body">
  91. <div id="tipue_search_content"></div>
  92. </div>
  93. </div>
  94. <div id="keyword-info" class="panel panel-success">
  95. <div class="panel-body">
  96. Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </nav>
  102. </div>
  103. </div>
  104. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img
  105. style="position: absolute; top: 0; right: 0; border: 0;"
  106. src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
  107. alt="Fork me on GitHub"
  108. data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  109. <div class="container full">
  110. <h1>Network</h1>
  111. <p>Network is a visualization to display networks and networks consisting of nodes and edges. The visualization
  112. is easy to use and supports custom shapes, styles, colors, sizes, images, and more.
  113. The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. To
  114. handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering.</p>
  115. <p>As of 4.0, the network consists of individual modules which handle specific parts of the network. These modules
  116. have their own docs, options, methods and events which you can access
  117. by clicking on the modules in the list below.</p>
  118. <a class="btn btn-primary" role="button" onclick="toggleGettingStarted(this)">Show the getting started!</a>
  119. <div id="gettingStarted" class="hidden">
  120. <h3>Creating a Network</h3>
  121. <p>
  122. Creating a vis network is easy. <a href="http://visjs.org/#download_install" target="_blank">It requires you to
  123. include the vis.js and css files which you can get here</a>. If you have these
  124. added to your application, you will need to specify your nodes and edges. You can use DOT language or export
  125. nodes and edges from Gephi if you'd like but we will do it without these for now.
  126. For more information on this click the tabs below. You can also use the vis.DataSets for dynamic data binding,
  127. for instance, changing the color, label or any option after you have initialized the network.
  128. <br><br>
  129. Once you have the data, all you need is a container div to tell vis where to put your network. Additionally you
  130. can use an options object to customize many aspects of the network. In code this
  131. looks like this:</p>
  132. <pre class="prettyprint lang-html options">
  133. &lt;html&gt;
  134. &lt;head&gt;
  135. &lt;script type="text/javascript" src="../../dist/vis.js"&gt;&lt;/script&gt;
  136. &lt;link href="../../dist/vis.css" rel="stylesheet" type="text/css" /&gt;
  137. &lt;style type="text/css"&gt;
  138. #mynetwork {
  139. width: 600px;
  140. height: 400px;
  141. border: 1px solid lightgray;
  142. }
  143. &lt;/style&gt;
  144. &lt;/head&gt;
  145. &lt;body&gt;
  146. &lt;div id="mynetwork"&gt;&lt;/div&gt;
  147. &lt;script type="text/javascript"&gt;
  148. // create an array with nodes
  149. var nodes = new vis.DataSet([
  150. {id: 1, label: 'Node 1'},
  151. {id: 2, label: 'Node 2'},
  152. {id: 3, label: 'Node 3'},
  153. {id: 4, label: 'Node 4'},
  154. {id: 5, label: 'Node 5'}
  155. ]);
  156. // create an array with edges
  157. var edges = new vis.DataSet([
  158. {from: 1, to: 3},
  159. {from: 1, to: 2},
  160. {from: 2, to: 4},
  161. {from: 2, to: 5}
  162. ]);
  163. // create a network
  164. var container = document.getElementById('mynetwork');
  165. // provide the data in the vis format
  166. var data = {
  167. nodes: nodes,
  168. edges: edges
  169. };
  170. var options = {};
  171. // initialize your network!
  172. var network = new vis.Network(container, data, options);
  173. &lt;/script&gt;
  174. &lt;/body&gt;
  175. &lt;/html&gt;
  176. </pre>
  177. <p><a href="http://visjs.org/examples/network/basicUsage.html" target="_blank">The result of the code above will be the basic example which is shown here.</a></p>
  178. <br>
  179. </div>
  180. <h2 id="Contents">Contents</h2>
  181. <ul>
  182. <li><a href="#modules">Modules</a></li>
  183. <li><a href="#options">Options</a></li>
  184. <li><a href="#methods">Method Reference</a>
  185. <ul>
  186. <li><a href="#methodGlobal">Global</a></li>
  187. <li><a href="#methodCanvas">Canvas</a></li>
  188. <li><a href="#methodClustering">Clustering</a></li>
  189. <li><a href="#methodLayout">Layout</a></li>
  190. <li><a href="#methodManipulation">Manipulation</a></li>
  191. <li><a href="#methodInformation">Information</a></li>
  192. <li><a href="#methodPhysics">Physics</a></li>
  193. <li><a href="#methodSelection">Selection</a></li>
  194. <li><a href="#methodViewport">Viewport</a></li>
  195. <li><a href="#methodConfigurator">Configurator</a></li>
  196. </ul>
  197. </li>
  198. <li><a href="#Events">Events</a></li>
  199. <li><a href="#importing_data">Importing Data</a>
  200. <ul>
  201. <li><a href="#importGephi">from Gephi</a></li>
  202. <li><a href="#importDot">from DOT language</a></li>
  203. </ul>
  204. </li>
  205. </ul>
  206. <h2 id="modules">Modules</h2>
  207. <table class="modules">
  208. <tr>
  209. <td width="120px"><a href="./configure.html">configure</a></td>
  210. <td>Generates an interactive option editor with filtering.</td>
  211. </tr>
  212. <tr>
  213. <td><a href="./edges.html">edges</a></td>
  214. <td>Handles the creation and deletion of edges and contains the global edge options and styles.</td>
  215. </tr>
  216. <tr>
  217. <td><a href="./groups.html">groups</a></td>
  218. <td>Contains the groups and some options on how to handle nodes with non-existing groups.</td>
  219. </tr>
  220. <tr>
  221. <td><a href="./interaction.html">interaction</a></td>
  222. <td>Used for all user interaction with the network. Handles mouse and touch events and selection as well as
  223. the navigation buttons and the popups.
  224. </td>
  225. </tr>
  226. <tr>
  227. <td><a href="./layout.html">layout</a></td>
  228. <td>Governs the initial and hierarchical positioning.</td>
  229. </tr>
  230. <tr>
  231. <td><a href="./manipulation.html">manipulation</a></td>
  232. <td>Supplies an API and optional GUI to alter the data in the network.</td>
  233. </tr>
  234. <tr>
  235. <td><a href="./nodes.html">nodes</a></td>
  236. <td>Handles the creation and deletion of nodes and contains the global node options and styles.</td>
  237. </tr>
  238. <tr>
  239. <td><a href="./physics.html">physics</a></td>
  240. <td>Does all the simulation moving the nodes and edges to their final positions, also governs
  241. stabilization.
  242. </td>
  243. </tr>
  244. </table>
  245. <br>
  246. <div id="optionsDiv">
  247. <h2 id="options">Options</h2>
  248. <pre class="prettyprint lang-js options">
  249. var options = {
  250. autoResize: true,
  251. height: '100%',
  252. width: '100%'
  253. locale: 'en',
  254. locales: locales,
  255. clickToUse: false,
  256. configure: {...}, // defined in the configure module.
  257. edges: {...}, // defined in the edges module.
  258. nodes: {...}, // defined in the nodes module.
  259. groups: {...}, // defined in the groups module.
  260. layout: {...}, // defined in the layout module.
  261. interaction: {...}, // defined in the interaction module.
  262. manipulation: {...}, // defined in the manipulation module.
  263. physics: {...}, // defined in the physics module.
  264. }
  265. network.setOptions(options);
  266. </pre>
  267. <p>The individual options are explained below. The ones referring to modules are explained in the corresponding
  268. module.</p>
  269. <table class="options">
  270. <tr>
  271. <th>Name</th>
  272. <th>Type</th>
  273. <th>Default</th>
  274. <th>Description</th>
  275. </tr>
  276. <tr><td id="event_autoResize">autoResize</td>
  277. <td>Boolean</td>
  278. <td><code>true</code></td>
  279. <td>If true, the Network will automatically detect when its container is resized, and redraw itself
  280. accordingly. If false, the Network can be forced to repaint after its container has been resized
  281. using the function redraw() and setSize().
  282. </td>
  283. </tr>
  284. <tr><td id="event_width">width</td>
  285. <td>String</td>
  286. <td><code>'100%'</code></td>
  287. <td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  288. </tr>
  289. <tr><td id="event_height">height</td>
  290. <td>String</td>
  291. <td><code>'100%'</code></td>
  292. <td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td>
  293. </tr>
  294. <tr><td id="event_locale">locale</td>
  295. <td>String</td>
  296. <td><code>'en'</code></td>
  297. <td>Select the locale. By default, the language is English. If you want to use another language, you
  298. will
  299. need to define your own locale and refer to it here.
  300. </td>
  301. </tr>
  302. <tr><td id="event_locales">locales</td>
  303. <td>Object</td>
  304. <td>defaultLocales</td>
  305. <td>Locales object. By default only <code>'en'</code>, <code>'de'</code>, <code>'es'</code> and <code>'nl'</code> are supported. Take a look
  306. at
  307. the <a href="#locales" data-scroll=""
  308. data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }">locales
  309. section below</a> for more explaination on how to customize this.
  310. </td>
  311. </tr>
  312. <tr><td id="event_clickToUse">clickToUse</td>
  313. <td>Boolean</td>
  314. <td>false</td>
  315. <td>When a Network is configured to be <code>clickToUse</code>, it will react to mouse and touch events only when active. When active, a blue shadow border is displayed around the Network. The network is set active by clicking on it, and is changed to inactive again by clicking outside the Network or by pressing the ESC key.
  316. </td>
  317. </tr>
  318. <tr><td id="event_configure">configure</td>
  319. <td>Object</td>
  320. <td>Object</td>
  321. <td>All options in this object are explained in the <a href="./configure.html">configure module</a>.
  322. </td>
  323. </tr>
  324. <tr><td id="event_edges">edges</td>
  325. <td>Object</td>
  326. <td>Object</td>
  327. <td>All options in this object are explained in the <a href="./edges.html">edges module</a>.
  328. </td>
  329. </tr>
  330. <tr><td id="event_nodes">nodes</td>
  331. <td>Object</td>
  332. <td>Object</td>
  333. <td>All options in this object are explained in the <a href="./nodes.html">nodes module</a>.
  334. </td>
  335. </tr>
  336. <tr><td id="event_groups">groups</td>
  337. <td>Object</td>
  338. <td>Object</td>
  339. <td>All options in this object are explained in the <a href="./groups.html">groups module</a>.
  340. </td>
  341. </tr>
  342. <tr><td id="event_layout">layout</td>
  343. <td>Object</td>
  344. <td>Object</td>
  345. <td>All options in this object are explained in the <a href="./layout.html">layout module</a>.
  346. </td>
  347. </tr>
  348. <tr><td id="event_interaction">interaction</td>
  349. <td>Object</td>
  350. <td>Object</td>
  351. <td>All options in this object are explained in the <a href="./interaction.html">interaction module</a>.
  352. </td>
  353. </tr>
  354. <tr><td id="event_manipulation">manipulation</td>
  355. <td>Object</td>
  356. <td>Object</td>
  357. <td>All options in this object are explained in the <a href="./manipulation.html">manipulation module</a>.
  358. </td>
  359. </tr>
  360. <tr><td id="event_physics">physics</td>
  361. <td>Object</td>
  362. <td>Object</td>
  363. <td>All options in this object are explained in the <a href="./physics.html">physics module</a>.
  364. </td>
  365. </tr>
  366. </table>
  367. <br>
  368. <br>
  369. <h4 id="locales">Custom locales</h4>
  370. <p>The locales object has the following format:</p>
  371. <pre class="prettyprint lang-js">
  372. var locales = {
  373. en: {
  374. edit: 'Edit',
  375. del: 'Delete selected',
  376. back: 'Back',
  377. addNode: 'Add Node',
  378. addEdge: 'Add Edge',
  379. editNode: 'Edit Node',
  380. editEdge: 'Edit Edge',
  381. addDescription: 'Click in an empty space to place a new node.',
  382. edgeDescription: 'Click on a node and drag the edge to another node to connect them.',
  383. editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
  384. createEdgeError: 'Cannot link edges to a cluster.',
  385. deleteClusterError: 'Clusters cannot be deleted.',
  386. editClusterError: 'Clusters cannot be edited.'
  387. }
  388. }</pre>
  389. <p>If you want to define your own locale, you can change the key ('en' here) and change all the strings. You can
  390. then use your new key in the locale option.</p>
  391. </div>
  392. <br /><hr />
  393. <div id="methodsDiv">
  394. <h2 id="methods">Methods</h2>
  395. <p>This is a list of all the methods in the public API. They have been grouped by category, which correspond to
  396. the
  397. modules listed above.</p>
  398. <table class="methods-collapsable" id="methodTable">
  399. <tr id="methodGlobal" class="subHeader">
  400. <td colspan="2">Global methods for the network.</td>
  401. </tr>
  402. <tr class="collapsible toggle" onclick="toggleTable('methodTable','destroy', this);">
  403. <td colspan="2"><span parent="destroy" class="right-caret" id="method_destroy"></span> destroy()</td>
  404. </tr>
  405. <tr class="hidden" parent="destroy">
  406. <td class="midMethods">Returns: none</td>
  407. <td>Remove the network from the DOM and remove all Hammer bindings and references.</td>
  408. </tr>
  409. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setData', this);">
  410. <td colspan="2"><span parent="setData" class="right-caret" id="method_setData"></span> setData({<code><i>nodes: vis
  411. DataSet/Array</i></code>,<code><i>edges: vis
  412. DataSet/Array</i></code>})
  413. </td>
  414. </tr>
  415. <tr class="hidden" parent="setData">
  416. <td class="midMethods">Returns: none</td>
  417. <td>Override all the data in the network. If stabilization is enabled in the <a href="physics.html">physics
  418. module</a>, the network will stabilize again. This method is also performed when first initializing
  419. the
  420. network.
  421. </td>
  422. </tr>
  423. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setOptions', this);">
  424. <td colspan="2"><span parent="setOptions" class="right-caret" id="method_setOptions"></span> setOptions(<code>Object
  425. options</code>)
  426. </td>
  427. </tr>
  428. <tr class="hidden" parent="setOptions">
  429. <td class="midMethods">Returns: none</td>
  430. <td>Set the options. All available options can be found in the modules above. Each module requires it's
  431. own
  432. container with the module name to contain its options.
  433. </td>
  434. </tr>
  435. <tr class="collapsible toggle" onclick="toggleTable('methodTable','onEvent', this);">
  436. <td colspan="2"><span parent="onEvent" class="right-caret" id="method_on"></span> on(<code>String event name, Function callback</code>)
  437. </td>
  438. </tr>
  439. <tr class="hidden" parent="onEvent">
  440. <td class="midMethods">Returns: none</td>
  441. <td>Set an event listener. Depending on the type of event you get different parameters for the callback function. Look at the event section of the documentation for more information.
  442. </td>
  443. </tr>
  444. <tr class="collapsible toggle" onclick="toggleTable('methodTable','offEvent', this);">
  445. <td colspan="2"><span parent="offEvent" class="right-caret" id="method_off"></span> off(<code>String event name, Function callback</code>)
  446. </td>
  447. </tr>
  448. <tr class="hidden" parent="offEvent">
  449. <td class="midMethods">Returns: none</td>
  450. <td>Remove an event listener. The function you supply has to be the exact same as the one you used in the on function. If no function is supplied, all listeners will be removed. Look at the event section of the documentation for more information.
  451. </td>
  452. </tr>
  453. <tr class="collapsible toggle" onclick="toggleTable('methodTable','onceEvent', this);">
  454. <td colspan="2"><span parent="onceEvent" class="right-caret" id="method_once"></span> once(<code>String event name, Function callback</code>)
  455. </td>
  456. </tr>
  457. <tr class="hidden" parent="onceEvent">
  458. <td class="midMethods">Returns: none</td>
  459. <td>Set an event listener only once. After it has taken place, the event listener will be removed. Depending on the type of event you get different parameters for the callback function. Look at the event section of the documentation for more information.
  460. </td>
  461. </tr>
  462. <tr id="methodCanvas" class="subHeader">
  463. <td colspan="2">Methods related to the canvas.</td>
  464. </tr>
  465. <tr class="collapsible toggle" onclick="toggleTable('methodTable','canvasToDOM', this);">
  466. <td colspan="2"><span parent="canvasToDOM" class="right-caret" id="method_canvasToDOM"></span> canvasToDOM({<code><i>x:
  467. Number</i></code>,<code><i>y:
  468. Number</i></code>})
  469. </td>
  470. </tr>
  471. <tr class="hidden" parent="canvasToDOM">
  472. <td class="midMethods">Returns: Object</td>
  473. <td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the
  474. form of
  475. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  476. </td>
  477. </tr>
  478. <tr class="collapsible toggle" onclick="toggleTable('methodTable','DOMtoCanvas', this);">
  479. <td colspan="2"><span parent="DOMtoCanvas" class="right-caret" id="method_DOMtoCanvas"></span> DOMtoCanvas({<code><i>x:
  480. Number</i></code>,<code><i>y:
  481. Number</i></code>})
  482. </td>
  483. </tr>
  484. <tr class="hidden" parent="DOMtoCanvas">
  485. <td class="midMethods">Returns: Object</td>
  486. <td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the
  487. form of
  488. <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.
  489. </td>
  490. </tr>
  491. <tr class="collapsible toggle" onclick="toggleTable('methodTable','redraw', this);">
  492. <td colspan="2"><span parent="redraw" class="right-caret" id="method_redraw"></span> redraw()</td>
  493. </tr>
  494. <tr class="hidden" parent="redraw">
  495. <td class="midMethods">Returns: none</td>
  496. <td>Redraw the network.</td>
  497. </tr>
  498. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setSize', this);">
  499. <td colspan="2"><span parent="setSize" class="right-caret" id="method_setSize"></span> setSize(<code><i>String
  500. width</i></code>,<code><i>String
  501. height</i></code>)
  502. </td>
  503. </tr>
  504. <tr class="hidden" parent="setSize">
  505. <td class="midMethods">Returns: none</td>
  506. <td>Set the size of the canvas. This is automatically done on a window resize.</td>
  507. </tr>
  508. <tr id="methodClustering" class="subHeader">
  509. <td colspan="2">Clustering</td>
  510. </tr>
  511. <tr class="collapsible toggle" onclick="toggleTable('methodTable','cluster', this);">
  512. <td colspan="2"><span parent="cluster" class="right-caret" id="method_cluster"></span> cluster(
  513. <code>Object options</code>)
  514. </td>
  515. </tr>
  516. <tr class="hidden" parent="cluster">
  517. <td class="midMethods">Returns: none</td>
  518. <td>The options object is explained in full <a data-scroll=""
  519. data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }"
  520. href="#optionsObject">below</a>. The joinCondition
  521. function
  522. is presented with all nodes.
  523. </td>
  524. </tr>
  525. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByConnection', this);">
  526. <td colspan="2"><span parent="clusterByConnection" class="right-caret" id="method_clusterByConnection"></span> clusterByConnection(
  527. <code>String nodeId</code>,
  528. <code>[Object options]</code>
  529. )
  530. </td>
  531. </tr>
  532. <tr class="hidden" parent="clusterByConnection">
  533. <td class="midMethods">Returns: none</td>
  534. <td>This method looks at the provided node and makes a cluster of it and all it's connected nodes. The
  535. behaviour can be customized by proving the options object. All options of this object are explained
  536. <a
  537. data-scroll="" data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }"
  538. href="#optionsObject">below</a>. The joinCondition is only presented with the connected
  539. nodes.
  540. </td>
  541. </tr>
  542. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByHubsize', this);">
  543. <td colspan="2"><span parent="clusterByHubsize" class="right-caret" id="method_clusterByHubsize"></span> clusterByHubsize(
  544. <code>[Number hubsize]</code>,
  545. <code>[Object options]</code>)
  546. </td>
  547. </tr>
  548. <tr class="hidden" parent="clusterByHubsize">
  549. <td class="midMethods">Returns: none</td>
  550. <td>This method checks all nodes in the network and those with a equal or higher amount of edges than
  551. specified with the <code>hubsize</code> qualify. If a hubsize is not defined, the hubsize will be determined as the average
  552. value plus two standard deviations. <br><br>
  553. For all qualifying nodes, clusterByConnection is performed on each of them.
  554. The options object is described for <code>clusterByConnection</code> and does the same here.
  555. </td>
  556. </tr>
  557. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterOutliers', this);">
  558. <td colspan="2"><span parent="clusterOutliers" class="right-caret" id="method_clusterOutliers"></span> clusterOutliers(
  559. <code>[Object options]</code>)
  560. </tr>
  561. <tr class="hidden" parent="clusterOutliers">
  562. <td class="midMethods">Returns: none</td>
  563. <td>This method will cluster all nodes with 1 edge with their respective connected node.
  564. The options object is explained in full <a data-scroll="" data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }" href="#optionsObject">below</a>.
  565. </td>
  566. </tr>
  567. <tr class="collapsible toggle" onclick="toggleTable('methodTable','findNode', this);">
  568. <td colspan="2"><span parent="findNode" class="right-caret" id="method_findNode"></span> findNode(
  569. <code>String nodeId</code>)
  570. </tr>
  571. <tr class="hidden" parent="findNode">
  572. <td class="midMethods">Returns: Array</td>
  573. <td>Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of
  574. nodeIds
  575. showing where the node is. <br><br> Example:
  576. cluster 'A' contains cluster 'B',
  577. cluster 'B' contains cluster 'C',
  578. cluster 'C' contains node 'fred'.
  579. <code>network.clustering.findNode('fred')</code> will return <code>['A','B','C','fred']</code>.
  580. </td>
  581. </tr>
  582. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getClusteredEdges', this);">
  583. <td colspan="2"><span parent="getClusteredEdges" class="right-caret" id="method_getClusteredEdges"></span> getClusteredEdges(
  584. <code>String baseEdgeId</code>)
  585. </tr>
  586. <tr class="hidden" parent="getClusteredEdges">
  587. <td class="midMethods">Returns: Array</td>
  588. <td>Similiar to <code>findNode</code> in that it returns all the edge ids that were created from the provided edge during clustering
  589. </td>
  590. </tr>
  591. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getBaseEdge', this);">
  592. <td colspan="2"><span parent="getBaseEdge" class="right-caret" id="method_getBaseEdge"></span> getBaseEdge(
  593. <code>String clusteredEdgeId</code>)
  594. </tr>
  595. <tr class="hidden" parent="getBaseEdge">
  596. <td class="midMethods">Returns: Value</td>
  597. <td>When a clusteredEdgeId is available, this method will return the original baseEdgeId provided in <code>data.edges</code><br/>
  598. ie. After clustering the 'SelectEdge' event is fired but provides only the clustered edge. This method can then be used to return the baseEdgeId.
  599. </td>
  600. </tr>
  601. <tr class="collapsible toggle" onclick="toggleTable('methodTable','updateEdge', this);">
  602. <td colspan="2"><span parent="updateEdge" class="right-caret" id="method_updateEdge"></span> updateEdge(
  603. <code>String startEdgeId, Object options</code>)
  604. </tr>
  605. <tr class="hidden" parent="updateEdge">
  606. <td class="midMethods">Returns: none</td>
  607. <td>Visible edges between clustered nodes are not the same edge as the ones provided in <code>data.edges</code> passed on <code>network</code> creation<br/>
  608. With each layer of clustering, copies of the edges between clusters are created and the previous edges are hidden, until the cluster is opened.<br/>
  609. This method takes an edgeId (ie. a base edgeId from <data>data.edges</code>) and applys the options to it and any edges that were created from it while clustering.<br><br> Example:
  610. <code>network.clustering.updateEdge(originalEdge.id, {color : '#aa0000'});</code><br/>
  611. This would turn the base edge and any subsequent edges red, so when opening clusters the edges will all be the same color.
  612. </td>
  613. </tr>
  614. <tr class="collapsible toggle" onclick="toggleTable('methodTable','updateClusteredNode', this);">
  615. <td colspan="2"><span parent="updateClusteredNode" class="right-caret" id="method_updateClusteredNode"></span> updateClusteredNode(
  616. <code>String clusteredNodeId, Object options</code>)
  617. </tr>
  618. <tr class="hidden" parent="updateClusteredNode">
  619. <td class="midMethods">Returns: none</td>
  620. <td>Clustered Nodes when created are not contained in the original <code>data.nodes</code> passed on <code>network</code> creation<br/>
  621. This method updates the cluster node.<br><br> Example:
  622. <code>network.clustering.updateClusteredNode(clusteredNodeId, {shape : 'star'});</code>
  623. </td>
  624. </tr>
  625. <tr class="collapsible toggle" onclick="toggleTable('methodTable','isCluster', this);">
  626. <td colspan="2"><span parent="isCluster" class="right-caret" id="method_isCluster"></span> isCluster(
  627. <code>String nodeId</code>)
  628. </tr>
  629. <tr class="hidden" parent="isCluster">
  630. <td class="midMethods">Returns: Boolean</td>
  631. <td>Returns true if the node whose ID has been supplied is a cluster.</td>
  632. </tr>
  633. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getNodesInCluster', this);">
  634. <td colspan="2"><span parent="getNodesInCluster" class="right-caret" id="method_getNodesInCluster"></span> getNodesInCluster(
  635. <code>String clusterNodeId</code>)
  636. </tr>
  637. <tr class="hidden" parent="getNodesInCluster">
  638. <td class="midMethods">Returns: Array</td>
  639. <td>Returns an array of all nodeIds of the nodes that would be released if you open the cluster.
  640. </td>
  641. </tr>
  642. <tr class="collapsible toggle" onclick="toggleTable('methodTable','openCluster', this);">
  643. <td colspan="2"><span parent="openCluster" class="right-caret" id="method_openCluster"></span> openCluster(
  644. <code>String nodeId, Object options</code>)
  645. </tr>
  646. <tr class="hidden" parent="openCluster">
  647. <td class="midMethods">Returns: none</td>
  648. <td>Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster
  649. edges. The options object is optional and currently supports one option, releaseFunction, which is a function that can be used to manually
  650. position the nodes after the cluster is opened. <br>
  651. <pre class="code">
  652. function releaseFunction (clusterPosition, containedNodesPositions) {
  653. var newPositions = {};
  654. // clusterPosition = {x:clusterX, y:clusterY};
  655. // containedNodesPositions = {nodeId:{x:nodeX,y:nodeY}, nodeId2....}
  656. newPositions[nodeId] = {x:newPosX, y:newPosY};
  657. return newPositions;
  658. }</pre>
  659. The containedNodesPositions contain the positions of the nodes in the cluster at the moment they were clustered.
  660. This function is expected to return the newPositions, which can be the containedNodesPositions (altered) or a new object. This has to be an object with keys equal
  661. to the nodeIds that exist in the containedNodesPositions and an <code>{x:x,y:y}</code> position object. <br><br>
  662. For all nodeIds not listed in this returned object, we will position them at the location of the cluster. This is also the default behaviour when no releaseFunction is defined.
  663. </td>
  664. </tr>
  665. <tr id="methodLayout" class="subHeader">
  666. <td colspan="2">Layout</td>
  667. </tr>
  668. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSeed', this);">
  669. <td colspan="2"><span parent="getSeed" class="right-caret" id="method_getSeed"></span> getSeed()</td>
  670. </tr>
  671. <tr class="hidden" parent="clusterByHubsize">
  672. </tr>
  673. <tr class="hidden" parent="getSeed">
  674. <td class="midMethods">Returns: Number</td>
  675. <td>If you like the layout of your network and would like it to start in the same way next time, ask for
  676. the
  677. seed using this method and put it in the <code>layout.randomSeed</code> option.
  678. </td>
  679. </tr>
  680. <tr id="methodManipulation" class="subHeader">
  681. <td colspan="2">Manipulation methods to use the manipulation system without GUI.</td>
  682. </tr>
  683. <tr class="collapsible toggle" onclick="toggleTable('methodTable','enableEditMode', this);">
  684. <td colspan="2"><span parent="enableEditMode" class="right-caret" id="method_enableEditMode"></span> enableEditMode()</td>
  685. </tr>
  686. <tr class="hidden" parent="enableEditMode">
  687. <td class="midMethods">Returns: none</td>
  688. <td>Programatically enable the edit mode. Similar effect to pressing the edit button.</td>
  689. </tr>
  690. <tr class="collapsible toggle" onclick="toggleTable('methodTable','disableEditMode', this);">
  691. <td colspan="2"><span parent="disableEditMode" class="right-caret" id="method_disableEditMode"></span> disableEditMode()</td>
  692. </tr>
  693. <tr class="hidden" parent="disableEditMode">
  694. <td class="midMethods">Returns: none</td>
  695. <td>Programatically disable the edit mode. Similar effect to pressing the close icon (small cross in the
  696. corner of the toolbar).
  697. </td>
  698. </tr>
  699. <tr class="collapsible toggle" onclick="toggleTable('methodTable','addNodeMode', this);">
  700. <td colspan="2"><span parent="addNodeMode" class="right-caret" id="method_addNodeMode"></span> addNodeMode()</td>
  701. </tr>
  702. <tr class="hidden" parent="addNodeMode">
  703. <td class="midMethods">Returns: none</td>
  704. <td>Go into addNode mode. Having edit mode or manipulation enabled is not required. To get out of this
  705. mode,
  706. call <code>disableEditMode()</code>. The callback functions defined in <code>handlerFunctions</code>
  707. still apply. To use these methods without having the manipulation GUI, make sure you set
  708. <code>enabled</code> to false.
  709. </td>
  710. </tr>
  711. <tr class="collapsible toggle" onclick="toggleTable('methodTable','editNode', this);">
  712. <td colspan="2"><span parent="editNode" class="right-caret" id="method_editNode"></span> editNode()</td>
  713. </tr>
  714. <tr class="hidden" parent="editNode">
  715. <td class="midMethods">Returns: none</td>
  716. <td>Edit the selected node. The explaination from <code>addNodeMode</code> applies here as well.</td>
  717. </tr>
  718. <tr class="collapsible toggle" onclick="toggleTable('methodTable','addEdgeMode', this);">
  719. <td colspan="2"><span parent="addEdgeMode" class="right-caret" id="method_addEdgeMode"></span> addEdgeMode()</td>
  720. </tr>
  721. <tr class="hidden" parent="addEdgeMode">
  722. <td class="midMethods">Returns: none</td>
  723. <td>Go into addEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
  724. </tr>
  725. <tr class="collapsible toggle" onclick="toggleTable('methodTable','editEdgeMode', this);">
  726. <td colspan="2"><span parent="editEdgeMode" class="right-caret" id="method_editEdgeMode"></span> editEdgeMode()</td>
  727. </tr>
  728. <tr class="hidden" parent="editEdgeMode">
  729. <td class="midMethods">Returns: none</td>
  730. <td>Go into editEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td>
  731. </tr>
  732. <tr class="collapsible toggle" onclick="toggleTable('methodTable','deleteSelected', this);">
  733. <td colspan="2"><span parent="deleteSelected" class="right-caret" id="method_deleteSelected"></span> deleteSelected()</td>
  734. </tr>
  735. <tr class="hidden" parent="deleteSelected">
  736. <td class="midMethods">Returns: none</td>
  737. <td>Delete selected. Having edit mode or manipulation enabled is not required.</td>
  738. </tr>
  739. <tr id="methodInformation" class="subHeader">
  740. <td colspan="2">Methods to get information on nodes and edges.</td>
  741. </tr>
  742. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getPositions', this);">
  743. <td colspan="2"><span parent="getPositions" class="right-caret" id="method_getPositions"></span> getPositions(<code><i>[Array of
  744. nodeIds]</i></code>)
  745. </td>
  746. </tr>
  747. <tr class="hidden" parent="getPositions">
  748. <td class="midMethods">Returns: Object</td>
  749. <td>Returns the x y positions in canvas space of the nodes with the supplied nodeIds as an object:
  750. <pre class="code">
  751. {
  752. nodeId1: {x: xValue, y:yValue},
  753. nodeId2: {x: xValue, y:yValue},
  754. ...
  755. }
  756. </pre>
  757. Alternative inputs are a String containing a nodeId or nothing. When a String is supplied, the
  758. position
  759. of the node corresponding to the ID is returned. When nothing is supplied, the positions of all
  760. nodes
  761. are returned.
  762. </td>
  763. </tr>
  764. <tr class="collapsible toggle" onclick="toggleTable('methodTable','storePositions', this);">
  765. <td colspan="2"><span parent="storePositions" class="right-caret" id="method_storePositions"></span> storePositions()</td>
  766. </tr>
  767. <tr class="hidden" parent="storePositions">
  768. <td class="midMethods">Returns: none</td>
  769. <td>When using the vis.DataSet to load your nodes into the network, this method will put the X and Y
  770. positions of all nodes into that dataset. If you're loading your nodes from a database and have
  771. this dynamically coupled with
  772. the DataSet, you can
  773. use this to stablize your network once, then save the positions in that database through the DataSet
  774. so
  775. the next
  776. time you load the nodes, stabilization will be near instantaneous.
  777. <br><br>
  778. If the nodes are still moving and you're using dynamic smooth edges (which is on by default), you
  779. can
  780. use the option <code>stabilization.onlyDynamicEdges</code> in the <a href="physics.html">physics
  781. module</a>
  782. to improve initialization time.
  783. <br><br>
  784. <b>This method does not support clustering. At the moment it is not possible to cache
  785. positions when using clusters since they cannot be correctly initialized from just the
  786. positions.</b>
  787. </td>
  788. </tr>
  789. <tr class="collapsible toggle" onclick="toggleTable('methodTable','moveNode', this);">
  790. <td colspan="2"><span parent="moveNode" class="right-caret" id="method_moveNode"></span> moveNode(<code><i>nodeId, Number x, Number y</i></code>)</td>
  791. </tr>
  792. <tr class="hidden" parent="moveNode">
  793. <td class="midMethods">Returns: none</td>
  794. <td>You can use this to programatically move a node. <i>The supplied x and y positions have to be in canvas space!</i>
  795. </td>
  796. </tr>
  797. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getBoundingBox', this);">
  798. <td colspan="2"><span parent="getBoundingBox" class="right-caret" id="method_getBoundingBox"></span> getBoundingBox(<code><i>String
  799. nodeId</i></code>)
  800. </td>
  801. </tr>
  802. <tr class="hidden" parent="getBoundingBox">
  803. <td class="midMethods">Returns: Object</td>
  804. <td> Returns a bounding box for the node including label in the format:
  805. <pre class="code">
  806. {
  807. top: Number,
  808. left: Number,
  809. right: Number,
  810. bottom: Number
  811. }
  812. </pre>
  813. These values are in canvas space.
  814. </td>
  815. </tr>
  816. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getConnectedNodes', this);">
  817. <td colspan="2"><span parent="getConnectedNodes" class="right-caret" id="method_getConnectedNodes"></span> getConnectedNodes(<code><i>String
  818. nodeId or edgeId</i></code>)
  819. </td>
  820. </tr>
  821. <tr class="hidden" parent="getConnectedNodes">
  822. <td class="midMethods">Returns: Array</td>
  823. <td>Returns an array of nodeIds of the all the nodes that are directly connected to this node. If you supply an edgeId,
  824. vis will first match the id to nodes. If no match is found, it will search in the edgelist and return an array: <code>[fromId, toId]</code>.</td>
  825. </tr>
  826. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getConnectedEdges', this);">
  827. <td colspan="2"><span parent="getConnectedEdges" class="right-caret" id="method_getConnectedEdges"></span> getConnectedEdges(<code><i>String
  828. nodeId</i></code>)
  829. </td>
  830. </tr>
  831. <tr class="hidden" parent="getConnectedEdges">
  832. <td class="midMethods">Returns: Array</td>
  833. <td>Returns an array of edgeIds of the edges connected to this node.</td>
  834. </tr>
  835. <tr id="methodPhysics" class="subHeader">
  836. <td colspan="2">Physics methods to control when the simulation should run.</td>
  837. </tr>
  838. <tr class="collapsible toggle" onclick="toggleTable('methodTable','startSimulation', this);">
  839. <td colspan="2"><span parent="startSimulation" class="right-caret" id="method_startSimulation"></span> startSimulation()</td>
  840. </tr>
  841. <tr class="hidden" parent="startSimulation">
  842. <td class="midMethods">Returns: none</td>
  843. <td>Start the physics simulation. This is normally done whenever needed and is only really useful if you
  844. stop the simulation yourself and wish to continue it afterwards.
  845. </td>
  846. </tr>
  847. <tr class="collapsible toggle" onclick="toggleTable('methodTable','stopSimulation', this);">
  848. <td colspan="2"><span parent="stopSimulation" class="right-caret" id="method_stopSimulation"></span> stopSimulation()</td>
  849. </tr>
  850. <tr class="hidden" parent="stopSimulation">
  851. <td class="midMethods">Returns: none</td>
  852. <td>This stops the physics simulation and triggers a <code>stabilized</code> event. It can be restarted
  853. by
  854. dragging a node, altering the dataset or calling <code>startSimulation()</code>.
  855. </td>
  856. </tr>
  857. <tr class="collapsible toggle" onclick="toggleTable('methodTable','stabilize', this);">
  858. <td colspan="2"><span parent="stabilize" class="right-caret" id="method_stabilize"></span> stabilize([iterations])</td>
  859. </tr>
  860. <tr class="hidden" parent="stabilize">
  861. <td class="midMethods">Returns: none</td>
  862. <td>You can manually call stabilize at any time. All the stabilization options above are used. You can optionally supply the number of iterations it should do.</td>
  863. </tr>
  864. <tr id="methodSelection" class="subHeader">
  865. <td colspan="2">Selection methods for nodes and edges.</td>
  866. </tr>
  867. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelection', this);">
  868. <td colspan="2"><span parent="getSelection" class="right-caret" id="method_getSelection"></span> getSelection()</td>
  869. </tr>
  870. <tr class="hidden" parent="getSelection">
  871. <td class="midMethods">Returns: Object</td>
  872. <td>Returns an object with selected nodes and edges ids like this:
  873. <pre class="code">
  874. {
  875. nodes: [Array of selected nodeIds],
  876. edges: [Array of selected edgeIds]
  877. }</pre>
  878. </td>
  879. </tr>
  880. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelectedNodes', this);">
  881. <td colspan="2"><span parent="getSelectedNodes" class="right-caret" id="method_getSelectedNodes"></span> getSelectedNodes()</td>
  882. </tr>
  883. <tr class="hidden" parent="getSelectedNodes">
  884. <td class="midMethods">Returns: Array</td>
  885. <td>Returns an array of selected node ids like so:
  886. <code>[nodeId1, nodeId2, ..]</code>.
  887. </td>
  888. </tr>
  889. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getSelectedEdges', this);">
  890. <td colspan="2"><span parent="getSelectedEdges" class="right-caret" id="method_getSelectedEdges"></span> getSelectedEdges()</td>
  891. </tr>
  892. <tr class="hidden" parent="getSelectedEdges">
  893. <td class="midMethods">Returns: Array</td>
  894. <td>Returns an array of selected edge ids like so: <code>[edgeId1, edgeId2, ..]</code>.</td>
  895. </tr>
  896. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getNodeAt', this);">
  897. <td colspan="2"><span parent="getNodeAt" class="right-caret" id="method_getNodeAt"></span> getNodeAt(<code><i>{x: xPosition
  898. DOM, y: yPosition DOM}</i></code>)
  899. </td>
  900. </tr>
  901. <tr class="hidden" parent="getNodeAt">
  902. <td class="midMethods">Returns: String</td>
  903. <td>Returns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left
  904. corner
  905. of the canvas.
  906. </td>
  907. </tr>
  908. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getEdgeAt', this);">
  909. <td colspan="2"><span parent="getEdgeAt" class="right-caret" id="method_getEdgeAt"></span> getEdgeAt(<code><i>{x: xPosition
  910. DOM, y: yPosition DOM}</i></code>)
  911. </td>
  912. </tr>
  913. <tr class="hidden" parent="getEdgeAt">
  914. <td class="midMethods">Returns: String</td>
  915. <td>Returns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left
  916. corner
  917. of the canvas..
  918. </td>
  919. </tr>
  920. <tr class="collapsible toggle" onclick="toggleTable('methodTable','selectNodes', this);">
  921. <td colspan="2"><span parent="selectNodes" class="right-caret" id="method_selectNodes"></span> selectNodes(<code><i>Array with
  922. nodeIds</i></code>,<code><i>[Boolean
  923. highlightEdges]</i></code>)
  924. </td>
  925. </tr>
  926. <tr class="hidden" parent="selectNodes">
  927. <td class="midMethods">Returns: none</td>
  928. <td>Selects the nodes corresponding to the id's in the input array. If highlightEdges is true or
  929. undefined,
  930. the neighbouring edges will also be selected. This method unselects all other objects before
  931. selecting
  932. its own objects. <i>Does not fire events</i>.
  933. </td>
  934. </tr>
  935. <tr class="collapsible toggle" onclick="toggleTable('methodTable','selectEdges', this);">
  936. <td colspan="2"><span parent="selectEdges" class="right-caret" id="method_selectEdges"></span> selectEdges(<code><i>Array with
  937. edgeIds</i></code>)
  938. </td>
  939. </tr>
  940. <tr class="hidden" parent="selectEdges">
  941. <td class="midMethods">Returns: none</td>
  942. <td>Selects the edges corresponding to the id's in the input array. This method unselects all other
  943. objects
  944. before selecting its own objects. <i>Does not fire events</i>.
  945. </td>
  946. </tr>
  947. <tr class="collapsible toggle" onclick="toggleTable('methodTable','setSelection', this);">
  948. <td colspan="2"><span parent="setSelection" class="right-caret" id="method_setSelection"></span> setSelection(
  949. <code>Object selection</code>,
  950. <code>[Object options]</code>)</td>
  951. </tr>
  952. <tr class="hidden" parent="setSelection">
  953. <td class="midMethods">Returns: none</td>
  954. <td>Sets the selection, wich must be an object like this:
  955. <pre class="code">
  956. {
  957. nodes: [Array of nodeIds],
  958. edges: [Array of edgeIds]
  959. }</pre>
  960. You can also pass only <code>nodes</code> or <code>edges</code> in <code>selection</code> object.
  961. Available options are:
  962. <pre class="code">
  963. {
  964. unselectAll: Boolean,
  965. highlightEdges: Boolean
  966. }</pre>
  967. </td>
  968. </tr>
  969. <tr class="collapsible toggle" onclick="toggleTable('methodTable','unselectAll', this);">
  970. <td colspan="2"><span parent="unselectAll" class="right-caret" id="method_unselectAll"></span> unselectAll()</td>
  971. </tr>
  972. <tr class="hidden" parent="unselectAll">
  973. <td class="midMethods">Returns: none</td>
  974. <td>Unselect all objects. <i>Does not fire events</i>.</td>
  975. </tr>
  976. <tr id="methodViewport" class="subHeader">
  977. <td colspan="2">Methods to control the viewport for zoom and animation.</td>
  978. </tr>
  979. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getScale', this);">
  980. <td colspan="2"><span parent="getScale" class="right-caret" id="method_getScale"></span> getScale()</td>
  981. </tr>
  982. <tr class="hidden" parent="getScale">
  983. <td class="midMethods">Returns: Number</td>
  984. <td>Returns the current scale of the network. 1.0 is comparible to 100%, 0 is zoomed out infinitely.
  985. </td>
  986. </tr>
  987. <tr class="collapsible toggle" onclick="toggleTable('methodTable','clusterByHubsize', this);">
  988. <td colspan="2"><span parent="clusterByHubsize" class="right-caret" id="method_getViewPosition"></span> getViewPosition()</td>
  989. </tr>
  990. <tr class="hidden" parent="clusterByHubsize">
  991. <td class="midMethods">Returns: Object</td>
  992. <td>Returns the current central focus point of the view in the form: <code>{ x: {Number}, y: {Number} }</code></td>
  993. </tr>
  994. <tr class="collapsible toggle" onclick="toggleTable('methodTable','fit', this);">
  995. <td colspan="2"><span parent="fit" class="right-caret" id="method_fit"></span> fit(<code>[Object
  996. options]</code>)
  997. </td>
  998. </tr>
  999. <tr class="hidden" parent="fit">
  1000. <td class="midMethods">Returns: none</td>
  1001. <td>Zooms out so all nodes fit on the canvas. You can supply options to customize this:
  1002. <pre class="code">
  1003. {
  1004. nodes:[Array of nodeIds],
  1005. animation: { // -------------------> can be a boolean too!
  1006. duration: Number
  1007. easingFunction: String
  1008. }
  1009. }
  1010. </pre>
  1011. The nodes can be used to zoom to fit only specific nodes in the view. <br/><br/>
  1012. The other options are explained in the <code>moveTo()</code> description below.
  1013. All options are optional for the fit method.
  1014. </td>
  1015. </tr>
  1016. <tr class="collapsible toggle" onclick="toggleTable('methodTable','focus', this);">
  1017. <td colspan="2"><span parent="focus" class="right-caret" id="method_focus"></span> focus(
  1018. <code>String nodeId</code>,
  1019. <code>[Object options]</code>)
  1020. </td>
  1021. </tr>
  1022. <tr class="hidden" parent="focus">
  1023. <td class="midMethods">Returns: none</td>
  1024. <td>You can focus on a node with this function. What that means is the view will lock onto that node, if
  1025. it
  1026. is moving, the view will also move accordingly. If the view is dragged by the user, the focus is
  1027. broken.
  1028. You can supply options to customize the effect:
  1029. <pre class="code">
  1030. {
  1031. scale: Number,
  1032. offset: {x:Number, y:Number}
  1033. locked: boolean
  1034. animation: { // -------------------> can be a boolean too!
  1035. duration: Number
  1036. easingFunction: String
  1037. }
  1038. }
  1039. </pre>
  1040. All options except for locked are explained in the <code>moveTo()</code> description below. Locked
  1041. denotes whether or not the view remains locked to the node once the zoom-in animation is finished.
  1042. Default value is true. The options object is optional in the focus method.
  1043. </td>
  1044. </tr>
  1045. <tr class="collapsible toggle" onclick="toggleTable('methodTable','moveTo', this);">
  1046. <td colspan="2"><span parent="moveTo" class="right-caret" id="method_moveTo"></span> moveTo(<code>Object
  1047. options</code>)
  1048. </td>
  1049. </tr>
  1050. <tr class="hidden" parent="moveTo">
  1051. <td class="midMethods">Returns: none</td>
  1052. <td>You can animate or move the camera using the moveTo method. Options are:
  1053. <pre class="code">
  1054. {
  1055. position: {x:Number, y:Number},
  1056. scale: Number,
  1057. offset: {x:Number, y:Number}
  1058. animation: { // -------------------> can be a boolean too!
  1059. duration: Number
  1060. easingFunction: String
  1061. }
  1062. }
  1063. </pre>
  1064. The position (in canvas units!) is the position of the central focus point of the camera.
  1065. The scale is the target zoomlevel. Default value is 1.0.
  1066. The offset (in DOM units) is how many pixels from the center the view is focussed. Default value is
  1067. {x:0,y:0}.
  1068. For animation you can either use a Boolean to use it with the default options or disable it or you
  1069. can
  1070. define the duration (in milliseconds) and easing function manually. Available are:
  1071. <code>linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic,
  1072. easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint</code>.
  1073. <i>You will have to define at least a scale, position or offset. Otherwise, there is nothing to move
  1074. to.</i>
  1075. </td>
  1076. </tr>
  1077. <tr class="collapsible toggle" onclick="toggleTable('methodTable','releaseNode', this);">
  1078. <td colspan="2"><span parent="releaseNode" class="right-caret" id="method_releaseNode"></span> releaseNode()</td>
  1079. </tr>
  1080. <tr class="hidden" parent="releaseNode">
  1081. <td class="midMethods">Returns: none</td>
  1082. <td>Programatically release the focussed node.</td>
  1083. </tr>
  1084. <tr id="methodConfigurator" class="subHeader">
  1085. <td colspan="2">Methods to use with the configurator module.</td>
  1086. </tr>
  1087. <tr class="collapsible toggle" onclick="toggleTable('methodTable','getOptionsFromConfigurator', this);">
  1088. <td colspan="2"><span parent="getOptionsFromConfigurator" class="right-caret" id="method_getOptionsFromConfigurator"></span> getOptionsFromConfigurator()</td>
  1089. </tr>
  1090. <tr class="hidden" parent="getOptionsFromConfigurator">
  1091. <td class="midMethods">Returns: Object</td>
  1092. <td>If you use the configurator, you can call this method to get an options object that contains all differences from the default options
  1093. caused by users interacting with the configurator.
  1094. </td>
  1095. </tr>
  1096. </table>
  1097. <br>
  1098. <br>
  1099. <h4 id="optionsObject">Cluster methods options object</h4>
  1100. <p>The options object supplied to the cluster functions can contain these properties:</p>
  1101. <table class="methods">
  1102. <tr>
  1103. <th>Name</th>
  1104. <th>Type</th>
  1105. <th>Description</th>
  1106. </tr>
  1107. <tr><td>joinCondition(<br>&nbsp;&nbsp;<code>nodeOptions:&nbsp;Object</code><br>)</td>
  1108. <td>Function</td>
  1109. <td><i>Optional for all but the cluster method. </i> The cluster module loops over all nodes that are
  1110. selected to be in the cluster and calls this function with their data as argument.
  1111. If this function returns true, this node will be added to the cluster. You have access to all
  1112. options
  1113. (including the default)
  1114. as well as any custom fields you may have added to the node to determine whether or not to include
  1115. it in
  1116. the cluster. Example:
  1117. <pre class="prettyprint lang-js">
  1118. var nodes = [
  1119. {id: 4, label: 'Node 4'},
  1120. {id: 5, label: 'Node 5'},
  1121. {id: 6, label: 'Node 6', cid:1},
  1122. {id: 7, label: 'Node 7', cid:1}
  1123. ]
  1124. var options = {
  1125. joinCondition:function(nodeOptions) {
  1126. return nodeOptions.cid === 1;
  1127. }
  1128. }
  1129. network.clustering.cluster(options);
  1130. </pre>
  1131. </td>
  1132. </tr>
  1133. <tr><td>processProperties(<br>&nbsp;&nbsp;<code>clusterOptions:&nbsp;Object</code>,<br>
  1134. &nbsp;&nbsp;<code>childNodesOptions:&nbsp;Array</code>,<br>
  1135. &nbsp;&nbsp;<code>childEdgesOptions:&nbsp;Array</code><br>)</td>
  1136. <td>Function</td>
  1137. <td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with
  1138. the
  1139. properties supplied by you (<code>clusterNodeProperties</code>), all contained nodes and all
  1140. contained
  1141. edges. You can use this to update the
  1142. properties of the cluster based on which items it contains. The function should return the
  1143. properties to
  1144. create the cluster node. In the example below, we ensure preservation of mass and value when forming
  1145. the
  1146. cluster:
  1147. <pre class="prettyprint lang-js">
  1148. var options = {
  1149. processProperties: function (clusterOptions,
  1150. childNodes, childEdges) {
  1151. var totalMass = 0;
  1152. var totalValue = 0;
  1153. for (var i = 0; i < childNodes.length; i++) {
  1154. totalMass += childNodes[i].mass;
  1155. totalValue = childNodes[i].value
  1156. ? totalValue + childNodes[i].value
  1157. : totalValue;
  1158. }
  1159. clusterOptions.mass = totalMass;
  1160. if (totalValue > 0) {
  1161. clusterOptions.value = totalValue;
  1162. }
  1163. return clusterOptions;
  1164. },
  1165. }
  1166. </pre>
  1167. </td>
  1168. </tr>
  1169. <tr><td id="event_clusterNodeProperties">clusterNodeProperties</td>
  1170. <td>Object</td>
  1171. <td><i>Optional. </i> This is an object containing the options for the cluster node. All options
  1172. described
  1173. in the <a href="./nodes.html">nodes module</a> are allowed. This allows you to style your cluster
  1174. node
  1175. any way you want. This is also the style object that is provided in the processProperties function
  1176. for
  1177. fine tuning. If undefined, default node options will be used.
  1178. </td>
  1179. </tr>
  1180. <tr><td id="event_clusterEdgeProperties">clusterEdgeProperties</td>
  1181. <td>Object</td>
  1182. <td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster.
  1183. All
  1184. options described in the <a href="./edges.html">edges module</a> are allowed. Using this, you can
  1185. style
  1186. the edges connecting to the cluster any way you want. If none are provided, the options from the
  1187. edges
  1188. that are replaced are used. If undefined, default edge options will be used.
  1189. </td>
  1190. </tr>
  1191. </table>
  1192. </div>
  1193. <br /><hr />
  1194. <div id="eventsDiv">
  1195. <h2 id="Events">Events</h2>
  1196. <p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
  1197. <p>These events are fired by the interaction module. They are related to user input.</p>
  1198. <table class="events">
  1199. <tr>
  1200. <th>Name</th>
  1201. <th>Properties</th>
  1202. <th>Description</th>
  1203. </tr>
  1204. <tr class="subHeader">
  1205. <td colspan="3">Events triggered by human interaction, selection, dragging etc.</td>
  1206. </tr>
  1207. <tr><td id="event_click">click</td>
  1208. <td>
  1209. Object
  1210. </td>
  1211. <td>Fired when the user clicks the mouse or taps on a touchscreen device. Passes an object with properties structured as:
  1212. <pre class="prettyprint lang-js">{
  1213. nodes: [Array of selected nodeIds],
  1214. edges: [Array of selected edgeIds],
  1215. event: [Object] original click event,
  1216. pointer: {
  1217. DOM: {x:pointer_x, y:pointer_y},
  1218. canvas: {x:canvas_x, y:canvas_y}
  1219. }
  1220. }
  1221. </pre>
  1222. </td>
  1223. </tr>
  1224. <tr><td id="event_doubleClick">doubleClick</td>
  1225. <td>same as <code>click</code>.</td>
  1226. <td>Fired when the user double clicks the mouse or double taps on a touchscreen device. Since a double
  1227. click
  1228. is in fact 2 clicks, 2 click events are fired, followed by a double click event. If you do not want
  1229. to
  1230. use the click events if a double click event is fired, just check the time between click events
  1231. before
  1232. processing them.
  1233. </td>
  1234. </tr>
  1235. <tr><td id="event_oncontext">oncontext</td>
  1236. <td>same as <code>click</code>.</td>
  1237. <td>Fired when the user click on the canvas with the right mouse button. The right mouse button does not
  1238. select by default. You can use the method <code>getNodeAt</code> to select the node if you
  1239. want.
  1240. </td>
  1241. </tr>
  1242. <tr><td id="event_hold">hold</td>
  1243. <td>same as <code>click</code>.</td>
  1244. <td>Fired when the user clicks and holds the mouse or taps and holds on a touchscreen device. A click
  1245. event
  1246. is also fired in this case.
  1247. </td>
  1248. </tr>
  1249. <tr><td id="event_release">release</td>
  1250. <td>same as <code>click</code>.</td>
  1251. <td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.
  1252. </td>
  1253. </tr>
  1254. <tr><td id="event_select">select</td>
  1255. <td>same as <code>click</code>.</td>
  1256. <td>Fired when the selection has changed by user action. This means a node or edge has been selected,
  1257. added
  1258. to the selection or deselected. <b>All select events are only triggered on click and hold</b>.
  1259. </td>
  1260. </tr>
  1261. <tr><td id="event_selectNode">selectNode</td>
  1262. <td>same as <code>click</code>.</td>
  1263. <td>Fired when a node has been selected by the user.</td>
  1264. </tr>
  1265. <tr><td id="event_selectEdge">selectEdge</td>
  1266. <td>same as <code>click</code>.</td>
  1267. <td>Fired when a edge has been selected by the user.</td>
  1268. </tr>
  1269. <tr><td id="event_deselectNode">deselectNode</td>
  1270. <td>Object
  1271. </td>
  1272. <td>Fired when a node (or nodes) has (or have) been deselected by the user. The previous selection is the list of nodes and edges that were selected before the last user event. Passes an object with properties structured as:
  1273. <pre class="prettyprint lang-js">{
  1274. nodes: [Array of selected nodeIds],
  1275. edges: [Array of selected edgeIds],
  1276. event: [Object] original click event,
  1277. pointer: {
  1278. DOM: {x:pointer_x, y:pointer_y},
  1279. canvas: {x:canvas_x, y:canvas_y}
  1280. }
  1281. },
  1282. previousSelection: {
  1283. nodes: [Array of previously selected nodeIds],
  1284. edges: [Array of previously selected edgeIds]
  1285. }
  1286. }
  1287. </pre>
  1288. </td>
  1289. </tr>
  1290. <tr><td id="event_deselectEdge">deselectEdge</td>
  1291. <td>same as <code>deselectNode</code>.</td>
  1292. <td>Fired when a edge (or edges) has (or have) been deselected by the user. The previous selection is
  1293. the
  1294. list of nodes and edges that were selected before the last user event.
  1295. </td>
  1296. </tr>
  1297. <tr><td id="event_dragStart">dragStart</td>
  1298. <td>same as <code>click</code>.</td>
  1299. <td>Fired when starting a drag.</td>
  1300. </tr>
  1301. <tr><td id="event_dragging">dragging</td>
  1302. <td>same as <code>click</code>.</td>
  1303. <td>Fired when dragging node(s) or the view.</td>
  1304. </tr>
  1305. <tr><td id="event_dragEnd">dragEnd</td>
  1306. <td>same as <code>click</code>.</td>
  1307. <td>Fired when the drag has finished.</td>
  1308. </tr>
  1309. <tr><td id="event_hoverNode">hoverNode</td>
  1310. <td><code>{node: nodeId}</code></td>
  1311. <td>Fired if the option <code>interaction:{hover:true}</code> is enabled and the mouse hovers over a node.</td>
  1312. </tr>
  1313. <tr><td id="event_blurNode">blurNode</td>
  1314. <td><code>{node: nodeId}</code></td>
  1315. <td>Fired if the option <code>interaction:{hover:true}</code> is enabled and the mouse moved away from a node it was hovering over before.</td>
  1316. </tr>
  1317. <tr><td id="event_hoverEdge">hoverEdge</td>
  1318. <td><code>{edge: edgeId}</code></td>
  1319. <td>Fired if the option <code>interaction:{hover:true}</code> is enabled and the mouse hovers over an edge.</td>
  1320. </tr>
  1321. <tr><td id="event_blurEdge">blurEdge</td>
  1322. <td><code>{edge: edgeId}</code></td>
  1323. <td>Fired if the option <code>interaction:{hover:true}</code> is enabled and the mouse moved away from an edge it was hovering over before.</td>
  1324. </tr>
  1325. <tr><td id="event_zoom">zoom</td>
  1326. <td><code>{direction:'+'/'-', scale: Number}</code></td>
  1327. <td>Fired when the user zooms in or out. The properties tell you which direction the zoom is in. The scale is a number greater than 0, which is the same that you get with network.getScale().</td>
  1328. </tr>
  1329. <tr><td id="event_showPopup">showPopup</td>
  1330. <td><code>id of item corresponding to popup</code></td>
  1331. <td>Fired when the popup (tooltip) is shown.</td>
  1332. </tr>
  1333. <tr><td id="event_hidePopup">hidePopup</td>
  1334. <td>none</td>
  1335. <td>Fired when the popup (tooltip) is hidden.</td>
  1336. </tr>
  1337. <tr class="subHeader ">
  1338. <td colspan="3">Events triggered the physics simulation. Can be used to trigger GUI updates.</td>
  1339. </tr>
  1340. <tr><td id="event_startStabilizing">startStabilizing</td>
  1341. <td>none</td>
  1342. <td>Fired when stabilization starts. This is also the case when you drag a node and the physics
  1343. simulation
  1344. restarts to stabilize again. Stabilization does not neccesarily imply 'without showing'.
  1345. </td>
  1346. <tr><td id="event_stabilizationProgress">stabilizationProgress</td>
  1347. <td>Object</td>
  1348. <td>Fired when a multiple of the <code>updateInterval</code> number of iterations is reached. This only occurs in the 'hidden' stabilization. Passes an object with properties structured as:
  1349. <pre class="prettyprint lang-js">{
  1350. iterations: Number // iterations so far,
  1351. total: Number // total iterations in options
  1352. }</pre>
  1353. </td>
  1354. </tr>
  1355. <tr><td id="event_stabilizationIterationsDone">stabilizationIterationsDone</td>
  1356. <td>none</td>
  1357. <td>Fired when the 'hidden' stabilization finishes. This does not necessarily mean the network is stabilized; it could also mean that the amount of iterations defined in the options has been reached.
  1358. </td>
  1359. <tr><td id="event_stabilized">stabilized</td>
  1360. <td>Object</td>
  1361. <td>Fired when the network has stabilized or when the <code>stopSimulation()</code> has been called. The amount of iterations it took could be used to tweak the maximum amount of iterations needed to stabilize the network. Passes an object with properties structured as:
  1362. <pre class="prettyprint lang-js">{
  1363. iterations: Number // iterations it took
  1364. }</pre>
  1365. </td>
  1366. <tr class="subHeader">
  1367. <td colspan="3">Event triggered by the canvas.</td>
  1368. </tr>
  1369. <tr><td id="event_resize">resize</td>
  1370. <td>Object</td>
  1371. <td>Fired when the size of the canvas has been resized, either by a redraw call when the container div has changed in size, a setSize() call with new values or a setOptions() with new width and/or height values. Passes an object with properties structured as:
  1372. <pre class="prettyprint lang-js">
  1373. {
  1374. width: Number // the new width of the canvas
  1375. height: Number // the new height of the canvas
  1376. oldWidth: Number // the old width of the canvas
  1377. oldHeight: Number // the old height of the canvas
  1378. }
  1379. </pre>
  1380. </td>
  1381. </tr>
  1382. <tr class="subHeader ">
  1383. <td colspan="3">Events triggered by the rendering module. Can be used to draw custom elements on the
  1384. canvas.
  1385. </td>
  1386. </tr>
  1387. <tr><td id="event_initRedraw">initRedraw</td>
  1388. <td>none</td>
  1389. <td>Fired before the redrawing begins. The simulation step has completed at this point. Can be used to
  1390. move
  1391. custom elements before starting drawing the new frame.
  1392. </td>
  1393. <tr><td id="event_beforeDrawing">beforeDrawing</td>
  1394. <td><code>canvas context</code></td>
  1395. <td>Fired after the canvas has been cleared, scaled and translated to the viewing position but before
  1396. all
  1397. edges and nodes are drawn. Can be used to draw behind the network.
  1398. </td>
  1399. <tr><td id="event_afterDrawing">afterDrawing</td>
  1400. <td><code>canvas context</code></td>
  1401. <td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.
  1402. </td>
  1403. </tr>
  1404. <tr class="subHeader">
  1405. <td colspan="3">Event triggered by the view module.</td>
  1406. </tr>
  1407. <tr><td id="event_animationFinished">animationFinished</td>
  1408. <td>none</td>
  1409. <td>Fired when an animation is finished.</td>
  1410. </tr>
  1411. <tr class="subHeader">
  1412. <td colspan="3">Event triggered by the configuration module.</td>
  1413. </tr>
  1414. <tr><td id="event_configChange">configChange</td>
  1415. <td>Object</td>
  1416. <td>Fired when a user changes any option in the configurator. The options object can be used with the setOptions method or stringified using JSON.stringify().
  1417. You do not have to manually put the options into the network: this is done automatically. You can use the event
  1418. to store user options in the database.
  1419. </td>
  1420. </tr>
  1421. </table>
  1422. </div>
  1423. <br /><hr />
  1424. <div id="importDiv">
  1425. <h2 id="importing_data">Importing data</h2>
  1426. <p>Network contains conversion utilities to import data from <a href="#importGephi">Gephi</a> and graphs in the <a href="#importDot">DOT language</a>.</p>
  1427. <h3 id="importGephi">Import data from Gephi</h3>
  1428. <p>
  1429. Network can import data straight from an exported json file from gephi. You can get the JSON exporter here:
  1430. <a href="https://marketplace.gephi.org/plugin/json-exporter/" target="_blank">https://marketplace.gephi.org/plugin/json-exporter/</a>.
  1431. An example exists showing how to get a JSON file into Vis:
  1432. </p>
  1433. <p>
  1434. Example usage:
  1435. </p>
  1436. <pre class="prettyprint lang-js">
  1437. // load the JSON file containing the Gephi network.
  1438. var gephiJSON = loadJSON("./datasources/WorldCup2014.json"); // code in <a href="http://visjs.org/examples/network/data/importingFromGephi.html">importing_from_gephi</a>.
  1439. // you can customize the result like with these options. These are explained below.
  1440. // These are the default options.
  1441. var parserOptions = {
  1442. edges: {
  1443. inheritColors: false
  1444. },
  1445. nodes: {
  1446. fixed: true,
  1447. parseColor: false
  1448. }
  1449. }
  1450. // parse the gephi file to receive an object
  1451. // containing nodes and edges in vis format.
  1452. var parsed = vis.network.convertGephi(gephiJSON, parserOptions);
  1453. // provide data in the normal fashion
  1454. var data = {
  1455. nodes: parsed.nodes,
  1456. edged: parsed.edges
  1457. };
  1458. // create a network
  1459. var network = new vis.Network(container, data);
  1460. </pre>
  1461. <br>
  1462. <h4>Gephi parser options</h4>
  1463. There are a few options you can use to tell Vis what to do with the data from Gephi.
  1464. <table class="options">
  1465. <tr>
  1466. <th>Name</th>
  1467. <th>Type</th>
  1468. <th>Default</th>
  1469. <th>Description</th>
  1470. </tr>
  1471. <tr><td>nodes.fixed</td>
  1472. <td>Boolean</td>
  1473. <td><code>true</code></td>
  1474. <td>When false, the nodes will move according to the physics model after import. If true, the nodes do
  1475. not move at all. If set to true, the node positions have to be defined to avoid infinite recursion
  1476. errors in the physics.
  1477. </td>
  1478. </tr>
  1479. <tr><td>nodes.parseColor</td>
  1480. <td>Boolean</td>
  1481. <td><code>false</code></td>
  1482. <td>If true, the color will be parsed by the vis parser, generating extra colors for the borders,
  1483. highlighs and hover. If false, the node will be the supplied color.
  1484. </td>
  1485. </tr>
  1486. <tr><td>edges.inheritColor</td>
  1487. <td>Boolean</td>
  1488. <td><code>false</code></td>
  1489. <td>When true, the color supplied by gephi is ignored and the inherit color mode is used with the global
  1490. setting.
  1491. </td>
  1492. </tr>
  1493. </table>
  1494. <h3 id="importDot">Import data in DOT language</h3>
  1495. <p>
  1496. Network supports data in the
  1497. <a href="http://en.wikipedia.org/wiki/DOT_language" target="_blank">DOT language</a>.
  1498. To use data in the DOT language, you can use the vis.network.convertDot converter to transform the DOT
  1499. language
  1500. into a vis.Network compatible nodes, edges and options objects. You can extend the options object with other
  1501. options if you'd like.
  1502. </p>
  1503. <p>
  1504. Example usage:
  1505. </p>
  1506. <pre class="prettyprint lang-js">
  1507. // provide data in the DOT language
  1508. var DOTstring = 'dinetwork {1 -> 1 -> 2; 2 -> 3; 2 -- 4; 2 -> 1 }';
  1509. var parsedData = vis.network.convertDot(DOTstring);
  1510. var data = {
  1511. nodes: parsedData.nodes,
  1512. edges: parsedData.edges
  1513. }
  1514. var options = parsedData.options;
  1515. // you can extend the options like a normal JSON variable:
  1516. options.nodes = {
  1517. color: 'red'
  1518. }
  1519. // create a network
  1520. var network = new vis.Network(container, data, options);
  1521. </pre>
  1522. </div>
  1523. </div>
  1524. <!-- Bootstrap core JavaScript
  1525. ================================================== -->
  1526. <!-- Placed at the end of the document so the pages load faster -->
  1527. <script src="../js/jquery.min.js"></script>
  1528. <script src="../js/bootstrap.min.js"></script>
  1529. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  1530. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  1531. <!-- jquery extensions -->
  1532. <script src="../js/jquery.highlight.js"></script>
  1533. <script src="../js/jquery.url.min.js"></script>
  1534. <!-- Tipue vendor js -->
  1535. <script src="../js/tipuesearch.config.js"></script>
  1536. <script src="../js/tipuesearch.js"></script>
  1537. <!-- controller -->
  1538. <script src="../js/main.js"></script>