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.

1047 lines
48 KiB

9 years ago
9 years ago
  1. <?js
  2. var self = this;
  3. ?>
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="utf-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <meta name="description" content="">
  11. <meta name="author" content="">
  12. <link rel="icon" HREF="favicon.ico">
  13. <title>vis.js - Nodes documentation.</title>
  14. <!-- Bootstrap core CSS -->
  15. <link href="../css/bootstrap.css" rel="stylesheet">
  16. <!-- Tipue vendor css -->
  17. <link href="../css/tipuesearch.css" rel="stylesheet">
  18. <link href="../css/style.css" rel="stylesheet">
  19. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  20. <!--[if lt IE 9]>
  21. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  22. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  23. <![endif]-->
  24. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  25. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  26. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  27. <script src="../js/smooth-scroll.min.js"></script>
  28. <script language="JavaScript">
  29. smoothScroll.init();
  30. </script>
  31. <script type="text/javascript" src="../js/toggleTable.js"></script>
  32. </head>
  33. <body onload="prettyPrint();">
  34. <?js= self.partial('tmpl/navbar.tmpl') ?>
  35. <div class="container full">
  36. <h1>Network - nodes</h1>
  37. <p>Handles the creation and deletion of nodes and contains the global node options and styles.</p>
  38. <h3>Options</h3>
  39. <p>The options for the nodes have to be contained in an object titled 'nodes'. All of these options can be supplied per node as well. Obviously, 'id' should not be defined globally but per node. Options defined
  40. in the global nodes object, are applied to all nodes. If a node has options of its own, those will be used instead of the global options.</p>
  41. <p><b><i>When you have given a node an option, you will override the global option for that property, and also the group option for that property if the node is in a group. If you then set that option to <code>null</code>,
  42. it will revert back to the default value.</i></b>
  43. </p>
  44. <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
  45. <ul class="nav nav-tabs">
  46. <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
  47. <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
  48. <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
  49. </ul>
  50. <br>
  51. <pre class="prettyprint lang-js options top hidden" id="fullOptions">
  52. // these are all options in full.
  53. var options = {
  54. nodes:{
  55. borderWidth: 1,
  56. borderWidthSelected: 2,
  57. brokenImage:undefined,
  58. chosen: true,
  59. color: {
  60. border: '#2B7CE9',
  61. background: '#97C2FC',
  62. highlight: {
  63. border: '#2B7CE9',
  64. background: '#D2E5FF'
  65. },
  66. hover: {
  67. border: '#2B7CE9',
  68. background: '#D2E5FF'
  69. }
  70. },
  71. fixed: {
  72. x:false,
  73. y:false
  74. },
  75. font: {
  76. color: '#343434',
  77. size: 14, // px
  78. face: 'arial',
  79. background: 'none',
  80. strokeWidth: 0, // px
  81. strokeColor: '#ffffff',
  82. align: 'center',
  83. multi: false,
  84. vadjust: 0,
  85. bold: {
  86. color: '#343434',
  87. size: 14, // px
  88. face: 'arial',
  89. vadjust: 0,
  90. mod: 'bold'
  91. },
  92. ital: {
  93. color: '#343434',
  94. size: 14, // px
  95. face: 'arial',
  96. vadjust: 0,
  97. mod: 'italic',
  98. },
  99. boldital: {
  100. color: '#343434',
  101. size: 14, // px
  102. face: 'arial',
  103. vadjust: 0,
  104. mod: 'bold italic'
  105. },
  106. mono: {
  107. color: '#343434',
  108. size: 15, // px
  109. face: 'courier new',
  110. vadjust: 2,
  111. mod: ''
  112. }
  113. },
  114. group: undefined,
  115. heightConstraint: false,
  116. hidden: false,
  117. icon: {
  118. face: 'FontAwesome',
  119. code: undefined,
  120. size: 50, //50,
  121. color:'#2B7CE9'
  122. },
  123. image: undefined,
  124. label: undefined,
  125. labelHighlightBold: true,
  126. level: undefined,
  127. mass: 1,
  128. physics: true,
  129. scaling: {
  130. min: 10,
  131. max: 30,
  132. label: {
  133. enabled: false,
  134. min: 14,
  135. max: 30,
  136. maxVisible: 30,
  137. drawThreshold: 5
  138. },
  139. customScalingFunction: function (min,max,total,value) {
  140. if (max === min) {
  141. return 0.5;
  142. }
  143. else {
  144. let scale = 1 / (max - min);
  145. return Math.max(0,(value - min)*scale);
  146. }
  147. }
  148. },
  149. shadow:{
  150. enabled: false,
  151. color: 'rgba(0,0,0,0.5)',
  152. size:10,
  153. x:5,
  154. y:5
  155. },
  156. shape: 'ellipse',
  157. shapeProperties: {
  158. borderDashes: false, // only for borders
  159. borderRadius: 6, // only for box shape
  160. interpolation: false, // only for image and circularImage shapes
  161. useImageSize: false, // only for image and circularImage shapes
  162. useBorderWithImage: false // only for image shape
  163. }
  164. size: 25,
  165. title: undefined,
  166. value: undefined,
  167. widthConstraint: false,
  168. x: undefined,
  169. y: undefined
  170. }
  171. }
  172. network.setOptions(options);
  173. </pre>
  174. <pre class="prettyprint lang-js options top hidden" id="shortOptions">
  175. // only the options that have shorthand notations are shown.
  176. var options = {
  177. nodes:{
  178. color: '#ff0000',
  179. fixed: false,
  180. font: '12px arial red',
  181. scaling: {
  182. label: true
  183. },
  184. shadow: true
  185. }
  186. }
  187. network.setOptions(options);
  188. </pre>
  189. <p>These options can also be set per individual node. All of the individual options are explained here:</p>
  190. <table class="options" id="optionTable">
  191. <tr>
  192. <th>Name</th>
  193. <th>Type</th>
  194. <th>Default</th>
  195. <th>Description</th>
  196. </tr>
  197. <tr>
  198. <td>borderWidth</td>
  199. <td>Number</td>
  200. <td><code>1</code></td>
  201. <td>The width of the border of the node.</td>
  202. </tr>
  203. <tr>
  204. <td>borderWidthSelected</td>
  205. <td>Number</td>
  206. <td><code>2</code></td>
  207. <td>The width of the border of the node when it is selected. When undefined, the borderWidth * 2 is used.</td>
  208. </tr>
  209. <tr>
  210. <td>brokenImage</td>
  211. <td>String</td>
  212. <td><code>undefined</code></td>
  213. <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option can be an URL to
  214. a backup image in case the URL supplied in the image option cannot be resolved.
  215. </td>
  216. </tr>
  217. <tr class='toggle collapsible' onclick="toggleTable('optionTable','chosen', this);">
  218. <td><span parent="chosen" class="right-caret"></span> chosen</td>
  219. <td>Object or Boolean</td>
  220. <td><code>true</code></td>
  221. <td>
  222. When true, selecting or hovering on a node will change it and its label's characteristics according the default.
  223. When false, no change to the node or its label will occur when the node is chosen.
  224. If an object is supplied, finer-grained adjustment of node and label characteristics is available when a node is chosen.
  225. </td>
  226. </tr>
  227. <tr parent="chosen" class="hidden">
  228. <td class="indent">chosen.node</td>
  229. <td>Function or Boolean</td>
  230. <td>undefined</td>
  231. <td>
  232. When true, selecting or hovering on a node will change its characteristics according the default.
  233. When false, no change to the node will occur when the node is chosen.
  234. <p>
  235. If a function is supplied, it is called when the node is chosen.
  236. <pre class="code">
  237. function(values, id, selected, hovering) {
  238. values.<i>property</i> = <i>chosenValue</i>;
  239. }</pre>
  240. </p>
  241. <p>
  242. Any of the incoming arguments may be used to determine characteristic changes.
  243. If a property is not specifically assigned by the supplied function, it will be left unchanged.
  244. A specific function may be assigned to each particular node in its options, or to all in the network's <code>nodes</code> options.
  245. </p>
  246. <p>
  247. The properties define the characteristics that can be changed as follows:
  248. </p>
  249. <table>
  250. <tr><th>Property</th><th>Node Reference</th></tr>
  251. <tr><td>color</td><td>see color.background</td></tr>
  252. <tr><td>borderWidth</td><td>see borderWidth</td></tr>
  253. <tr><td>borderColor</td><td>see color.border</td></tr>
  254. <tr><td>size</td><td>see size</td></tr>
  255. <tr><td>borderDashes</td><td>see shapeProperties.borderDashes</td></tr>
  256. <tr><td>borderRadius</td><td>see shapeProperties.borderRadius</td></tr>
  257. <tr><td>shadow</td><td>see shadow.enabled</td></tr>
  258. <tr><td>shadowColor</td><td>see shadow.color</td></tr>
  259. <tr><td>shadowSize</td><td>see shadow.size</td></tr>
  260. <tr><td>shadowX</td><td>see shadow.x</td></tr>
  261. <tr><td>shadowY</td><td>see shadow.y</td></tr>
  262. </table>
  263. <br/>
  264. </td>
  265. </tr>
  266. <tr parent="chosen" class="hidden">
  267. <td class="indent">chosen.label</td>
  268. <td>Function or Boolean</td>
  269. <td>undefined</td>
  270. <td>
  271. When true, selecting or hovering on a node will change its label's characteristics according the default.
  272. When false, no change to the node's label will occur when the node is chosen.
  273. <p>
  274. If a function is supplied, it is called when the node is chosen.
  275. <pre class="code">
  276. function(values, id, selected, hovering) {
  277. values.<i>property</i> = <i>chosenValue</i>;
  278. }</pre>
  279. </p>
  280. <p>
  281. Any of the incoming arguments may be used to determine characteristic changes.
  282. If a property is not specifically assigned by the supplied function, it will be left unchanged.
  283. A specific function may be assigned to each particular node in its options, or to all in the network's <code>nodes</code> options.
  284. </p>
  285. <p>
  286. The properties define the characteristics that can be changed as follows:
  287. </p>
  288. <table>
  289. <tr><th>Property</th><th>Node Reference</th></tr>
  290. <tr><td>color</td><td>see font.color</td></tr>
  291. <tr><td>size</td><td>see font.size</td></tr>
  292. <tr><td>face</td><td>see font.face</td></tr>
  293. <tr><td>mod</td><td>font modifier ('bold', 'italic', etc.)</td></tr>
  294. <tr><td>vadjust</td><td>see font.vadjust</td></tr>
  295. <tr><td>strokeWidth</td><td>see font.strokeWidth</td></tr>
  296. <tr><td>strokeColor</td><td>see font.strokeColor</td></tr>
  297. </table>
  298. <br/>
  299. </td>
  300. </tr>
  301. <tr class='toggle collapsible' onclick="toggleTable('optionTable','color', this);">
  302. <td><span parent="color" class="right-caret"></span> color</td>
  303. <td>Object or String</td>
  304. <td><code>Object</code></td>
  305. <td>The color object contains the color information of the node in every situation. When the node only needs
  306. a single color, a color value like <code>'rgba(120,32,14,1)'</code>, <code>'#ffffff'</code> or <code>'red'</code>
  307. can be supplied instead of an object.
  308. </td>
  309. </tr>
  310. <tr parent="color" class="hidden">
  311. <td class="indent">color.border</td>
  312. <td>String</td>
  313. <td><code>'#2B7CE9'</code></td>
  314. <td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is
  315. enabled in the interaction module)</i>.
  316. </td>
  317. </tr>
  318. <tr parent="color" class="hidden">
  319. <td class="indent">color.background</td>
  320. <td>String</td>
  321. <td><code>'#D2E5FF'</code></td>
  322. <td>The color of the background of the node when it is not selected or hovered over <i>(assuming hover is
  323. enabled in the interaction module)</i>.
  324. </td>
  325. </tr>
  326. <tr parent="color" class="hidden">
  327. <td class="indent">color.highlight</td>
  328. <td>Object or String</td>
  329. <td><code>Object</code></td>
  330. <td>The color the node when it is selected. Alternatively you can just supply a string color value.</td>
  331. </tr>
  332. <tr parent="color" class="hidden">
  333. <td class="indent2">color.highlight.border</td>
  334. <td>String</td>
  335. <td><code>'#2B7CE9'</code></td>
  336. <td>The color of the border of the node when it is selected.</td>
  337. </tr>
  338. <tr parent="color" class="hidden">
  339. <td class="indent2">color.highlight.background</td>
  340. <td>String</td>
  341. <td><code>'#D2E5FF'</code></td>
  342. <td>The color of the background of the node when it is selected.</td>
  343. </tr>
  344. <tr parent="color" class="hidden">
  345. <td class="indent">color.hover</td>
  346. <td>Object or String</td>
  347. <td><code>Object</code></td>
  348. <td>The color the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction
  349. module)</i>. Shorthand like above is also supported.
  350. </td>
  351. </tr>
  352. <tr parent="color" class="hidden">
  353. <td class="indent2">color.hover.border</td>
  354. <td>String</td>
  355. <td><code>'#2B7CE9'</code></td>
  356. <td>The color of the border of the node when the mouse hovers over it <i>(assuming hover is enabled in the
  357. interaction module)</i>.
  358. </td>
  359. </tr>
  360. <tr parent="color" class="hidden">
  361. <td class="indent2">color.hover.background</td>
  362. <td>String</td>
  363. <td><code>'#D2E5FF'</code></td>
  364. <td>The color of the background of the node when the mouse hovers over it <i>(assuming hover is enabled in
  365. the interaction module)</i>.
  366. </td>
  367. </tr>
  368. <tr class='toggle collapsible' onclick="toggleTable('optionTable','fixed', this);">
  369. <td><span parent="fixed" class="right-caret"></span> fixed</td>
  370. <td>Object or Boolean</td>
  371. <td><code>Object</code></td>
  372. <td>When true, the node will not move but IS part of the physics simulation. When defined as an object,
  373. movement in either X or Y direction can be disabled.
  374. </td>
  375. </tr>
  376. <tr parent="fixed" class="hidden">
  377. <td class="indent">fixed.x</td>
  378. <td>Boolean</td>
  379. <td><code>false</code></td>
  380. <td>When true, the node will not move in the X direction.</td>
  381. </tr>
  382. <tr parent="fixed" class="hidden">
  383. <td class="indent">fixed.y</td>
  384. <td>Boolean</td>
  385. <td><code>false</code></td>
  386. <td>When true, the node will not move in the Y direction.</td>
  387. </tr>
  388. <tr class='toggle collapsible' onclick="toggleTable('optionTable','font', this);">
  389. <td><span parent="font" class="right-caret"></span> font</td>
  390. <td>Object or String</td>
  391. <td><code>false</code></td>
  392. <td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face
  393. color'</code> for example: <code>'14px arial red'</code>.
  394. </td>
  395. </tr>
  396. <tr parent="font" class="hidden">
  397. <td class="indent">font.color</td>
  398. <td>String</td>
  399. <td><code>'#343434'</code></td>
  400. <td>Color of the label text.</td>
  401. </tr>
  402. <tr parent="font" class="hidden">
  403. <td class="indent">font.size</td>
  404. <td>Number</td>
  405. <td><code>14</code></td>
  406. <td>Size of the label text.</td>
  407. </tr>
  408. <tr parent="font" class="hidden">
  409. <td class="indent">font.face</td>
  410. <td>String</td>
  411. <td><code>'arial'</code></td>
  412. <td>Font face (or font family) of the label text.</td>
  413. </tr>
  414. <tr parent="font" class="hidden">
  415. <td class="indent">font.background</td>
  416. <td>String</td>
  417. <td><code>undefined</code></td>
  418. <td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind
  419. the label in the supplied color.
  420. </td>
  421. </tr>
  422. <tr parent="font" class="hidden">
  423. <td class="indent">font.strokeWidth</td>
  424. <td>Number</td>
  425. <td><code>0</code></td>
  426. <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value
  427. higher than 0 is supplied, the stroke will be drawn.
  428. </td>
  429. </tr>
  430. <tr parent="font" class="hidden">
  431. <td class="indent">font.strokeColor</td>
  432. <td>String</td>
  433. <td><code>'#ffffff'</code></td>
  434. <td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td>
  435. </tr>
  436. <tr parent="font" class="hidden">
  437. <td class="indent">font.align</td>
  438. <td>String</td>
  439. <td><code>'center'</code></td>
  440. <td>This can be set to 'left' to make the label left-aligned. Otherwise,
  441. defaults to 'center'.</td>
  442. </tr>
  443. <tr parent="font" class="hidden">
  444. <td class="indent">font.vadjust</td>
  445. <td>String</td>
  446. <td><code>0</code></td>
  447. <td>A font-specific correction to the vertical positioning of the base font in the label text. (Positive is down.)</td>
  448. </tr>
  449. <tr parent="font" class="hidden">
  450. <td class="indent">font.multi</td>
  451. <td>Boolean or String</td>
  452. <td><code>false</code></td>
  453. <td>If <code>false</code>, the label is treated as pure text drawn with the base font. If <code>true</code> or <code>'html'</code> the label may be multifonted, with bold, italic and code markup, interpreted as html. If the value is <code>'markdown'</code> or <code>'md'</code> the label may be multifonted, with bold, italic and code markup, interpreted as markdown.
  454. The bold, italic, bold-italic and monospaced fonts may be set up under in the font.bold, font.ital, font.boldital and font.mono properties, respectively.</td>
  455. </tr>
  456. <tr parent="font" class='hidden toggle collapsible' onclick="toggleTable('optionTable','bold', this);">
  457. <td><span parent="bold" class="right-caret"></span> font.bold</td>
  458. <td>Object or String</td>
  459. <td><code>false</code></td>
  460. <td>This object defines the details of the bold font in the label. A shorthand is also supported in the form <code>'size face
  461. color'</code> for example: <code>'14px arial red'</code>.
  462. </td>
  463. </tr>
  464. <tr parent="bold" class="hidden">
  465. <td class="indent">font.bold.color</td>
  466. <td>String</td>
  467. <td><code>'#343434'</code></td>
  468. <td>Color of the bold font in the label text. Defaults to the base font's color.</td>
  469. </tr>
  470. <tr parent="bold" class="hidden">
  471. <td class="indent">font.bold.size</td>
  472. <td>Number</td>
  473. <td><code>14</code></td>
  474. <td>Size of the bold font in the label text. Defaults to the base font's size.</td>
  475. </tr>
  476. <tr parent="bold" class="hidden">
  477. <td class="indent">font.bold.face</td>
  478. <td>String</td>
  479. <td><code>'arial'</code></td>
  480. <td>Font face (or font family) of the bold font in the label text. Defaults to the base font's face.</td>
  481. </tr>
  482. <tr parent="bold" class="hidden">
  483. <td class="indent">font.bold.mod</td>
  484. <td>String</td>
  485. <td><code>'bold'</code></td>
  486. <td>A string added to the face and size when determining the bold font in the label text.</td>
  487. </tr>
  488. <tr parent="bold" class="hidden">
  489. <td class="indent">font.bold.vadjust</td>
  490. <td>String</td>
  491. <td><code>0</code></td>
  492. <td>A font-specific correction to the vertical positioning of the bold italic font in the label text. (Positive is down.) Defaults to the base font's valign.</td>
  493. </tr>
  494. <tr parent="font" class='hidden toggle collapsible' onclick="toggleTable('optionTable','ital', this);">
  495. <td><span parent="ital" class="right-caret"></span> font.ital</td>
  496. <td>Object or String</td>
  497. <td><code>false</code></td>
  498. <td>This object defines the details of the italic font in the label. A shorthand is also supported in the form <code>'size face
  499. color'</code> for example: <code>'14px arial red'</code>.
  500. </td>
  501. </tr>
  502. <tr parent="ital" class="hidden">
  503. <td class="indent">font.ital.color</td>
  504. <td>String</td>
  505. <td><code>'#343434'</code></td>
  506. <td>Color of the italic font in the label text. Defaults to the base font's color.</td>
  507. </tr>
  508. <tr parent="ital" class="hidden">
  509. <td class="indent">font.ital.size</td>
  510. <td>Number</td>
  511. <td><code>14</code></td>
  512. <td>Size of the italic font in the label text. Defaults to the base font's size.</td>
  513. </tr>
  514. <tr parent="ital" class="hidden">
  515. <td class="indent">font.ital.face</td>
  516. <td>String</td>
  517. <td><code>'arial'</code></td>
  518. <td>Font face (or font family) of the italic font in the label text. Defaults to the base font's face.</td>
  519. </tr>
  520. <tr parent="ital" class="hidden">
  521. <td class="indent">font.ital.mod</td>
  522. <td>String</td>
  523. <td><code>'italic'</code></td>
  524. <td>A string added to the face and size when determining the italic font in the label text.</td>
  525. </tr>
  526. <tr parent="ital" class="hidden">
  527. <td class="indent">font.ital.vadjust</td>
  528. <td>String</td>
  529. <td><code>0</code></td>
  530. <td>A font-specific correction to the vertical positioning of the italic font in the label text. (Positive is down.) Defaults to the base font's valign.</td>
  531. </tr>
  532. <tr parent="font" class='hidden toggle collapsible' onclick="toggleTable('optionTable','boldital', this);">
  533. <td><span parent="boldital" class="right-caret"></span> font.boldital</td>
  534. <td>Object or String</td>
  535. <td><code>false</code></td>
  536. <td>This object defines the details of the bold italic font in the label. A shorthand is also supported in the form <code>'size face
  537. color'</code> for example: <code>'14px arial red'</code>.
  538. </td>
  539. </tr>
  540. <tr parent="boldital" class="hidden">
  541. <td class="indent">font.boldital.color</td>
  542. <td>String</td>
  543. <td><code>'#343434'</code></td>
  544. <td>Color of the bold italic font in the label text. Defaults to the base font's color.</td>
  545. </tr>
  546. <tr parent="boldital" class="hidden">
  547. <td class="indent">font.boldital.size</td>
  548. <td>Number</td>
  549. <td><code>14</code></td>
  550. <td>Size of the bold italic font in the label text. Defaults to the base font's size.</td>
  551. </tr>
  552. <tr parent="boldital" class="hidden">
  553. <td class="indent">font.boldital.face</td>
  554. <td>String</td>
  555. <td><code>'arial'</code></td>
  556. <td>Font face (or font family) of the bold italic font in the label text. Defaults to the base font's face.</td>
  557. </tr>
  558. <tr parent="boldital" class="hidden">
  559. <td class="indent">font.boldital.mod</td>
  560. <td>String</td>
  561. <td><code>'bold'</code></td>
  562. <td>A string added to the face and size when determining the bold italic font in the label text.</td>
  563. </tr>
  564. <tr parent="boldital" class="hidden">
  565. <td class="indent">font.boldital.vadjust</td>
  566. <td>String</td>
  567. <td><code>0</code></td>
  568. <td>A font-specific correction to the vertical positioning of the bold italic font in the label text. (Positive is down.) Defaults to the base font's valign.</td>
  569. </tr>
  570. <tr parent="font" class='hidden toggle collapsible' onclick="toggleTable('optionTable','mono', this);">
  571. <td><span parent="mono" class="right-caret"></span> font.mono</td>
  572. <td>Object or String</td>
  573. <td><code>false</code></td>
  574. <td>This object defines the details of the monospaced font in the label. A shorthand is also supported in the form <code>'size face
  575. color'</code> for example: <code>'15px courier red'</code>.
  576. </td>
  577. </tr>
  578. <tr parent="mono" class="hidden">
  579. <td class="indent">font.mono.color</td>
  580. <td>String</td>
  581. <td><code>'#343434'</code></td>
  582. <td>Color of the monospaced font in the label text. Defaults to the base font's color.</td>
  583. </tr>
  584. <tr parent="mono" class="hidden">
  585. <td class="indent">font.mono.size</td>
  586. <td>Number</td>
  587. <td><code>15</code></td>
  588. <td>Size of the monospaced font in the label text. Defaults to the base font's size.</td>
  589. </tr>
  590. <tr parent="mono" class="hidden">
  591. <td class="indent">font.mono.face</td>
  592. <td>String</td>
  593. <td><code>'courier new'</code></td>
  594. <td>Font face (or font family) of the monospaced font in the label text.</td>
  595. </tr>
  596. <tr parent="mono" class="hidden">
  597. <td class="indent">font.mono.mod</td>
  598. <td>String</td>
  599. <td><code>''</code></td>
  600. <td>A string added to the face and size when determining the monospaced font in the label text.</td>
  601. </tr>
  602. <tr parent="mono" class="hidden">
  603. <td class="indent">font.mono.vadjust</td>
  604. <td>String</td>
  605. <td><code>2</code></td>
  606. <td>A font-specific correction to the vertical positioning of the monospaced font in the label text. (Positive is down.) Defaults to the base font's valign.</td>
  607. </tr>
  608. <tr>
  609. <td>group</td>
  610. <td>String</td>
  611. <td><code>undefined</code></td>
  612. <td>When not <code>undefined</code>, the node will belong to the defined group. Styling information of
  613. that group will apply to this node. Node specific styling overrides group styling.
  614. </td>
  615. </tr>
  616. <tr class='toggle collapsible' onclick="toggleTable('optionTable','heightConstraint', this);">
  617. <td><span parent="heightConstraint" class="right-caret"></span> heightConstraint</td>
  618. <td>Number, Boolean or Object</td>
  619. <td><code>false</code></td>
  620. <td>If false, no heightConstraint is applied. If a number is specified, the value is used as the minimum height of the node. The node's height will be be set to the minimum if less than the value.</td>
  621. </tr>
  622. <tr parent="heightConstraint" class="hidden">
  623. <td class="indent">heightConstraint.minimum</td>
  624. <td>Number</td>
  625. <td><code>undefined</code></td>
  626. <td>If a number is specified, the value is used as the minimum height of the node. The node's height will be be set to the minimum if less than the value.</td>
  627. </tr>
  628. <tr parent="heightConstraint" class="hidden">
  629. <td class="indent">heightConstraint.valign</td>
  630. <td>String</td>
  631. <td><code>'middle'</code></td>
  632. <td>Valid values are <code>'top'</code>, <code>'middle'</code>, and <code>'bottom'</code>.
  633. When specified, if the height of the label text is less than the minimum (including any top or bottom margins), it will be offset vertically to the designated position.</td>
  634. </tr>
  635. <tr>
  636. <td>hidden</td>
  637. <td>Boolean</td>
  638. <td><code>false</code></td>
  639. <td>When true, the node will not be shown. It will still be part of the physics simulation though!</td>
  640. </tr>
  641. <tr class='toggle collapsible' onclick="toggleTable('optionTable','icon', this);">
  642. <td><span parent="icon" class="right-caret"></span> icon</td>
  643. <td>Object</td>
  644. <td><code>Object</code></td>
  645. <td>These options are only used when the shape is set to <code>icon</code>.</td>
  646. </tr>
  647. <tr parent="icon" class="hidden">
  648. <td class="indent">icon.face</td>
  649. <td>String</td>
  650. <td><code>'FontAwesome'</code></td>
  651. <td>These options are only used when the shape is set to <code>icon</code>. The possible options for the
  652. face are: <code>'FontAwesome'</code> and <code>'Ionicons'</code>.
  653. </td>
  654. </tr>
  655. <tr parent="icon" class="hidden">
  656. <td class="indent">icon.code</td>
  657. <td>String</td>
  658. <td><code>undefined</code></td>
  659. <td>This is the code of the icon, for example <code>'\uf007'</code>.</td>
  660. </tr>
  661. <tr parent="icon" class="hidden">
  662. <td class="indent">icon.size</td>
  663. <td>Number</td>
  664. <td><code>50</code></td>
  665. <td>The size of the icon.</td>
  666. </tr>
  667. <tr parent="icon" class="hidden">
  668. <td class="indent">icon.color</td>
  669. <td>String</td>
  670. <td><code>'#2B7CE9'</code></td>
  671. <td>The color of the icon.</td>
  672. </tr>
  673. <tr>
  674. <td>id</td>
  675. <td>String</td>
  676. <td><code>undefined</code></td>
  677. <td>The id of the node. The id is mandatory for nodes and they have to be unique. This should obviously be set per node, not globally.</td>
  678. </tr>
  679. <tr class='toggle collapsible' onclick="toggleTable('optionTable','image', this);">
  680. <td><span parent="image" class="right-caret"></span> image</td>
  681. <td>Object or String</td>
  682. <td><code>undefined</code></td>
  683. <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option should be the URL
  684. to an image. If the image cannot be found, the brokenImage option can be used.
  685. </td>
  686. </tr>
  687. <tr parent="image" class="hidden">
  688. <td class="indent">image.unselected</td>
  689. <td>String</td>
  690. <td><code>undefined</code></td>
  691. <td>Unselected (default) image URL.
  692. </td>
  693. </tr>
  694. <tr parent="image" class="hidden">
  695. <td class="indent">image.selected</td>
  696. <td>String</td>
  697. <td><code>undefined</code></td>
  698. <td>Selected image URL.
  699. </td>
  700. </tr>
  701. <tr>
  702. <td>label</td>
  703. <td>String</td>
  704. <td><code>undefined</code></td>
  705. <td>The label is the piece of text shown in or under the node, depending on the shape.</td>
  706. </tr>
  707. <tr>
  708. <td>labelHighlightBold</td>
  709. <td>Boolean</td>
  710. <td><code>true</code></td>
  711. <td>Determines whether or not the label becomes bold when the node is selected.</td>
  712. </tr>
  713. <tr>
  714. <td>level</td>
  715. <td>Number</td>
  716. <td><code>undefined</code></td>
  717. <td>When using the hierarchical layout, the level determines where the node is going to be positioned.</td>
  718. </tr>
  719. <tr class='toggle collapsible' onclick="toggleTable('optionTable','margin', this);">
  720. <td><span parent="margin" class="right-caret"></span> margin</td>
  721. <td>Object or Number</td>
  722. <td><code>5</code></td>
  723. <td>If a number is specified, the margins of the label are set to that value on all sides. These options are only used when the shape is set to <code>box</code>, <code>circle</code>, <code>database</code>, <code>icon</code> or <code>text</code>.</td>
  724. </tr>
  725. <tr parent="margin" class="hidden">
  726. <td class="indent">margin.top</td>
  727. <td>Number</td>
  728. <td><code>5</code></td>
  729. <td>The top margin of the label is set to this value.</td>
  730. </tr>
  731. <tr parent="margin" class="hidden">
  732. <td class="indent">margin.right</td>
  733. <td>Number</td>
  734. <td><code>5</code></td>
  735. <td>The right margin of the label is set to this value.</td>
  736. </tr>
  737. <tr parent="margin" class="hidden">
  738. <td class="indent">margin.bottom</td>
  739. <td>Number</td>
  740. <td><code>5</code></td>
  741. <td>The bottom margin of the label is set to this value.</td>
  742. </tr>
  743. <tr parent="margin" class="hidden">
  744. <td class="indent">margin.left</td>
  745. <td>Number</td>
  746. <td><code>5</code></td>
  747. <td>The left margin of the label is set to this value.</td>
  748. </tr>
  749. <tr>
  750. <td>mass</td>
  751. <td>Number</td>
  752. <td><code>1</code></td>
  753. <td>The barnesHut physics model (which is enabled by default) is based on an inverted gravity model. By
  754. increasing the mass of a node, you increase it's repulsion.
  755. <br><br>
  756. Values between 0 and 1 are not recommended.<br>
  757. Negative or zero values are not allowed. These will generate a console error and will be set to 1.
  758. </td>
  759. </tr>
  760. <tr>
  761. <td>physics</td>
  762. <td>Boolean</td>
  763. <td><code>true</code></td>
  764. <td>When false, the node is not part of the physics simulation. It will not move except for from manual
  765. dragging.
  766. </td>
  767. </tr>
  768. <tr class='toggle collapsible' onclick="toggleTable('optionTable','scaling', this);">
  769. <td><span parent="scaling" class="right-caret"></span> scaling</td>
  770. <td>Object</td>
  771. <td><code>Object</code></td>
  772. <td>If the <code>value</code> option is specified, the size of the nodes will be scaled according to the
  773. properties in this object. All node shapes can be scaled, but some only when label scaling is enabled as
  774. their size is based on the size of the label.
  775. Only scalable when label scaling is enabled are:
  776. <code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
  777. Always scalable are:
  778. <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
  779. <code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>hexagon</code>, <code>square</code> and
  780. <code>icon</code>. Keep in mind that when using scaling, the <code>size</code> option is neglected.
  781. </td>
  782. </tr>
  783. <tr parent="scaling" class="hidden">
  784. <td class="indent">scaling.min</td>
  785. <td>Number</td>
  786. <td><code>10</code></td>
  787. <td>If nodes have a value, their sizes are determined by the value, the scaling function and the min max
  788. values. The min value is the minimum allowed value.
  789. </td>
  790. </tr>
  791. <tr parent="scaling" class="hidden">
  792. <td class="indent">scaling.max</td>
  793. <td>Number</td>
  794. <td><code>30</code></td>
  795. <td>This is the maximum allowed size when the nodes are scaled using the value option.</td>
  796. </tr>
  797. <tr parent="scaling" class="hidden">
  798. <td class="indent">scaling.label</td>
  799. <td>Object or Boolean</td>
  800. <td><code>Object</code></td>
  801. <td>This can be false if the label is not allowed to scale with the node. If true it will scale using
  802. default settigns. For further customization, you can supply an object.
  803. </td>
  804. </tr>
  805. <tr parent="scaling" class="hidden">
  806. <td class="indent2">scaling.label.enabled</td>
  807. <td>Boolean</td>
  808. <td><code>false</code></td>
  809. <td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of
  810. the properties in this object are defined.
  811. </td>
  812. </tr>
  813. <tr parent="scaling" class="hidden">
  814. <td class="indent2">scaling.label.min</td>
  815. <td>Number</td>
  816. <td><code>14</code></td>
  817. <td>The minimum font-size used for labels when scaling.</td>
  818. </tr>
  819. <tr parent="scaling" class="hidden">
  820. <td class="indent2">scaling.label.max</td>
  821. <td>Number</td>
  822. <td><code>30</code></td>
  823. <td>The maximum font-size used for labels when scaling.</td>
  824. </tr>
  825. <tr parent="scaling" class="hidden">
  826. <td class="indent2">scaling.label.maxVisible</td>
  827. <td>Number</td>
  828. <td><code>30</code></td>
  829. <td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this
  830. option. If set to 30, the font will never look larger than size 30 zoomed at 100%.
  831. </td>
  832. </tr>
  833. <tr parent="scaling" class="hidden">
  834. <td class="indent2">scaling.label.drawThreshold</td>
  835. <td>Number</td>
  836. <td><code>5</code></td>
  837. <td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn.
  838. When using font scaling, you can use this together with the maxVisible to first show labels of important
  839. nodes when zoomed out and only show the rest when zooming in.
  840. </td>
  841. </tr>
  842. <tr parent="scaling" class="hidden">
  843. <td class="indent">scaling.customScalingFunction</td>
  844. <td>Function</td>
  845. <td>in description</td>
  846. <td>If nodes have <code>value</code> fields, this function determines how the size of the nodes are scaled
  847. based on their values. The default function is:
  848. <pre>
  849. function (min,max,total,value) {
  850. if (max === min) {
  851. return 0.5;
  852. }
  853. else {
  854. var scale = 1 / (max - min);
  855. return Math.max(0,(value - min)*scale);
  856. }
  857. }
  858. </pre>
  859. The function receives the minimum value of the set, the maximum value, the total sum of all values and
  860. finally the value of the node or edge it works on. <b>It has to return a value between 0 and 1.</b> The
  861. nodes and edges then calculate their size as follows:
  862. <pre>
  863. var scale = customScalingFunction(min,max,total,value);
  864. var diff = maxSize - minSize;
  865. mySize = minSize + diff * scale;
  866. </pre>
  867. Please note: <code>maxSize</code> and <code>minSize</code> are the values <code>scaling.max</code>
  868. and <code>scaling.min</code> provided in the options.
  869. </td>
  870. </tr>
  871. <tr class='toggle collapsible' onclick="toggleTable('optionTable','shadow', this);">
  872. <td><span parent="shadow" class="right-caret"></span> shadow</td>
  873. <td>Object or Boolean</td>
  874. <td><code>Object</code></td>
  875. <td>When true, the node casts a shadow using the default settings. This can be further refined by supplying
  876. an object.
  877. </td>
  878. </tr>
  879. <tr parent="shadow" class="hidden">
  880. <td class="indent">shadow.enabled</td>
  881. <td>Boolean</td>
  882. <td><code>false</code></td>
  883. <td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties
  884. in this object are defined.
  885. </td>
  886. </tr>
  887. <tr parent="shadow" class="hidden">
  888. <td class="indent">shadow.color</td>
  889. <td>String</td>
  890. <td><code>'rgba(0,0,0,0.5)'</code></td>
  891. <td>The color size of the shadow as a string. Supported formats are 'rgb(255,255,255)', 'rgba(255,255,255,1)' and '#FFFFFF'.</td>
  892. </tr>
  893. <tr parent="shadow" class="hidden">
  894. <td class="indent">shadow.size</td>
  895. <td>Number</td>
  896. <td><code>10</code></td>
  897. <td>The blur size of the shadow.</td>
  898. </tr>
  899. <tr parent="shadow" class="hidden">
  900. <td class="indent">shadow.x</td>
  901. <td>Number</td>
  902. <td><code>5</code></td>
  903. <td>The x offset.</td>
  904. </tr>
  905. <tr parent="shadow" class="hidden">
  906. <td class="indent">shadow.y</td>
  907. <td>Number</td>
  908. <td><code>5</code></td>
  909. <td>The y offset.</td>
  910. </tr>
  911. <tr>
  912. <td>shape</td>
  913. <td>String</td>
  914. <td><code>'ellipse'</code></td>
  915. <td>The shape defines what the node looks like. There are two types of nodes. One type has the label inside
  916. of it and the other type has the label underneath it. The types with the label inside of it are:
  917. <code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
  918. The ones with the label outside of it are: <code>image</code>, <code>circularImage</code>,
  919. <code>diamond</code>, <code>dot</code>, <code>star</code>, <code>triangle</code>,
  920. <code>triangleDown</code>, <code>hexagon</code>, <code>square</code> and <code>icon</code>.
  921. </td>
  922. </tr>
  923. <tr class='toggle collapsible' onclick="toggleTable('optionTable','shapeProperties', this);">
  924. <td><span parent="shapeProperties" class="right-caret"></span> shapeProperties</td>
  925. <td>Object</td>
  926. <td><code>Object</code></td>
  927. <td>This object contains configuration for specific shapes
  928. </td>
  929. </tr>
  930. <tr parent="shapeProperties" class="hidden">
  931. <td class="indent">shapeProperties.borderDashes</td>
  932. <td>Array or Boolean</td>
  933. <td><code>false</code></td>
  934. <td>This property applies to all shapes that have borders.
  935. You set the dashes by supplying an Array. Array formart: [dash length, gap length].
  936. You can also use a Boolean, false is disable and true is default [5,15].
  937. </td>
  938. </tr>
  939. <tr parent="shapeProperties" class="hidden">
  940. <td class="indent">shapeProperties.borderRadius</td>
  941. <td>Number</td>
  942. <td><code>6</code></td>
  943. <td>This property is used only for the <code>box</code> shape. It allows you to determine the roundness of the corners of the shape.
  944. </td>
  945. </tr>
  946. <tr parent="shapeProperties" class="hidden">
  947. <td class="indent">shapeProperties.interpolation</td>
  948. <td>Boolean</td>
  949. <td><code>true</code></td>
  950. <td>This property only applies to the <code>image</code> and <code>circularImage</code> shapes. When true, the image is resampled when scaled down, resulting in a nicer image at the cost of computional time.</i>
  951. </td>
  952. </tr>
  953. <tr parent="shapeProperties" class="hidden">
  954. <td class="indent">shapeProperties.useImageSize</td>
  955. <td>Boolean</td>
  956. <td><code>false</code></td>
  957. <td>This property only applies to the <code>image</code> and <code>circularImage</code> shapes. When false, the size option is used, when true, the size of the image is used. <br><i><b>Important</b>:
  958. if this is set to true, the image cannot be scaled with the value option!</i>
  959. </td>
  960. </tr>
  961. <tr parent="shapeProperties" class="hidden">
  962. <td class="indent">shapeProperties.useBorderWithImage</td>
  963. <td>Boolean</td>
  964. <td><code>false</code></td>
  965. <td>This property only applies to the <code>image</code> shape.
  966. When true, the color object is used. A rectangle with the background color is
  967. drawn behind it and it has a border. This means all border options are taken into account.
  968. </td>
  969. </tr>
  970. <tr>
  971. <td>size</td>
  972. <td>Number</td>
  973. <td><code>25</code></td>
  974. <td>The size is used to determine the size of node shapes that do not have the label inside of them. These
  975. shapes are: <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
  976. <code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>hexagon</code>, <code>square</code> and
  977. <code>icon</code></td>
  978. </tr>
  979. <tr>
  980. <td>title</td>
  981. <td>String or Element</td>
  982. <td><code>undefined</code></td>
  983. <td>Title to be displayed when the user hovers over the node. The title can be an HTML element or a string
  984. containing plain text or HTML.
  985. </td>
  986. </tr>
  987. <tr>
  988. <td>value</td>
  989. <td>Number</td>
  990. <td><code>undefined</code></td>
  991. <td>When a value is set, the nodes will be scaled using the options in the scaling object defined above.
  992. </td>
  993. </tr>
  994. <tr class='toggle collapsible' onclick="toggleTable('optionTable','widthConstraint', this);">
  995. <td><span parent="widthConstraint" class="right-caret"></span> widthConstraint</td>
  996. <td>Number, Boolean or Object</td>
  997. <td><code>false</code></td>
  998. <td>If false, no widthConstraint is applied. If a number is specified, the minimum and maximum widths of the node are set to the value. The node's label's lines will be broken on spaces to stay below the maximum and the node's width will be set to the minimum if less than the value.</td>
  999. </tr>
  1000. <tr parent="widthConstraint" class="hidden">
  1001. <td class="indent">widthConstraint.minimum</td>
  1002. <td>Number</td>
  1003. <td><code>undefined</code></td>
  1004. <td>If a number is specified, the minimum width of the node is set to the value. The node's width will be set to the minimum if less than the value.</td>
  1005. </tr>
  1006. <tr parent="widthConstraint" class="hidden">
  1007. <td class="indent">widthConstraint.maximum</td>
  1008. <td>Number</td>
  1009. <td><code>undefined</code></td>
  1010. <td>If a number is specified, the maximum width of the node is set to the value. The node's label's lines will be broken on spaces to stay below the maximum.</td>
  1011. </tr>
  1012. <tr>
  1013. <td>x</td>
  1014. <td>Number</td>
  1015. <td><code>undefined</code></td>
  1016. <td>This gives a node an initial x position. When using the hierarchical layout, either the x or y position
  1017. is set by the layout engine depending on the type of view. The other value remains untouched. When using
  1018. stabilization, the stabilized position may be different from the initial one. To lock the node to that
  1019. position use the physics or fixed options.
  1020. </td>
  1021. </tr>
  1022. <tr>
  1023. <td>y</td>
  1024. <td>Number</td>
  1025. <td><code>undefined</code></td>
  1026. <td>This gives a node an initial y position. When using the hierarchical layout, either the x or y position
  1027. is set by the layout engine depending on the type of view. The other value remains untouched. When using
  1028. stabilization, the stabilized position may be different from the initial one. To lock the node to that
  1029. position use the physics or fixed options.
  1030. </td>
  1031. </tr>
  1032. </table>
  1033. </div>
  1034. <?js= self.partial('tmpl/html-foot.tmpl') ?>