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.

622 lines
29 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <script>(function (i, s, o, g, r, a, m) {
  5. i['GoogleAnalyticsObject'] = r;
  6. i[r] = i[r] || function () {
  7. (i[r].q = i[r].q || []).push(arguments)
  8. }, i[r].l = 1 * new Date();
  9. a = s.createElement(o), m = s.getElementsByTagName(o)[0];
  10. a.async = 1;
  11. a.src = g;
  12. m.parentNode.insertBefore(a, m)
  13. })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
  14. ga('create', 'UA-61231638-1', 'auto');
  15. ga('send', 'pageview');</script>
  16. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  17. <meta charset="utf-8">
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  19. <meta name="viewport" content="width=device-width, initial-scale=1">
  20. <meta name="description" content="">
  21. <meta name="author" content="">
  22. <link rel="icon" HREF="favicon.ico">
  23. <title>vis.js - A dynamic, browser based visualization library.</title>
  24. <!-- Bootstrap core CSS -->
  25. <link href="../css/bootstrap.css" rel="stylesheet">
  26. <link href="../css/newdocs.css" rel="stylesheet">
  27. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  28. <!--[if lt IE 9]>
  29. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  30. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  31. <![endif]-->
  32. <script src="../js/smooth-scroll.min.js"></script>
  33. <script language="JavaScript">
  34. smoothScroll.init();
  35. </script>
  36. <script type="text/javascript" src="../js/toggleTable.js"></script>
  37. </head>
  38. <!-- NAVBAR
  39. ================================================== -->
  40. <body>
  41. <div class="navbar-wrapper">
  42. <div class="container">
  43. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  44. <div class="container">
  45. <div class="navbar-header">
  46. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  47. aria-expanded="false" aria-controls="navbar">
  48. <span class="sr-only">Toggle navigation</span>
  49. <span class="icon-bar"></span>
  50. <span class="icon-bar"></span>
  51. <span class="icon-bar"></span>
  52. </button>
  53. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  54. </div>
  55. <div id="navbar" class="navbar-collapse collapse">
  56. <ul class="nav navbar-nav">
  57. <li><a href="../index.html#modules">Modules</a></li>
  58. <li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon"
  59. src="../img/external-link-icons/external-link-icon-white.png"></a>
  60. </li>
  61. <li><a href="../blog.html">Blog</a></li>
  62. <li><a href="../index.html#download_install">Download</a></li>
  63. <li><a href="../showcase/index.html">Showcase</a></li>
  64. <li><a href="../index.html#contribute">Contribute</a></li>
  65. <li><a href="../featureRequests.html">Feature requests</a></li>
  66. <li><a href="../index.html#licenses">License</a></li>
  67. </ul>
  68. </div>
  69. </div>
  70. </nav>
  71. </div>
  72. </div>
  73. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img
  74. style="position: absolute; top: 0; right: 0; border: 0;"
  75. src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
  76. alt="Fork me on GitHub"
  77. data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  78. <div class="container full">
  79. <h1>Network - nodes</h1>
  80. <p>Handles the creation and deletion of nodes and contains the global node options and styles.</p>
  81. <h3>Options</h3>
  82. <p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
  83. <table class="moduleTable" id="optionTable">
  84. <tr class="header">
  85. <td class="name">name</td>
  86. <td class="type">type</td>
  87. <td class="default">default</td>
  88. <td class="description">description</td>
  89. </tr>
  90. <tr>
  91. <td>borderWidth</td>
  92. <td class="mid">Number</td>
  93. <td class="mid"><code>1</code></td>
  94. <td>The width of the border of the node.</td>
  95. </tr>
  96. <tr>
  97. <td>borderWidthSelected</td>
  98. <td class="mid">Number</td>
  99. <td class="mid"><code>undefined</code></td>
  100. <td>The width of the border of the node when it is selected. When undefined, the borderWidth is used</td>
  101. </tr>
  102. <tr>
  103. <td>brokenImage</td>
  104. <td class="mid">String</td>
  105. <td class="mid"><code>undefined</code></td>
  106. <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option can be an URL to
  107. a backup image in case the URL supplied in the image option cannot be resolved.
  108. </td>
  109. </tr>
  110. <tr class='toggle collapsible' onclick="toggleTable('optionTable','color', this);">
  111. <td><span parent="color" class="right-caret"></span> color</td>
  112. <td class="mid">Object or String</td>
  113. <td class="mid"><code>Object</code></td>
  114. <td>The color object contains the color information of the node in every situation. When the node only needs
  115. a single color, a color value like <code>'rgba(120,32,14,1)'</code>, <code>'#ffffff'</code> or <code>'red'</code>
  116. can be supplied instead of an object.
  117. </td>
  118. </tr>
  119. <tr parent="color" class="hidden">
  120. <td class="indent">color.border</td>
  121. <td class="mid">String</td>
  122. <td class="mid"><code>'#2B7CE9'</code></td>
  123. <td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is
  124. enabled in the interaction module)</i>.
  125. </td>
  126. </tr>
  127. <tr parent="color" class="hidden">
  128. <td class="indent">color.background</td>
  129. <td class="mid">String</td>
  130. <td class="mid"><code>'#D2E5FF'</code></td>
  131. <td>The color of the background of the node when it is not selected or hovered over <i>(assuming hover is
  132. enabled in the interaction module)</i>.
  133. </td>
  134. </tr>
  135. <tr parent="color" class="hidden">
  136. <td class="indent">color.highlight</td>
  137. <td class="mid">Object or String</td>
  138. <td class="mid"><code>Object</code></td>
  139. <td>The color the node when it is selected. Alternatively you can just supply a string color value.</td>
  140. </tr>
  141. <tr parent="color" class="hidden">
  142. <td class="indent2">color.highlight.border</td>
  143. <td class="mid">String</td>
  144. <td class="mid"><code>'#2B7CE9'</code></td>
  145. <td>The color of the border of the node when it is selected.</td>
  146. </tr>
  147. <tr parent="color" class="hidden">
  148. <td class="indent2">color.highlight.background</td>
  149. <td class="mid">String</td>
  150. <td class="mid"><code>'#D2E5FF'</code></td>
  151. <td>The color of the background of the node when it is selected.</td>
  152. </tr>
  153. <tr parent="color" class="hidden">
  154. <td class="indent">color.hover</td>
  155. <td class="mid">Object or String</td>
  156. <td class="mid"><code>Object</code></td>
  157. <td>The color the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction
  158. module)</i>. Shorthand like above is also supported.
  159. </td>
  160. </tr>
  161. <tr parent="color" class="hidden">
  162. <td class="indent2">color.hover.border</td>
  163. <td class="mid">String</td>
  164. <td class="mid"><code>'#2B7CE9'</code></td>
  165. <td>The color of the border of the node when the mouse hovers over it <i>(assuming hover is enabled in the
  166. interaction module)</i>.
  167. </td>
  168. </tr>
  169. <tr parent="color" class="hidden">
  170. <td class="indent2">color.hover.background</td>
  171. <td class="mid">String</td>
  172. <td class="mid"><code>'#D2E5FF'</code></td>
  173. <td>The color of the background of the node when the mouse hovers over it <i>(assuming hover is enabled in
  174. the interaction module)</i>.
  175. </td>
  176. </tr>
  177. <tr class='toggle collapsible' onclick="toggleTable('optionTable','fixed', this);">
  178. <td><span parent="fixed" class="right-caret"></span> fixed</td>
  179. <td class="mid">Object or Boolean</td>
  180. <td class="mid"><code>Object</code></td>
  181. <td>When true, the node will not move but IS part of the physics simulation. When defined as an object,
  182. movement in either X or Y direction can be disabled.
  183. </td>
  184. </tr>
  185. <tr parent="fixed" class="hidden">
  186. <td class="indent">fixed.x</td>
  187. <td class="mid">Boolean</td>
  188. <td class="mid"><code>false</code></td>
  189. <td>When true, the node will not move in the X direction.</td>
  190. </tr>
  191. <tr parent="fixed" class="hidden">
  192. <td class="indent">fixed.y</td>
  193. <td class="mid">Boolean</td>
  194. <td class="mid"><code>false</code></td>
  195. <td>When true, the node will not move in the Y direction.</td>
  196. </tr>
  197. <tr class='toggle collapsible' onclick="toggleTable('optionTable','font', this);">
  198. <td><span parent="font" class="right-caret"></span> font</td>
  199. <td class="mid">Object or String</td>
  200. <td class="mid"><code>false</code></td>
  201. <td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face
  202. color'</code> for example: <code>'14px arial red'</code>.
  203. </td>
  204. </tr>
  205. <tr parent="font" class="hidden">
  206. <td class="indent">font.color</td>
  207. <td class="mid">String</td>
  208. <td class="mid"><code>'#343434'</code></td>
  209. <td>Color of the label text.</td>
  210. </tr>
  211. <tr parent="font" class="hidden">
  212. <td class="indent">font.size</td>
  213. <td class="mid">Number</td>
  214. <td class="mid"><code>14</code></td>
  215. <td>Size of the label text.</td>
  216. </tr>
  217. <tr parent="font" class="hidden">
  218. <td class="indent">font.face</td>
  219. <td class="mid">String</td>
  220. <td class="mid"><code>'arial'</code></td>
  221. <td>Font face (or font family) of the label text.</td>
  222. </tr>
  223. <tr parent="font" class="hidden">
  224. <td class="indent">font.background</td>
  225. <td class="mid">String</td>
  226. <td class="mid"><code>undefined</code></td>
  227. <td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind
  228. the label in the supplied color.
  229. </td>
  230. </tr>
  231. <tr parent="font" class="hidden">
  232. <td class="indent">font.stroke</td>
  233. <td class="mid">Number</td>
  234. <td class="mid"><code>0</code></td>
  235. <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value
  236. higher than 0 is supplied, the stroke will be drawn.
  237. </td>
  238. </tr>
  239. <tr parent="font" class="hidden">
  240. <td class="indent">font.strokeColor</td>
  241. <td class="mid">String</td>
  242. <td class="mid"><code>'#ffffff'</code></td>
  243. <td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td>
  244. </tr>
  245. <tr>
  246. <td>group</td>
  247. <td class="mid">String</td>
  248. <td class="mid"><code>undefined</code></td>
  249. <td>When not <code>undefined</code>, the</td>
  250. </tr>
  251. <tr>
  252. <td>hidden</td>
  253. <td class="mid">Boolean</td>
  254. <td class="mid"><code>false</code></td>
  255. <td>When true, the node will not be shown. It will still be part of the physics simulation though!</td>
  256. </tr>
  257. <tr class='toggle collapsible' onclick="toggleTable('optionTable','icon', this);">
  258. <td><span parent="icon" class="right-caret"></span> icon</td>
  259. <td class="mid">Object</td>
  260. <td class="mid"><code>Object</code></td>
  261. <td>These options are only used when the shape is set to <code>icon</code>.</td>
  262. </tr>
  263. <tr parent="icon" class="hidden">
  264. <td class="indent">icon.face</td>
  265. <td class="mid">String</td>
  266. <td class="mid"><code>'FontAwesome'</code></td>
  267. <td>These options are only used when the shape is set to <code>icon</code>. The possible options for the
  268. face are: <code>'FontAwesome'</code> and <code>'Ionicons'</code>.
  269. </td>
  270. </tr>
  271. <tr parent="icon" class="hidden">
  272. <td class="indent">icon.code</td>
  273. <td class="mid">String</td>
  274. <td class="mid"><code>undefined</code></td>
  275. <td>This is the code of the icon, for example <code>'\uf007'</code>.</td>
  276. </tr>
  277. <tr parent="icon" class="hidden">
  278. <td class="indent">icon.size</td>
  279. <td class="mid">Number</td>
  280. <td class="mid"><code>50</code></td>
  281. <td>The size of the icon.</td>
  282. </tr>
  283. <tr parent="icon" class="hidden">
  284. <td class="indent">icon.color</td>
  285. <td class="mid">String</td>
  286. <td class="mid"><code>'#2B7CE9'</code></td>
  287. <td>The color of the icon.</td>
  288. </tr>
  289. <tr>
  290. <td>image</td>
  291. <td class="mid">String</td>
  292. <td class="mid"><code>undefined</code></td>
  293. <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option should be the URL
  294. to an image. If the image cannot be found, the brokenImage option can be used.
  295. </td>
  296. </tr>
  297. <tr>
  298. <td>label</td>
  299. <td class="mid">String</td>
  300. <td class="mid"><code>undefined</code></td>
  301. <td>The label is the piece of text shown in or under the node, depending on the shape.</td>
  302. </tr>
  303. <tr>
  304. <td>level</td>
  305. <td class="mid">Number</td>
  306. <td class="mid"><code>undefined</code></td>
  307. <td>When using the hierarchical layout, the level determines where the node is going to be positioned.</td>
  308. </tr>
  309. <tr>
  310. <td>mass</td>
  311. <td class="mid">Number</td>
  312. <td class="mid"><code>1</code></td>
  313. <td>The barnesHut physics model (which is enabled by default) is based on an inverted gravity model. By
  314. increasing the mass of a node, you increase it's repulsion. Values lower than 1 are not recommended.
  315. </td>
  316. </tr>
  317. <tr>
  318. <td>physics</td>
  319. <td class="mid">Boolean</td>
  320. <td class="mid"><code>true</code></td>
  321. <td>When false, the node is not part of the physics simulation. It will not move except for from manual
  322. dragging.
  323. </td>
  324. </tr>
  325. <tr class='toggle collapsible' onclick="toggleTable('optionTable','scaling', this);">
  326. <td><span parent="scaling" class="right-caret"></span> scaling</td>
  327. <td class="mid">Object</td>
  328. <td class="mid"><code>Object</code></td>
  329. <td>If the <code>value</code> option is specified, the size of the nodes will be scaled according to the
  330. properties in this object. All node shapes can be scaled, but some only when label scaling is enabled as
  331. their size is based on the size of the label.
  332. Only scalable when label scaling is enabled are:
  333. <code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
  334. Always scalable are:
  335. <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
  336. <code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and
  337. <code>icon</code>. Keep in mind that when using scaling, the <code>size</code> option is neglected.
  338. </td>
  339. </tr>
  340. <tr parent="scaling" class="hidden">
  341. <td class="indent">scaling.min</td>
  342. <td class="mid">Number</td>
  343. <td class="mid"><code>10</code></td>
  344. <td>If nodes have a value, their sizes are determined by the value, the scaling function and the min max
  345. values. The min value is the minimum allowed value.
  346. </td>
  347. </tr>
  348. <tr parent="scaling" class="hidden">
  349. <td class="indent">scaling.max</td>
  350. <td class="mid">Number</td>
  351. <td class="mid"><code>30</code></td>
  352. <td>This is the maximum allowed size when the nodes are scaled using the value option.</td>
  353. </tr>
  354. <tr parent="scaling" class="hidden">
  355. <td class="indent">scaling.label</td>
  356. <td class="mid">Object or Boolean</td>
  357. <td class="mid"><code>Object</code></td>
  358. <td>This can be false if the label is not allowed to scale with the node. If true it will scale using
  359. default settigns. For further customization, you can supply an object.
  360. </td>
  361. </tr>
  362. <tr parent="scaling" class="hidden">
  363. <td class="indent2">scaling.label.enabled</td>
  364. <td class="mid">Boolean</td>
  365. <td class="mid"><code>false</code></td>
  366. <td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of
  367. the properties in this object are defined.
  368. </td>
  369. </tr>
  370. <tr parent="scaling" class="hidden">
  371. <td class="indent2">scaling.label.min</td>
  372. <td class="mid">Number</td>
  373. <td class="mid"><code>14</code></td>
  374. <td>The minimum font-size used for labels when scaling.</td>
  375. </tr>
  376. <tr parent="scaling" class="hidden">
  377. <td class="indent2">scaling.label.max</td>
  378. <td class="mid">Number</td>
  379. <td class="mid"><code>30</code></td>
  380. <td>The maximum font-size used for labels when scaling.</td>
  381. </tr>
  382. <tr parent="scaling" class="hidden">
  383. <td class="indent2">scaling.label.maxVisible</td>
  384. <td class="mid">Number</td>
  385. <td class="mid"><code>30</code></td>
  386. <td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this
  387. option. If set to 30, the font will never look larger than size 30 zoomed at 100%.
  388. </td>
  389. </tr>
  390. <tr parent="scaling" class="hidden">
  391. <td class="indent2">scaling.label.drawThreshold</td>
  392. <td class="mid">Number</td>
  393. <td class="mid"><code>3</code></td>
  394. <td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn.
  395. When using font scaling, you can use this together with the maxVisible to first show labels of important
  396. nodes when zoomed out and only show the rest when zooming in.
  397. </td>
  398. </tr>
  399. <tr parent="scaling" class="hidden">
  400. <td class="indent">scaling.customScalingFunction</td>
  401. <td class="mid">Function</td>
  402. <td class="mid">in description</td>
  403. <td>If nodes have <code>value</code> fields, this function determines how the size of the nodes are scaled
  404. based on their values. The default function is:
  405. <pre>
  406. function (min,max,total,value) {
  407. if (max === min) {
  408. return 0.5;
  409. }
  410. else {
  411. var scale = 1 / (max - min);
  412. return Math.max(0,(value - min)*scale);
  413. }
  414. }
  415. </pre>
  416. The function receives the minimum value of the set, the maximum value, the total sum of all values and
  417. finally the value of the node or edge it works on. <b>It has to return a value between 0 and 1.</b> The
  418. nodes and edges then calculate their size as follows:
  419. <pre>
  420. var scale = customScalingFunction(min,max,total,value);
  421. var diff = maxSize - minSize;
  422. mySize = minSize + diff * scale;
  423. </pre>
  424. </td>
  425. </tr>
  426. <tr class='toggle collapsible' onclick="toggleTable('optionTable','shadow', this);">
  427. <td><span parent="shadow" class="right-caret"></span> shadow</td>
  428. <td class="mid">Object or Boolean</td>
  429. <td class="mid"><code>Object</code></td>
  430. <td>When true, the node casts a shadow using the default settings. This can be further refined by supplying
  431. an object.
  432. </td>
  433. </tr>
  434. <tr parent="shadow" class="hidden">
  435. <td class="indent">shadow.enabled</td>
  436. <td class="mid">Boolean</td>
  437. <td class="mid"><code>false</code></td>
  438. <td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties
  439. in this object are defined.
  440. </td>
  441. </tr>
  442. <tr parent="shadow" class="hidden">
  443. <td class="indent">shadow.size</td>
  444. <td class="mid">Number</td>
  445. <td class="mid"><code>10</code></td>
  446. <td>The blur size of the shadow.</td>
  447. </tr>
  448. <tr parent="shadow" class="hidden">
  449. <td class="indent">shadow.x</td>
  450. <td class="mid">Number</td>
  451. <td class="mid"><code>5</code></td>
  452. <td>The x offset.</td>
  453. </tr>
  454. <tr parent="shadow" class="hidden">
  455. <td class="indent">shadow.y</td>
  456. <td class="mid">Number</td>
  457. <td class="mid"><code>5</code></td>
  458. <td>The y offset.</td>
  459. </tr>
  460. <tr>
  461. <td>shape</td>
  462. <td class="mid">String</td>
  463. <td class="mid"><code>'ellipse'</code></td>
  464. <td>The shape defines what the node looks like. There are two types of nodes. One type has the label inside
  465. of it and the other type has the label underneath it. The types with the label inside of it are:
  466. <code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
  467. The ones with the label outside of it are: <code>image</code>, <code>circularImage</code>,
  468. <code>diamond</code>, <code>dot</code>, <code>star</code>, <code>triangle</code>,
  469. <code>triangleDown</code>, <code>square</code> and <code>icon</code>.
  470. </td>
  471. </tr>
  472. <tr>
  473. <td>size</td>
  474. <td class="mid">Number</td>
  475. <td class="mid"><code>25</code></td>
  476. <td>The size is used to determine the size of node shapes that do not have the label inside of them. These
  477. shapes are: <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
  478. <code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and
  479. <code>icon</code></td>
  480. </tr>
  481. <tr>
  482. <td>title</td>
  483. <td class="mid">String or Element</td>
  484. <td class="mid"><code>undefined</code></td>
  485. <td>Title to be displayed when the user hovers over the node. The title can be an HTML element or a string
  486. containing plain text or HTML.
  487. </td>
  488. </tr>
  489. <tr>
  490. <td>value</td>
  491. <td class="mid">Number</td>
  492. <td class="mid"><code>undefined</code></td>
  493. <td>When a value is set, the nodes will be scaled using the options in the scaling object defined above.
  494. </td>
  495. </tr>
  496. <tr>
  497. <td>x</td>
  498. <td class="mid">Number</td>
  499. <td class="mid"><code>undefined</code></td>
  500. <td>This gives a node an initial x position. When using the hierarchical layout, either the x or y position
  501. is set by the layout engine depending on the type of view. The other value remains untouched. When using
  502. stabilization, the stabilized position may be different from the initial one. To lock the node to that
  503. position use the physics or fixed options.
  504. </td>
  505. </tr>
  506. <tr>
  507. <td>y</td>
  508. <td class="mid">Number</td>
  509. <td class="mid"><code>undefined</code></td>
  510. <td>This gives a node an initial y position. When using the hierarchical layout, either the x or y position
  511. is set by the layout engine depending on the type of view. The other value remains untouched. When using
  512. stabilization, the stabilized position may be different from the initial one. To lock the node to that
  513. position use the physics or fixed options.
  514. </td>
  515. </tr>
  516. </table>
  517. <h3>Methods</h3>
  518. <p>The nodes module has no methods.</p>
  519. <table class="moduleTable">
  520. <tr class="header">
  521. <td class="methodName">name</td>
  522. <td>returns</td>
  523. <td>description</td>
  524. </tr>
  525. <tr>
  526. <td>getPositions(<br>&nbsp;&nbsp;&nbsp;<code><i>[Array of nodeIds]</i></code><br>)</td>
  527. <td class="mid">Object</td>
  528. <td>Returns the x y positions in canvas space of the nodes with the supplied nodeIds as an object:
  529. <pre class="code">
  530. {
  531. nodeId1: {x: xValue, y:yValue},
  532. nodeId2: {x: xValue, y:yValue},
  533. ...
  534. }
  535. </pre>
  536. Alternative inputs are a String containing a nodeId or nothing. When a String is supplied, the position
  537. of the node corresponding to the ID is returned. When nothing is supplied, the positions of all nodes
  538. are returned.
  539. </td>
  540. </tr>
  541. <tr>
  542. <td>storePositions()</td>
  543. <td class="mid">none</td>
  544. <td>When using the vis.DataSet to load your nodes into the network, this method will put the X and Y
  545. positions of all nodes into that dataset. <br><br> If you're loading your nodes from a database and have
  546. this dynamically coupled with
  547. the DataSet, you can
  548. use this to stablize your network once, then save the positions in that database through the DataSet so
  549. the next
  550. time you load the nodes, stabilization will be near instantaneous.<br><br>
  551. If the nodes are still moving and you're using dynamic smooth edges (which is on by default), you can
  552. use the option <code>stabilization.onlyDynamicEdges</code> in the <a href="physics.html">physics
  553. module</a>
  554. to improve initialization time.
  555. </td>
  556. </tr>
  557. <tr>
  558. <td>getBoundingBox(<br>&nbsp;&nbsp;&nbsp;<code><i>String nodeId</i></code><br>)</td>
  559. <td class="mid">Object</td>
  560. <td> Returns a bounding box for the node including label in the format:
  561. <pre class="code">
  562. {
  563. top: Number,
  564. left: Number,
  565. right: Number,
  566. bottom: Number
  567. }
  568. </pre>
  569. These values are in canvas space.
  570. </td>
  571. </tr>
  572. <tr>
  573. <td>getConnectedNodes(<br>&nbsp;&nbsp;&nbsp;<code><i>String nodeId</i></code><br>)</td>
  574. <td class="mid">Array</td>
  575. <td>Returns an array of nodeIds of the all the nodes that are directly connected to this node.</td>
  576. </tr>
  577. <tr>
  578. <td>getEdges(<br>&nbsp;&nbsp;&nbsp;<code><i>String nodeId</i></code><br>)</td>
  579. <td class="mid">Array</td>
  580. <td>Returns an array of edgeIds of the edges connected to this node.</td>
  581. </tr>
  582. </table>
  583. <h3>Events</h3>
  584. <p>The nodes module emits no events. Click and select events are emitted from the interaction and selection
  585. modules.</p>
  586. <br/>
  587. <br/>
  588. <br/>
  589. <br/>
  590. <br/>
  591. <br/>
  592. <br/>
  593. </div>
  594. <!-- Bootstrap core JavaScript
  595. ================================================== -->
  596. <!-- Placed at the end of the document so the pages load faster -->
  597. <script src="../js/jquery.min.js"></script>
  598. <script src="../js/bootstrap.min.js"></script>
  599. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  600. <script src="../js/ie10-viewport-bug-workaround.js"></script>