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.

134 lines
7.8 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <link rel="icon" HREF="favicon.ico">
  10. <title>vis.js - A dynamic, browser based visualization library.</title>
  11. <!-- Bootstrap core CSS -->
  12. <link href="../css/bootstrap.css" rel="stylesheet">
  13. <link href="../css/newdocs.css" rel="stylesheet">
  14. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  15. <!--[if lt IE 9]>
  16. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  17. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  18. <![endif]-->
  19. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  20. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  21. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  22. <script src="../js/smooth-scroll.min.js"></script>
  23. <script language="JavaScript">
  24. smoothScroll.init();
  25. </script>
  26. <script type="text/javascript" src="../js/toggleTable.js"></script>
  27. </head>
  28. <body onload="prettyPrint();">
  29. <div class="navbar-wrapper">
  30. <div class="container">
  31. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  32. <div class="container">
  33. <div class="navbar-header">
  34. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  35. aria-expanded="false" aria-controls="navbar">
  36. <span class="sr-only">Toggle navigation</span>
  37. <span class="icon-bar"></span>
  38. <span class="icon-bar"></span>
  39. <span class="icon-bar"></span>
  40. </button>
  41. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  42. </div>
  43. <div id="navbar" class="navbar-collapse collapse">
  44. <ul class="nav navbar-nav">
  45. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  46. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  47. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  48. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  49. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  50. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  51. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  52. </ul>
  53. </div>
  54. </div>
  55. </nav>
  56. </div>
  57. </div>
  58. <a href="https://github.com/almende/vis" class="hidden-xs hidden-sm hidden-md"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
  59. <div class="container full">
  60. <h1>Network - selection</h1>
  61. <p>Handles the selection of nodes and edges.</p>
  62. <h3>Options</h3>
  63. <p>The options for the selection have to be contained in an object titled 'selection'.</p>
  64. <p>Click on the options shown to show how these options are supposed to be used.</p>
  65. <ul class="nav nav-tabs">
  66. <li role="presentation" class="active" onclick="hideOptions('fullTab','fullOptions');" id="hiddenTab"><a href="#">options hidden</a></li>
  67. <li role="presentation" onclick="toggleTab('fullTab','fullOptions');" id="fullTab"><a href="#">options shown</a></li>
  68. </ul>
  69. <br>
  70. <pre class="prettyprint lang-js options hidden" id="fullOptions">
  71. var options = {
  72. selection:{
  73. selectable: true,
  74. selectConnectedEdges: false
  75. }
  76. }
  77. network.setOptions(options);
  78. </pre>
  79. <p>All of the individual options are explained here:</p>
  80. <table>
  81. <tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr>
  82. <tr><td>selectable</td> <td class="mid">Boolean</td><td class="mid"><code>true</code></td><td>When true, the nodes and edges can be selected by the user.</td></tr>
  83. <tr><td>selectConnectedEdges</td> <td class="mid">Boolean</td><td class="mid"><code>true</code></td><td>When true, on selecting a node, its connecting edges are highlighted.</td></tr>
  84. </table>
  85. <h3>Methods</h3>
  86. <p>This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.</p>
  87. <table>
  88. <tr class="header"><td class="methodName">name</td><td>returns</td><td>description</td></tr>
  89. <tr><td>getSelection()</td> <td class="mid">
  90. <pre class="code">
  91. {
  92. nodes: [Array of selected nodeIds],
  93. edges: [Array of selected edgeIds]
  94. }</pre> </td><td>Returns an object with selected nodes and edges ids.</td></tr>
  95. <tr><td>getSelectedNodes()</td> <td class="mid"><code>[nodeId1, nodeId2, ..]</code></td><td>Returns an array of selected node ids.</td></tr>
  96. <tr><td>getSelectedEdges()</td> <td class="mid"><code>[edgeId1, edgeId2, ..]</code></td><td>Returns an array of selected edge ids.</td></tr>
  97. <tr><td>getNodeAt(<br>&nbsp;&nbsp;&nbsp;<code><i>{x: xPosition DOM,<br>&nbsp;&nbsp; y: yPosition DOM}</i></code><br>)</td> <td class="mid">nodeId</td><td>Returns a nodeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas.</td></tr>
  98. <tr><td>getEdgeAt(<br>&nbsp;&nbsp;&nbsp;<code><i>{x: xPosition DOM,<br>&nbsp;&nbsp; y: yPosition DOM}</i></code><br>)</td> <td class="mid">edgeId</code></td><td>Returns a edgeId or undefined. The DOM positions are expected to be in pixels from the top left corner of the canvas..</td></tr>
  99. <tr><td>selectNodes(<br>&nbsp;&nbsp;&nbsp;<code><i>Array with nodeIds</i></code>,<br>&nbsp;&nbsp;&nbsp;<code><i>[Boolean highlightEdges]</i></code><br>)</td> <td class="mid">none</td><td>Selects the nodes corresponding to the id's in the input array. If highlightEdges is true or undefined, the neighbouring edges will also be selected. This method unselects all other objects before selecting its own objects. <i>Does not fire events</i>.</td></tr>
  100. <tr><td>selectEdges(<br>&nbsp;&nbsp;&nbsp;<code><i>Array with edgeIds</i></code><br>)</td> <td class="mid">none</td><td>Selects the edges corresponding to the id's in the input array. This method unselects all other objects before selecting its own objects. <i>Does not fire events</i>.</td></tr>
  101. <tr><td>unselectAll()</td> <td class="mid">none</td> <td>Unselect all objects. <i>Does not fire events</i>.</td></tr>
  102. </table>
  103. <h3>Events</h3>
  104. <p>The selection handler does not fire events. All related events are fired by the <a href="./interaction.html">interaction module</a> because they are triggered by user interaction.</p>
  105. <br />
  106. <br />
  107. <br />
  108. <br />
  109. <br />
  110. <br />
  111. <br />
  112. </div>
  113. <!-- Bootstrap core JavaScript
  114. ================================================== -->
  115. <!-- Placed at the end of the document so the pages load faster -->
  116. <script src="../js/jquery.min.js"></script>
  117. <script src="../js/bootstrap.min.js"></script>
  118. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  119. <script src="../js/ie10-viewport-bug-workaround.js"></script>