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.

152 lines
11 KiB

  1. <!DOCTYPE html>
  2. <html lang="en"><head><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  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 - A dynamic, browser based visualization library.</title>
  10. <!-- Bootstrap core CSS -->
  11. <link href="../css/bootstrap.css" rel="stylesheet">
  12. <link href="../css/newdocs.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. <script src="../js/smooth-scroll.min.js"></script>
  19. <script language="JavaScript">
  20. smoothScroll.init();
  21. </script>
  22. <style>
  23. td.properties {
  24. width:350px;
  25. }
  26. </style>
  27. </head>
  28. <!-- NAVBAR
  29. ================================================== -->
  30. <body>
  31. <div class="navbar-wrapper">
  32. <div class="container">
  33. <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
  34. <div class="container">
  35. <div class="navbar-header">
  36. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  37. <span class="sr-only">Toggle navigation</span>
  38. <span class="icon-bar"></span>
  39. <span class="icon-bar"></span>
  40. <span class="icon-bar"></span>
  41. </button>
  42. <a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
  43. </div>
  44. <div id="navbar" class="navbar-collapse collapse">
  45. <ul class="nav navbar-nav">
  46. <li><a href="../index.html#modules">Modules</a></li>
  47. <li class="active"><a href="./docs/index.html" target="_blank">Documentation <img class="icon" src="../img/external-link-icons/external-link-icon-white.png"></a></li>
  48. <li><a href="../blog.html">Blog</a></li>
  49. <li><a href="../index.html#download_install">Download</a></li>
  50. <li><a href="../showcase/index.html">Showcase</a></li>
  51. <li><a href="../index.html#contribute">Contribute</a></li>
  52. <li><a href="../featureRequests.html">Feature requests</a></li>
  53. <li><a href="../index.html#licenses">License</a></li>
  54. </ul>
  55. </div>
  56. </div>
  57. </nav>
  58. </div>
  59. </div>
  60. <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>
  61. <div class="container full">
  62. <h1>Network - interaction</h1>
  63. <p>Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups.</p>
  64. <h3>Options</h3>
  65. <p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
  66. <table class="moduleTable">
  67. <tr class="header"><td>name</td> <td>type</td> <td>default</td> <td>description</td></tr>
  68. <tr><td>dragNodes</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>When true, the nodes that are not fixed can be dragged by the user.</td></tr>
  69. <tr><td>dragView</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>When true, the view can be dragged around by the user.</td></tr>
  70. <tr><td>zoomView</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>When true, the user can zoom in.</td></tr>
  71. <tr><td>hoverEnabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the nodes use their hover colors when the mouse moves over them.</td></tr>
  72. <tr><td>navigationButtons</td> <td class="mid">Boolean</td> <td class="mid"><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>
  73. <tr><td>tooltipDelay</td> <td class="mid">Object</td> <td class="mid"><code>Object</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>
  74. <tr><td>keyboard</td> <td class="mid">Object | Boolean</td> <td class="mid"><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>
  75. <tr><td>keyboard.enabled</td> <td class="mid">Boolean</td> <td class="mid"><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>
  76. <tr><td>keyboard.speed.x</td> <td class="mid">Number</td> <td class="mid"><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>
  77. <tr><td>keyboard.speed.y</td> <td class="mid">Number</td> <td class="mid"><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>
  78. <tr><td>keyboard.speed.zoom</td> <td class="mid">Number</td> <td class="mid"><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>
  79. <tr><td>keyboard.bindToWindow</td> <td class="mid">Boolean</td> <td class="mid"><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>
  80. </table>
  81. <h3>Methods</h3>
  82. <p>The interaction module has no methods.</p>
  83. <h3>Events</h3>
  84. <p>These events are fired by the interaction module. They are related to user input.</p>
  85. <table class="moduleTable">
  86. <tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr>
  87. <tr><td>click</td> <td class="mid">
  88. <pre class="code">
  89. {
  90. nodes: [Array of selected nodeIds],
  91. edges: [Array of selected edgeIds],
  92. pointer: {
  93. DOM: {x:pointer_x, y:pointer_y},
  94. canvas: {x:canvas_x, y:canvas_y}
  95. }
  96. }
  97. </pre>
  98. </td><td>Fired when the user clicks the mouse or taps on a touchscreen device.</td></tr>
  99. <tr><td>doubleClick</td> <td class="mid">same as <code>click</code>.</td><td>Fired when the user double clicks the mouse or double taps on a touchscreen device. Since a double click is in fact 2 clicks, 2 click events are fired, followed by a double click event. If you do not want to use the click events if a double click event is fired, just check the time between click events before processing them.</td></tr>
  100. <tr><td>hold</td> <td class="mid">same as <code>click</code>.</td><td>Fired when the user clicks and holds the mouse or taps and holds on a touchscreen device. A click event is also fired in this case.</td></tr>
  101. <tr><td>release</td> <td class="mid">same as <code>click</code>.</td><td>Fired after drawing on the canvas has been completed. Can be used to draw on top of the network.</td></tr>
  102. <tr><td>select</td> <td class="mid">same as <code>click</code>.</td><td>Fired when the selection has changed by user action. This means a node or edge has been selected, added to the selection or deselected. <b>All select events are only triggerd on click and hold</b>.</td></tr>
  103. <tr><td>selectNode</td> <td class="mid">same as <code>click</code>.</td><td>Fired when a node has been selected by the user.</td></tr>
  104. <tr><td>selectEdge</td> <td class="mid">same as <code>click</code>.</td><td>Fired when a edge has been selected by the user.</td></tr>
  105. <tr><td>deselectNode</td><td class="mid"><pre class="code">
  106. {
  107. nodes: [Array of selected nodeIds],
  108. edges: [Array of selected edgeIds],
  109. pointer: {
  110. DOM: {x:pointer_x, y:pointer_y},
  111. canvas: {x:canvas_x, y:canvas_y}
  112. }
  113. },
  114. previousSelection: {
  115. nodes: [Array of previously selected nodeIds],
  116. edges: [Array of previously selected edgeIds]
  117. }
  118. }
  119. </pre></td><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.</td></tr>
  120. <tr><td>deselectEdge</td><td class="mid">same as <code>deselectNode</code>.</td><td>Fired when a edge (or edges) 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.</td></tr>
  121. <tr><td>dragStart</td> <td class="mid">same as <code>click</code>.</td><td>Fired when starting a drag.</td></tr>
  122. <tr><td>dragEnd</td> <td class="mid">same as <code>click</code>.</td><td>Fired when the drag has finished.</td></tr>
  123. <tr><td>zoom</td> <td class="mid"><code>{direction:'+'/'-'}</code></td><td>Fired when the user zooms in or out. The properties tell you which direction the zoom is in.</td></tr>
  124. </table>
  125. <br />
  126. <br />
  127. <br />
  128. <br />
  129. <br />
  130. <br />
  131. <br />
  132. </div>
  133. <!-- Bootstrap core JavaScript
  134. ================================================== -->
  135. <!-- Placed at the end of the document so the pages load faster -->
  136. <script src="../js/jquery.min.js"></script>
  137. <script src="../js/bootstrap.min.js"></script>
  138. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  139. <script src="../js/ie10-viewport-bug-workaround.js"></script>