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.

150 lines
10 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. <!DOCTYPE html>
  2. <html lang="en"><head>
  3. <meta charset="utf-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="description" content="">
  7. <meta name="author" content="">
  8. <link rel="icon" HREF="favicon.ico">
  9. <title>vis.js - Interaction documentation.</title>
  10. <!-- Bootstrap core CSS -->
  11. <link href="../css/bootstrap.css" rel="stylesheet">
  12. <link href="../css/style.css" rel="stylesheet">
  13. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  14. <!--[if lt IE 9]>
  15. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  16. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  17. <![endif]-->
  18. <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
  19. <script type="text/javascript" src="../js/googleAnalytics.js"></script>
  20. <script type="text/javascript" src="../js/prettify/prettify.js"></script>
  21. <script src="../js/smooth-scroll.min.js"></script>
  22. <script language="JavaScript">
  23. smoothScroll.init();
  24. </script>
  25. <script type="text/javascript" src="../js/toggleTable.js"></script>
  26. </head>
  27. <body onload="prettyPrint();">
  28. <div class="navbar-wrapper">
  29. <div class="container">
  30. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  31. <div class="container">
  32. <div class="navbar-header">
  33. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
  34. aria-expanded="false" aria-controls="navbar">
  35. <span class="sr-only">Toggle navigation</span>
  36. <span class="icon-bar"></span>
  37. <span class="icon-bar"></span>
  38. <span class="icon-bar"></span>
  39. </button>
  40. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  41. </div>
  42. <div id="navbar" class="navbar-collapse collapse">
  43. <ul class="nav navbar-nav">
  44. <li><a href="http://www.visjs.org/index.html#modules">Modules</a></li>
  45. <li><a href="http://www.visjs.org/blog.html">Blog</a></li>
  46. <li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
  47. <li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
  48. <li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
  49. <li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
  50. <li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
  51. </ul>
  52. </div>
  53. </div>
  54. </nav>
  55. </div>
  56. </div>
  57. <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>
  58. <div class="container full">
  59. <h1>Network - interaction</h1>
  60. <p>Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups.</p>
  61. <a class="btn btn-primary" role="button" onclick="history.back()">Back to overview.</a>
  62. <h3>Options</h3>
  63. <p>The options for the interaction module have to be contained in an object titled 'interaction'.</p>
  64. <p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
  65. <ul class="nav nav-tabs">
  66. <li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
  67. <li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
  68. <li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
  69. </ul>
  70. <br>
  71. <pre class="prettyprint lang-js options top hidden" id="fullOptions">
  72. // these are all options in full.
  73. var options = {
  74. interaction:{
  75. dragNodes:true,
  76. dragView: true,
  77. hideEdgesOnDrag: false,
  78. hideNodesOnDrag: false,
  79. hover: false,
  80. hoverConnectedEdges: true,
  81. keyboard: {
  82. enabled: false,
  83. speed: {x: 10, y: 10, zoom: 0.02},
  84. bindToWindow: true
  85. },
  86. multiselect: false,
  87. navigationButtons: false,
  88. selectable: true,
  89. selectConnectedEdges: true,
  90. tooltipDelay: 300,
  91. zoomView: true
  92. }
  93. }
  94. network.setOptions(options);
  95. </pre>
  96. <pre class="prettyprint lang-js options top hidden" id="shortOptions">
  97. // only the options that have shorthand notations are shown.
  98. var options = {
  99. interaction:{
  100. keyboard: false
  101. }
  102. }
  103. network.setOptions(options);
  104. </pre>
  105. <p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
  106. <table class="options" id="optionTable">
  107. <tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr>
  108. <tr><td>dragNodes</td> <td>Boolean</td> <td><code>true</code></td> <td>When true, the nodes that are not fixed can be dragged by the user.</td></tr>
  109. <tr><td>dragView</td> <td>Boolean</td> <td><code>true</code></td> <td>When true, the view can be dragged around by the user.</td></tr>
  110. <tr><td>hideEdgesOnDrag</td> <td>Boolean</td> <td><code>false</code></td> <td>When true, the edges are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.</td></tr>
  111. <tr><td>hideNodesOnDrag</td> <td>Boolean</td> <td><code>false</code></td> <td>When true, the nodes are not drawn when dragging the view. This can greatly speed up responsiveness on dragging, improving user experience.</td></tr>
  112. <tr><td>hover</td> <td>Boolean</td> <td><code>false</code></td> <td>When true, the nodes use their hover colors when the mouse moves over them.</td></tr>
  113. <tr><td>hoverConnectedEdges</td> <td>Boolean</td> <td><code>true</code></td> <td>When true, on hovering over a node, it's connecting edges are highlighted.</td></tr>
  114. <tr class='toggle collapsible' onclick="toggleTable('optionTable','keyboard', this);"><td><span parent="keyboard" class="right-caret"></span> keyboard</td> <td>Object or Boolean</td> <td><code>Object</code></td> <td>When true, the keyboard shortcuts are enabled with the default settings. For further customization, you can supply an object.</td></tr>
  115. <tr parent="keyboard" class="hidden"><td class="indent">keyboard.enabled</td> <td>Boolean</td> <td><code>false</code></td> <td>Toggle the usage of the keyboard shortcuts. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
  116. <tr parent="keyboard" class="hidden"><td class="indent">keyboard.speed.x</td> <td>Number</td> <td><code>1</code></td> <td>The speed at which the view moves in the x direction on pressing a key or pressing a navigation button.</td></tr>
  117. <tr parent="keyboard" class="hidden"><td class="indent">keyboard.speed.y</td> <td>Number</td> <td><code>1</code></td> <td>The speed at which the view moves in the y direction on pressing a key or pressing a navigation button.</td></tr>
  118. <tr parent="keyboard" class="hidden"><td class="indent">keyboard.speed.zoom</td> <td>Number</td> <td><code>0.02</code></td> <td>The speed at which the view zooms in or out pressing a key or pressing a navigation button.</td></tr>
  119. <tr parent="keyboard" class="hidden"><td class="indent">keyboard.bindToWindow</td> <td>Boolean</td> <td><code>true</code></td> <td>When binding the keyboard shortcuts to the window, they will work regardless of which DOM object has the focus. If you have multiple networks on your page, you could set this to false, making sure the keyboard shortcuts only work on the network that has the focus.</td></tr>
  120. <tr><td>multiselect</td> <td>Boolean</td> <td><code>false</code></td> <td>When true, a longheld click (or touch) as well as a control-click will add to the selection.</td></tr>
  121. <tr><td>navigationButtons</td> <td>Boolean</td> <td><code>false</code></td> <td>When true, navigation buttons are drawn on the network canvas. These are HTML buttons and can be completely customized using CSS.</td></tr>
  122. <tr><td>selectable</td> <td>Boolean</td><td><code>true</code></td><td>When true, the nodes and edges can be selected by the user.</td></tr>
  123. <tr><td>selectConnectedEdges</td> <td>Boolean</td><td><code>true</code></td><td>When true, on selecting a node, its connecting edges are highlighted.</td></tr>
  124. <tr><td>tooltipDelay</td> <td>Number</td> <td><code>300</code></td> <td>When nodes or edges have a defined <code>'title'</code> field, this can be shown as a pop-up tooltip. The tooltip itself is an HTML element that can be fully styled using CSS. The delay is the amount of time in milliseconds it takes before the tooltip is shown.</td></tr>
  125. <tr><td>zoomView</td> <td>Boolean</td> <td><code>true</code></td> <td>When true, the user can zoom in.</td></tr>
  126. </table>
  127. </div>
  128. <!-- Bootstrap core JavaScript
  129. ================================================== -->
  130. <!-- Placed at the end of the document so the pages load faster -->
  131. <script src="../js/jquery.min.js"></script>
  132. <script src="../js/bootstrap.min.js"></script>
  133. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  134. <script src="../js/ie10-viewport-bug-workaround.js"></script>
  135. <!-- controller -->
  136. <script src="../js/main.js"></script>