Browse Source

added manipulation documentation and numerous bugfixes

flowchartTest
Alex de Mulder 9 years ago
parent
commit
7e30d2f009
22 changed files with 1342 additions and 523 deletions
  1. +299
    -212
      dist/vis.js
  2. +22
    -5
      docs/css/newdocs.css
  3. +3
    -8
      docs/network/canvas.html
  4. +3
    -5
      docs/network/configure.html
  5. +478
    -76
      docs/network/edges.html
  6. +66
    -21
      docs/network/groups.html
  7. +13
    -12
      docs/network/interaction.html
  8. +8
    -23
      docs/network/layout.html
  9. +192
    -0
      docs/network/manipulation.html
  10. +12
    -19
      docs/network/new_network.html
  11. +48
    -44
      docs/network/nodes.html
  12. +5
    -11
      docs/network/physics.html
  13. +5
    -1
      examples/network/01_basic_usage.html
  14. +1
    -1
      examples/network/layout.html
  15. +3
    -3
      lib/network/modules/ConfigurationSystem.js
  16. +1
    -1
      lib/network/modules/EdgesHandler.js
  17. +4
    -1
      lib/network/modules/InteractionHandler.js
  18. +142
    -69
      lib/network/modules/ManipulationSystem.js
  19. +33
    -4
      lib/network/modules/components/Edge.js
  20. +0
    -3
      lib/network/modules/components/Node.js
  21. +0
    -2
      lib/network/modules/components/edges/BezierEdgeDynamic.js
  22. +4
    -2
      lib/network/modules/components/edges/util/EdgeBase.js

+ 299
- 212
dist/vis.js
File diff suppressed because it is too large
View File


+ 22
- 5
docs/css/newdocs.css View File

@ -93,10 +93,6 @@ pre.code {
border:0px;
}
td.type {
width:150px;
}
tr.hidden {
max-height:0;
/*max-height: 0;*/
@ -158,6 +154,27 @@ td.indent {
padding-left:25px !important;
}
td.indent2 {
padding-left:50px !important;
}
td.name {
width:270px;
width:230px;
}
td.nameSmall {
width:150px;
}
td.type {
width: 110px;
}
td.default {
width:60px;
}
td.eventProperties {
width:350px;
}

+ 3
- 8
docs/network/canvas.html View File

@ -25,11 +25,6 @@
smoothScroll.init();
</script>
<style>
td.properties {
width:350px;
}
</style>
</head>
<!-- NAVBAR
================================================== -->
@ -74,7 +69,7 @@
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr>
<tr class="header"><td class="name">name</td><td class="type">type</td><td class="default">default</td><td class="description">description</td></tr>
<tr><td>width</td><td class="mid">String</td><td class="mid"><code>'100%'</code></td><td>the width of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td></tr>
<tr><td>height</td><td class="mid">String</td><td class="mid"><code>'100%'</code></td><td>the height of the canvas. Can be in percentages or pixels (ie. <code>'400px'</code>).</td></tr>
</table>
@ -82,7 +77,7 @@
<h3>Methods</h3>
<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>
<table class="moduleTable">
<tr class="header"><td>name</td><td>returns</td><td>description</td></tr>
<tr class="header"><td class="methodName">name</td><td>returns</td><td>description</td></tr>
<tr><td>setSize(String, String)</td><td class="mid">none</td><td>Set the size of the canvas. This is automatically done on a window resize.</td></tr>
<tr><td>canvasToDOM(Object)</td> <td class="mid">Object</td><td>This function converts canvas coordinates to coordinates on the DOM. Input and output are in the form of <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.</td></tr>
<tr><td>DOMtoCanvas(Object)</td> <td class="mid">Object</td><td>This function converts DOM coordinates to coordinates on the canvas. Input and output are in the form of <code>{x:Number,y:Number}</code>. The DOM values are relative to the network container.</td></tr>
@ -91,7 +86,7 @@
<h3>Events</h3>
<p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr>
<tr class="header"><td class="eventName">name</td><td class="eventProperties">properties</td><td>description</td></tr>
<tr><td>resize</td><td class="mid">
<pre class="code">
{

+ 3
- 5
docs/network/configure.html View File

@ -26,9 +26,7 @@
</script>
<style>
td.properties {
width:350px;
}
</style>
</head>
<!-- NAVBAR
@ -74,8 +72,8 @@
<h3>Options</h3>
<p>Alternative to supplying an object, you can supply a <code>String</code>, <code>Array</code> or <code>Boolean</code>. These will do the same as the filter option described below.</p>
<table class="moduleTable">
<tr class="header"> <td>name</td><td>type</td><td>default</td><td>description</td></tr>
<tr><td>filter</td> <td class="mid">String | Array | Boolean</td> <td class="mid"><code>true</code></td><td>When a boolean, true gives you all options, false will not show any. If a string is supplied, any combination of the following is allowed: nodes, edges, layout, interaction, manipulation, physics, selection, renderer. Feel free to come up with a fun seperating character. Finally, when supplied an array of strings, any of the previously mentioned fields are accepted.</td></tr>
<tr class="header"><td class="nameSmall">name</td><td class="type">type</td><td class="default">default</td><td class="description">description</td></tr>
<tr><td>filter</td> <td class="mid">String or Array or Boolean</td> <td class="mid"><code>true</code></td><td>When a boolean, true gives you all options, false will not show any. If a string is supplied, any combination of the following is allowed: nodes, edges, layout, interaction, manipulation, physics, selection, renderer. Feel free to come up with a fun seperating character. Finally, when supplied an array of strings, any of the previously mentioned fields are accepted.</td></tr>
<tr><td>container</td> <td class="mid">DOM element</td> <td class="mid"><code>undefined</code></td><td>This allows you to put the configure list in another HTML container than below the network.</td></tr>
</table>

+ 478
- 76
docs/network/edges.html View File

@ -1,5 +1,19 @@
<!DOCTYPE html>
<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">
<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">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -26,9 +40,10 @@
<style>
td.type {
width:160px;
width: 90px;
}
</style>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
================================================== -->
@ -39,7 +54,8 @@
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -50,7 +66,9 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<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>
<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>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
@ -65,57 +83,328 @@
</div>
</div>
<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>
<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>
<div class="container full">
<h1>Network - edges</h1>
<p>Handles the creation and deletion of edges and contains the global edge options and styles.</p>
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td> <td class="type">type</td> <td>default</td> <td>description</td></tr>
<tr><td>arrows</td> <td class="mid">Object | String</td> <td class="mid"><code>1</code></td> <td>To draw an arrow with default settings a string can be supplied. For example: <code>arrows:'to, from, middle'</code> or <code>'to;from'</code>, any combination with any seperating symbol is fine. If you want to control the size of the arrowheads, you can supply an object.</td></tr>
<tr><td>arrows.to</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td> <td>When true, an arrowhead on the 'to' side of the edge is drawn, pointing to the 'to' node with default settings. To customize the size of the arrow, supply an object.</td></tr>
<tr><td>arrows.to.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the arrow on or off. This option is optional, if undefined and the scaleFactor property is set, enabled will be set to true.</td></tr>
<tr><td>arrows.to.scaleFactor</td> <td class="mid">Number</td> <td class="mid"><code>1</code></td> <td>The scale factor allows you to change the size of the arrowhead.</td></tr>
<tr><td>arrows.middle</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td> <td>Exactly the same as the to object but with an arrowhead in the center of the edge.</td></tr>
<tr><td>arrows.from</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td> <td>Exactly the same as the to object but with an arrowhead at the from node of the edge.</td></tr>
<tr><td>color</td> <td class="mid">Object | String</td> <td class="mid"><code>Object</code></td> <td>The color object contains the color information of the edge in every situation. When the edge only needs a single color, a color value like <code>'rgb(120,32,14)'</code>, <code>'#ffffff'</code> or <code>'red'</code> can be supplied instead of an object.</td></tr>
<tr><td>color.color</td> <td class="mid">String</td> <td class="mid"><code>'#848484'</code></td><td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>color.highlight</td> <td class="mid">String</td> <td class="mid"><code>'#848484'</code></td><td>The color the edge when it is selected.</td></tr>
<tr><td>color.hover</td> <td class="mid">String</td> <td class="mid"><code>'#848484'</code></td><td>The color the edge when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>color.inherit</td> <td class="mid">String | Boolean</td> <td class="mid"><code>'from'</code></td> <td><i>When color, highlight or hover are defined, inherit is set to false!</i>
<br><br>Supported options are: <code>true, false, 'from','to','both'</code>.
<br><br>The default value is 'from' which does the same as true: the edge will inherit the color from the border of the node on the 'from' side.
<br><br>When set to 'to', the border color from the 'to' node will be used.
<br><br>When set to 'both', the color will fade from the from color to the to color. <b>'both' is computationally intensive</b> because the gradient is recomputed every redraw. This is required because the angles change when the nodes move.</td></tr>
<tr><td>color.opacity</td> <td class="mid">Number</td> <td class="mid"><code>1.0</code></td> <td>It can be useful to set the opacity of an edge without manually changing all the colors. The opacity option will convert all colors (also when using inherit) to adhere to the supplied opacity. The allowed range of the opacity option is between <code>0 and 1</code>. This is only done once so the performance impact is not too big.</td></tr>
<tr><td>dashes</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td> <td>When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an object. <i>When using dashed lines in IE versions older than 11, the line will be drawn straight, not smooth</i>.</td></tr>
<tr><td>dashes.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the dash drawing style on or off. This option is optional, if undefined and the scaleFactor property is set, enabled will be set to true.</td></tr>
<tr><td>dashes.pattern</td> <td class="mid">Array</td> <td class="mid"><code>[5,5]</code></td> <td>Array of numbers repeating gap length, dash length, gap length, dash length, ... etc. The array is repeated until the distance is filled.</td></tr>
<tr><td>font</td> <td class="mid">Object | String</td> <td class="mid"><code>false</code></td> <td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face color'</code> for example: <code>'14px arial red'</code>.</td></tr>
<tr><td>font.color</td> <td class="mid">String</td> <td class="mid"><code>'#343434'</code></td><td>Color of the label text.</td></tr>
<tr><td>font.size</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>Size of the label text.</td></tr>
<tr><td>font.face</td> <td class="mid">String</td> <td class="mid"><code>'arial'</code></td> <td>Font face (or font family) of the label text.</td></tr>
<tr><td>font.background</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td><td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind the label in the supplied color.</td></tr>
<tr><td>font.stroke</td> <td class="mid">Number</td> <td class="mid"><code>0</code></td> <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value higher than 0 is supplied, the stroke will be drawn.</td></tr>
<tr><td>font.strokeColor</td> <td class="mid">String</td> <td class="mid"><code>'#ffffff'</code></td><td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td></tr>
<tr><td>font.align</td> <td class="mid">String</td> <td class="mid"><code>'horizontal'</code></td><td>Possible options: <code>'horizontal','top','middle','bottom'</code>. The alignment determines how the label is aligned over the edge. The default value <code>horizontal</code> aligns the label horizontally, regardless of the orientation of the edge. When an option other than <code>horizontal</code> is chosen, the label will align itself according to the edge. </td></tr>
<tr><td>hidden</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the edge is not drawn. It is part still part of the physics simulation however!</td></tr>
<tr><td>hoverWidth</td> <td class="mid">Number</td> <td class="mid"><code>1.5</code></td> <td>The width of the edge when the mouse hovers over it (and hover is enabled in the interaction module!)</td></tr>
<tr><td>label</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td><td>The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.</td></tr>
<tr><td>length</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td><td>The physics simulation gives edges a spring length. This value can override the length of the spring in rest.</td></tr>
<tr><td>physics</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>When true, the edge is part of the physics simulation. When false, it will not act as a spring.</td></tr>
<tr><td>scaling</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>If the <code>value</code> option is specified, the width of the edges will be scaled according to the properties in this object. Keep in mind that when using scaling, the <code>width</code> option is neglected.</td></tr>
<tr><td>scaling.min</td> <td class="mid">Number</td> <td class="mid"><code>1</code></td> <td>If edges have a value, their widths are determined by the value, the scaling function and the min max values. The min value is the minimum allowed value.</td></tr>
<tr><td>scaling.max</td> <td class="mid">Number</td> <td class="mid"><code>15</code></td> <td>This is the maximum allowed width when the edges are scaled using the value option.</td></tr>
<tr><td>scaling.label</td> <td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td> <td>When false, the label is not allowed to scale with the edge. If true it will scale using default settigns. For further customization, you can supply an object.</td></tr>
<tr><td>scaling.label.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr><td>scaling.label.min</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>The minimum font-size used for labels when scaling.</td></tr>
<tr><td>scaling.label.max</td> <td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>The maximum font-size used for labels when scaling.</td></tr>
<tr><td>scaling.label.maxVisible</td><td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this option. If set to 30, the font will never look larger than size 30 zoomed at 100%.</td></tr>
<tr><td>scaling.label.drawThreshold</td><td class="mid">Number</td> <td class="mid"><code>3</code></td> <td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn. When using font scaling, you can use this together with the maxVisible to first show labels of important edges when zoomed out and only show the rest when zooming in.</td></tr>
<tr><td>scaling.customScalingFunction</td> <td class="mid">Function</td><td class="mid">in description</td> <td>If edges have <code>value</code> fields, this function determines how the size of the nodes are scaled based on their values. The default function is:
<table class="moduleTable" id="optionTable">
<tr class="header">
<td class="name">name</td>
<td class="type">type</td>
<td class="default">default</td>
<td class="description">description</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','arrows', this);">
<td><span parent="arrows" class="right-caret"></span> arrows</td>
<td class="mid">Object or String</td>
<td class="mid"><code>undefined</code></td>
<td>To draw an arrow with default settings a string can be supplied. For example: <code>arrows:'to, from,
middle'</code> or <code>'to;from'</code>, any combination with any seperating symbol is fine. If you
want to control the size of the arrowheads, you can supply an object.
</td>
</tr>
<tr parent="arrows" class="hidden">
<td class="indent">arrows.to</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>When true, an arrowhead on the 'to' side of the edge is drawn, pointing to the 'to' node with default
settings. To customize the size of the arrow, supply an object.
</td>
</tr>
<tr parent="arrows" class="hidden">
<td class="indent2">arrows.to.enabled</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>Toggle the arrow on or off. This option is optional, if undefined and the scaleFactor property is set,
enabled will be set to true.
</td>
</tr>
<tr parent="arrows" class="hidden">
<td class="indent2">arrows.to.scaleFactor</td>
<td class="mid">Number</td>
<td class="mid"><code>1</code></td>
<td>The scale factor allows you to change the size of the arrowhead.</td>
</tr>
<tr parent="arrows" class="hidden">
<td class="indent">arrows.middle</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>Exactly the same as the to object but with an arrowhead in the center of the edge.</td>
</tr>
<tr parent="arrows" class="hidden">
<td class="indent">arrows.from</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>Exactly the same as the to object but with an arrowhead at the from node of the edge.</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','color', this);">
<td><span parent="color" class="right-caret"></span> color</td>
<td class="mid">Object or String</td>
<td class="mid"><code>Object</code></td>
<td>The color object contains the color information of the edge in every situation. When the edge only needs
a single color, a color value like <code>'rgb(120,32,14)'</code>, <code>'#ffffff'</code> or
<code>'red'</code> can be supplied instead of an object.
</td>
</tr>
<tr parent="color" class="hidden">
<td class="indent">color.color</td>
<td class="mid">String</td>
<td class="mid"><code>'#848484'</code></td>
<td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is
enabled in the interaction module)</i>.
</td>
</tr>
<tr parent="color" class="hidden">
<td class="indent">color.highlight</td>
<td class="mid">String</td>
<td class="mid"><code>'#848484'</code></td>
<td>The color the edge when it is selected.</td>
</tr>
<tr parent="color" class="hidden">
<td class="indent">color.hover</td>
<td class="mid">String</td>
<td class="mid"><code>'#848484'</code></td>
<td>The color the edge when the mouse hovers over it <i>(assuming hover is enabled in the interaction
module)</i>.
</td>
</tr>
<tr parent="color" class="hidden">
<td class="indent">color.inherit</td>
<td class="mid">String or Boolean</td>
<td class="mid"><code>'from'</code></td>
<td><i>When color, highlight or hover are defined, inherit is set to false!</i>
<br><br>Supported options are: <code>true, false, 'from','to','both'</code>.
<br><br>The default value is 'from' which does the same as true: the edge will inherit the color from
the border of the node on the 'from' side.
<br><br>When set to 'to', the border color from the 'to' node will be used.
<br><br>When set to 'both', the color will fade from the from color to the to color. <b>'both' is
computationally intensive</b> because the gradient is recomputed every redraw. This is required
because the angles change when the nodes move.
</td>
</tr>
<tr parent="color" class="hidden">
<td class="indent">color.opacity</td>
<td class="mid">Number</td>
<td class="mid"><code>1.0</code></td>
<td>It can be useful to set the opacity of an edge without manually changing all the colors. The opacity
option will convert all colors (also when using inherit) to adhere to the supplied opacity. The allowed
range of the opacity option is between <code>0 and 1</code>. This is only done once so the performance
impact is not too big.
</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','dashes', this);">
<td><span parent="dashes" class="right-caret"></span> dashes</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an object.
<i>When using dashed lines in IE versions older than 11, the line will be drawn straight, not smooth</i>.
</td>
</tr>
<tr parent="dashes" class="hidden">
<td class="indent">dashes.enabled</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>Toggle the dash drawing style on or off. This option is optional, if undefined and the scaleFactor
property is set, enabled will be set to true.
</td>
</tr>
<tr parent="dashes" class="hidden">
<td class="indent">dashes.pattern</td>
<td class="mid">Array</td>
<td class="mid"><code>[5,5]</code></td>
<td>Array of numbers repeating gap length, dash length, gap length, dash length, ... etc. The array is
repeated until the distance is filled.
</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','font', this);">
<td><span parent="font" class="right-caret"></span> font</td>
<td class="mid">Object or String</td>
<td class="mid"><code>false</code></td>
<td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face
color'</code> for example: <code>'14px arial red'</code>.
</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.color</td>
<td class="mid">String</td>
<td class="mid"><code>'#343434'</code></td>
<td>Color of the label text.</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.size</td>
<td class="mid">Number</td>
<td class="mid"><code>14</code></td>
<td>Size of the label text.</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.face</td>
<td class="mid">String</td>
<td class="mid"><code>'arial'</code></td>
<td>Font face (or font family) of the label text.</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.background</td>
<td class="mid">String</td>
<td class="mid"><code>undefined</code></td>
<td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind
the label in the supplied color.
</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.stroke</td>
<td class="mid">Number</td>
<td class="mid"><code>0</code></td>
<td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value
higher than 0 is supplied, the stroke will be drawn.
</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.strokeColor</td>
<td class="mid">String</td>
<td class="mid"><code>'#ffffff'</code></td>
<td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td>
</tr>
<tr parent="font" class="hidden">
<td class="indent">font.align</td>
<td class="mid">String</td>
<td class="mid"><code>'horizontal'</code></td>
<td>Possible options: <code>'horizontal','top','middle','bottom'</code>. The alignment determines how the
label is aligned over the edge. The default value <code>horizontal</code> aligns the label horizontally,
regardless of the orientation of the edge. When an option other than <code>horizontal</code> is chosen,
the label will align itself according to the edge.
</td>
</tr>
<tr>
<td>hidden</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>When true, the edge is not drawn. It is part still part of the physics simulation however!</td>
</tr>
<tr>
<td>hoverWidth</td>
<td class="mid">Number or Function</td>
<td class="mid"><code>0.5</code></td>
<td>Assuming the hover behaviour is enabled in the <a href="./interaction.html">interaction module</a>, the
hoverWidth determines the width of the edge when the user hovers over it with the mouse. If a number is
supplied, this number will be <b>added</b> to the width.
Because the width can be altered by the value and the scaling functions, a constant multiplier or added
value may not give the best results. To solve this, you can supply a function. Example:
<pre class="code">
var options: {
edges: {
hoverWidth: function (width) {return width+1;}
}
}
</pre>
It receives the <code>Number width</code> of the edge. In this simple example we add 1 to the width. You
can taylor the logic in the function as long as it returns a <code>Number</code>.
</td>
</tr>
<tr>
<td>label</td>
<td class="mid">String</td>
<td class="mid"><code>undefined</code></td>
<td>The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.</td>
</tr>
<tr>
<td>length</td>
<td class="mid">Number</td>
<td class="mid"><code>undefined</code></td>
<td>The physics simulation gives edges a spring length. This value can override the length of the spring in
rest.
</td>
</tr>
<tr>
<td>physics</td>
<td class="mid">Boolean</td>
<td class="mid"><code>true</code></td>
<td>When true, the edge is part of the physics simulation. When false, it will not act as a spring.</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','scaling', this);">
<td><span parent="scaling" class="right-caret"></span> scaling</td>
<td class="mid">Object</td>
<td class="mid"><code>Object</code></td>
<td>If the <code>value</code> option is specified, the width of the edges will be scaled according to the
properties in this object. Keep in mind that when using scaling, the <code>width</code> option is
neglected.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent">scaling.min</td>
<td class="mid">Number</td>
<td class="mid"><code>1</code></td>
<td>If edges have a value, their widths are determined by the value, the scaling function and the min max
values. The min value is the minimum allowed value.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent">scaling.max</td>
<td class="mid">Number</td>
<td class="mid"><code>15</code></td>
<td>This is the maximum allowed width when the edges are scaled using the value option.</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent">scaling.label</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>When false, the label is not allowed to scale with the edge. If true it will scale using default
settigns. For further customization, you can supply an object.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent2">scaling.label.enabled</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of
the properties in this object are defined.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent2">scaling.label.min</td>
<td class="mid">Number</td>
<td class="mid"><code>14</code></td>
<td>The minimum font-size used for labels when scaling.</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent2">scaling.label.max</td>
<td class="mid">Number</td>
<td class="mid"><code>30</code></td>
<td>The maximum font-size used for labels when scaling.</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent2">scaling.label.maxVisible</td>
<td class="mid">Number</td>
<td class="mid"><code>30</code></td>
<td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this
option. If set to 30, the font will never look larger than size 30 zoomed at 100%.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent2">scaling.label.drawThreshold</td>
<td class="mid">Number</td>
<td class="mid"><code>3</code></td>
<td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn.
When using font scaling, you can use this together with the maxVisible to first show labels of important
edges when zoomed out and only show the rest when zooming in.
</td>
</tr>
<tr parent="scaling" class="hidden">
<td class="indent">scaling.customScalingFunction</td>
<td class="mid">Function</td>
<td class="mid">in description</td>
<td>If edges have <code>value</code> fields, this function determines how the size of the nodes are scaled
based on their values. The default function is:
<pre>
function (min,max,total,value) {
if (max === min) {
@ -127,45 +416,158 @@ function (min,max,total,value) {
}
}
</pre>
The function receives the minimum value of the set, the maximum value, the total sum of all values and finally the value of the node or edge it works on. <b>It has to return a value between 0 and 1.</b> The nodes and edges then calculate their size as follows:
The function receives the minimum value of the set, the maximum value, the total sum of all values and
finally the value of the node or edge it works on. <b>It has to return a value between 0 and 1.</b> The
nodes and edges then calculate their size as follows:
<pre>
var scale = customScalingFunction(min,max,total,value);
var diff = maxWidth - minWidth;
myWidth = minWidth + diff * scale;
</pre>
</td></tr>
<tr><td>selfReferenceSize</td> <td class="mid">Number</td> <td class="mid"><code>false</code></td> <td>When the to and from nodes are the same, a circle is drawn. This is the radius of that circle.</td></tr>
<tr><td>shadow</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td><td>When true, the edge casts a shadow using the default settings. This can be further refined by supplying an object.</td></tr>
<tr><td>shadow.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr><td>shadow.size</td> <td class="mid">Number</td> <td class="mid"><code>10</code></td> <td>The blur size of the shadow.</td></tr>
<tr><td>shadow.x</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The x offset.</td></tr>
<tr><td>shadow.y</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The y offset.</td></tr>
<tr><td>smooth</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td><td>When true, the edge is drawn as a quadratic bezier curve. The drawing of these curves takes longer than that of straight curves but it looks better.
There is a difference between dynamic smooth curves and static smooth curves. The dynamic smooth curves have an invisible support node that takes part in the physics simulation. If you have a lot of edges, you may want to consider turning off dynamic smooth curves for performance.</td></tr>
<tr><td>smooth.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle smooth curves on and off. This is an optional option. If any of the other properties in this object are set, this option will be set to true.</td></tr>
<tr><td>smooth.dynamic</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the edges will have an invisible support node guiding the shape. This node is part of the physics simulation. When false, there are a number of different approximations for smooth curves. Those can be selected in the type property.</td></tr>
<tr><td>smooth.type</td> <td class="mid">String</td> <td class="mid"><code>'continuous'</code></td> <td>Possible options: <code>'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW'</code>. Take a look at our example 26 to see what these look like and pick the one that you like best! <i>These do not do anything for dynamic smooth curves</i>.</td></tr>
<tr><td>smooth.roundness</td> <td class="mid">Number</td> <td class="mid"><code>0.5</code></td> <td>Accepted range: <code>0 .. 1.0</code>. This parameter tweaks the roundness of the static smooth curves.</td></tr>
<tr><td>title</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>The title is shown in a pop-up when the mouse moves over the edge.</td></tr>
<tr><td>width</td> <td class="mid">Number</td> <td class="mid"><code>1</code></td> <td>The width of the edge. If value is set, this is not used.</td></tr>
<tr><td>widthSelectionMultiplier</td><td class="mid">Number</td> <td class="mid"><code>2</code></td> <td>When you select the edge, the width will be the normal width * widthSelectionMultiplier.</td></tr>
<tr><td>value</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>When a value is set, the edges' width will be scaled using the options in the scaling object defined above.</td></tr>
</td>
</tr>
<tr>
<td>selectionWidth</td>
<td class="mid">Number or Function</td>
<td class="mid"><code>1</code></td>
<td>The selectionWidth determines the width of the edge when the edge is selected. If a number is supplied,
this number will be <b>added</b> to the width.
Because the width can be altered by the value and the scaling functions, a constant multiplier or added
value may not give the best results. To solve this, you can supply a function. Example:
<pre class="code">
var options: {
edges: {
selectionWidth: function (width) {return width*2;}
}
}
</pre>
It receives the <code>Number width</code> of the edge. In this simple example multiply the width by 2.
You can taylor the logic in the function as long as it returns a <code>Number</code>.
</td>
</tr>
<tr>
<td>selfReferenceSize</td>
<td class="mid">Number</td>
<td class="mid"><code>false</code></td>
<td>When the to and from nodes are the same, a circle is drawn. This is the radius of that circle.</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','shadow', this);">
<td><span parent="shadow" class="right-caret"></span> shadow</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>When true, the edge casts a shadow using the default settings. This can be further refined by supplying
an object.
</td>
</tr>
<tr parent="shadow" class="hidden">
<td class="indent">shadow.enabled</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties
in this object are defined.
</td>
</tr>
<tr parent="shadow" class="hidden">
<td class="indent">shadow.size</td>
<td class="mid">Number</td>
<td class="mid"><code>10</code></td>
<td>The blur size of the shadow.</td>
</tr>
<tr parent="shadow" class="hidden">
<td class="indent">shadow.x</td>
<td class="mid">Number</td>
<td class="mid"><code>5</code></td>
<td>The x offset.</td>
</tr>
<tr parent="shadow" class="hidden">
<td class="indent">shadow.y</td>
<td class="mid">Number</td>
<td class="mid"><code>5</code></td>
<td>The y offset.</td>
</tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','smooth', this);">
<td><span parent="smooth" class="right-caret"></span> smooth</td>
<td class="mid">Object or Boolean</td>
<td class="mid"><code>Object</code></td>
<td>When true, the edge is drawn as a quadratic bezier curve. The drawing of these curves takes longer than
that of straight curves but it looks better.
There is a difference between dynamic smooth curves and static smooth curves. The dynamic smooth curves
have an invisible support node that takes part in the physics simulation. If you have a lot of edges,
you may want to consider turning off dynamic smooth curves for performance.
</td>
</tr>
<tr parent="smooth" class="hidden">
<td class="indent">smooth.enabled</td>
<td class="mid">Boolean</td>
<td class="mid"><code>true</code></td>
<td>Toggle smooth curves on and off. This is an optional option. If any of the other properties in this
object are set, this option will be set to true.
</td>
</tr>
<tr parent="smooth" class="hidden">
<td class="indent">smooth.dynamic</td>
<td class="mid">Boolean</td>
<td class="mid"><code>false</code></td>
<td>When true, the edges will have an invisible support node guiding the shape. This node is part of the
physics simulation. When false, there are a number of different approximations for smooth curves. Those
can be selected in the type property.
</td>
</tr>
<tr parent="smooth" class="hidden">
<td class="indent">smooth.type</td>
<td class="mid">String</td>
<td class="mid"><code>'continuous'</code></td>
<td>Possible options: <code>'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal',
'vertical', 'curvedCW', 'curvedCCW'</code>. Take a look at our example 26 to see what these look like
and pick the one that you like best! <i>These do not do anything for dynamic smooth curves</i>.
</td>
</tr>
<tr parent="smooth" class="hidden">
<td class="indent">smooth.roundness</td>
<td class="mid">Number</td>
<td class="mid"><code>0.5</code></td>
<td>Accepted range: <code>0 .. 1.0</code>. This parameter tweaks the roundness of the static smooth curves.
</td>
</tr>
<tr>
<td>title</td>
<td class="mid">String</td>
<td class="mid"><code>undefined</code></td>
<td>The title is shown in a pop-up when the mouse moves over the edge.</td>
</tr>
<tr>
<td>value</td>
<td class="mid">Number</td>
<td class="mid"><code>undefined</code></td>
<td>When a value is set, the edges' width will be scaled using the options in the scaling object defined
above.
</td>
</tr>
<tr>
<td>width</td>
<td class="mid">Number</td>
<td class="mid"><code>1</code></td>
<td>The width of the edge. If value is set, this is not used.</td>
</tr>
</table>
<h3>Methods</h3>
<p>The nodes module has no methods.</p>
<h3>Events</h3>
<p>The nodes module emits no events. Click and select events are emitted from the interaction and selection modules.</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>The nodes module emits no events. Click and select events are emitted from the interaction and selection
modules.</p>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</div>
<!-- Bootstrap core JavaScript

+ 66
- 21
docs/network/groups.html View File

@ -1,5 +1,19 @@
<!DOCTYPE html>
<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">
<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">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -26,9 +40,7 @@
</script>
<style>
td.properties {
width:350px;
}
</style>
</head>
<!-- NAVBAR
@ -40,7 +52,8 @@
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -51,7 +64,9 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<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>
<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>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
@ -66,19 +81,45 @@
</div>
</div>
<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>
<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>
<div class="container full">
<h1>Network - groups</h1>
<p>Handles the HTML part of the canvas.</p>
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr>
<tr><td>useDefaultGroups</td><td class="mid">Boolean</td><td class="mid"><code>true</code></td><td>If your nodes have groups defined that are not in the Groups module, the module loops over the groups it does have, allocating one for each unknown group. When all are used, it goes back to the first group. By setting this to false, the default groups will not be used in this cycle.</td></tr>
<tr><td>group*</td><td class="mid">Object</td><td class="mid"><code></code></td><td>
You can add multiple groups containing styling information that applies to a certain subset of groups. All options described in the <a href="./nodes.html">nodes module</a> that make sense can be used here (you're not going to set the same id or x,y position for a group of nodes).
Example:
<tr class="header">
<td class="name">name</td>
<td class="type">type</td>
<td class="default">default</td>
<td class="description">description</td>
</tr>
<tr>
<td>useDefaultGroups</td>
<td class="mid">Boolean</td>
<td class="mid"><code>true</code></td>
<td>If your nodes have groups defined that are not in the Groups module, the module loops over the groups it
does have, allocating one for each unknown group. When all are used, it goes back to the first group. By
setting this to false, the default groups will not be used in this cycle.
</td>
</tr>
<tr>
<td>group*</td>
<td class="mid">Object</td>
<td class="mid"><code></code></td>
<td>
You can add multiple groups containing styling information that applies to a certain subset of groups.
All options described in the <a href="./nodes.html">nodes module</a> that make sense can be used here
(you're not going to set the same id or x,y position for a group of nodes).
Example:
<pre class="code">
var nodes = [
{id:1, group:'myGroup', label:"I'm in a custom group called 'myGroup'!"}
@ -90,23 +131,27 @@ var options = {
}
}
</pre>
*) the option is not called group, as shown by the example but can by any custom id, except for 'useDefaultGroups'.
<td></tr>
*) the option is not called group, as shown by the example but can by any custom id, except for
'useDefaultGroups'.
</td>
</tr>
</table>
<h3>Methods</h3>
<p>The groups module has no methods.</p>
<h3>Events</h3>
<p>The groups module has no events.</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</div>
<!-- Bootstrap core JavaScript

+ 13
- 12
docs/network/interaction.html View File

@ -25,11 +25,10 @@
</script>
<style>
td.properties {
width:350px;
}
</style>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
================================================== -->
@ -73,20 +72,20 @@
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td> <td>type</td> <td>default</td> <td>description</td></tr>
<table class="moduleTable" id="optionTable">
<tr class="header"><td class="name">name</td><td class="type">type</td><td class="default">default</td><td class="description">description</td></tr>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','keyboard', this);"><td><span parent="keyboard" class="right-caret"></span> keyboard</td> <td class="mid">Object or 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>
<tr parent="keyboard" class="hidden"><td class="indent">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>
<tr parent="keyboard" class="hidden"><td class="indent">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>
<tr parent="keyboard" class="hidden"><td class="indent">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>
<tr parent="keyboard" class="hidden"><td class="indent">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>
<tr parent="keyboard" class="hidden"><td class="indent">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>
</table>
<h3>Methods</h3>
@ -95,7 +94,7 @@
<h3>Events</h3>
<p>These events are fired by the interaction module. They are related to user input.</p>
<table class="moduleTable">
<tr class="header"><td>name</td><td class="properties">properties</td><td>description</td></tr>
<tr class="header"><td class="eventName">name</td><td class="eventProperties">properties</td><td>description</td></tr>
<tr><td>click</td> <td class="mid">
<pre class="code">
{
@ -133,6 +132,8 @@
<tr><td>dragStart</td> <td class="mid">same as <code>click</code>.</td><td>Fired when starting a drag.</td></tr>
<tr><td>dragEnd</td> <td class="mid">same as <code>click</code>.</td><td>Fired when the drag has finished.</td></tr>
<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>
<tr><td>showPopup</td> <td class="mid"><code>id of item corresponding to popup</code></td><td>Fired when the popup is shown.</td></tr>
<tr><td>hidePopup</td> <td class="mid">none</td> <td>Fired when the popup is hidden.</td></tr>
</table>
<br />

+ 8
- 23
docs/network/layout.html View File

@ -24,22 +24,7 @@
smoothScroll.init();
</script>
<style>
pre.code {
padding:2px 4px;
font-size:90%;
color:#c7254e;
background-color:#f9f2f4;
border-radius:4px;
border:0px;
}
td.method {
width:250px;
}
</style>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
================================================== -->
@ -83,14 +68,14 @@
<h3>Options</h3>
<p>When enabling the hierarchical layout, it overrules some of the other options. The physics is set to the hierarchical repulsion solver and dynamic smooth edges are converted to static smooth edges.</p>
<table class="moduleTable">
<tr class="header"><td>name</td><td>type</td><td>default</td><td>description</td></tr>
<table class="moduleTable" id="optionTable">
<tr class="header"><td class="name">name</td><td class="type">type</td><td class="default">default</td><td class="description">description</td></tr>
<tr><td>randomSeed</td><td class="mid">Number</td><td class="mid"><code>undefined</code></td> <td>When NOT using the hierarchical layout, the nodes are randomly positioned initially. This means that the settled result is different every time. If you provide a random seed manually, the layout will be the same every time. Ideally you try with an undefined seed, reload until you are happy with the layout and use the <code>getSeed()</code> method to ascertain the seed.</td></tr>
<tr><td>hierarchical</td><td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.</td></tr>
<tr><td>hierarchical.enabled</td><td class="mid">Boolean</td><td class="mid"><code>false</code></td> <td>Toggle the usage of the hierarchical layout system. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr><td>hierarchical.levelSeparation</td><td class="mid">Number</td><td class="mid"><code>150</code></td> <td>The distance between the different levels.</td></tr>
<tr><td>hierarchical.direction</td><td class="mid">String</td><td class="mid"><code>'UD'</code></td> <td>The direction of the hierarchical layout. The available options are: <code>UD, DU, LR, RL</code>. To simplify: up-down, down-up, left-right, right-left.</td></tr>
<tr><td>hierarchical.sortMethod</td><td class="mid">String</td><td class="mid"><code>'hubsize'</code></td> <td>The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: <code>hubsize, directed</code>. <br><br>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','hierarchical', this);"><td><span parent="repulsion" class="right-caret"></span> hierarchical</td><td class="mid">Object or Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.</td></tr>
<tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.enabled</td><td class="mid">Boolean</td><td class="mid"><code>false</code></td> <td>Toggle the usage of the hierarchical layout system. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.levelSeparation</td><td class="mid">Number</td><td class="mid"><code>150</code></td> <td>The distance between the different levels.</td></tr>
<tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.direction</td><td class="mid">String</td><td class="mid"><code>'UD'</code></td> <td>The direction of the hierarchical layout. The available options are: <code>UD, DU, LR, RL</code>. To simplify: up-down, down-up, left-right, right-left.</td></tr>
<tr parent="hierarchical" class="hidden"><td class="indent">hierarchical.sortMethod</td><td class="mid">String</td><td class="mid"><code>'hubsize'</code></td> <td>The algorithm used to ascertain the levels of the nodes based on the data. The possible options are: <code>hubsize, directed</code>. <br><br>
Hubsize takes the nodes with the most edges and puts them at the top. From that the rest of the hierarchy is evaluated. <br><br>
Directed adheres to the to and from data of the edges. A --> B so B is a level lower than A.</td></tr>
</table>

+ 192
- 0
docs/network/manipulation.html View File

@ -0,0 +1,192 @@
<!DOCTYPE html>
<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">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" HREF="favicon.ico">
<title>vis.js - A dynamic, browser based visualization library.</title>
<!-- Bootstrap core CSS -->
<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/newdocs.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="../js/smooth-scroll.min.js"></script>
<script language="JavaScript">
smoothScroll.init();
</script>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
================================================== -->
<body>
<div class="navbar-wrapper">
<div class="container">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand hidden-sm" href="./index.html">vis.js</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="../index.html#modules">Modules</a></li>
<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>
<li><a href="../blog.html">Blog</a></li>
<li><a href="../index.html#download_install">Download</a></li>
<li><a href="../showcase/index.html">Showcase</a></li>
<li><a href="../index.html#contribute">Contribute</a></li>
<li><a href="../featureRequests.html">Feature requests</a></li>
<li><a href="../index.html#licenses">License</a></li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<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>
<div class="container full">
<h1>Network - manipulation</h1>
<p>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</p>
<h3>Options</h3>
<p>When enabling the hierarchical layout, it overrules some of the other options. The physics is set to the hierarchical repulsion solver and dynamic smooth edges are converted to static smooth edges.</p>
<table class="moduleTable" id="optionTable">
<tr class="header"><td class="name">name</td><td class="type">type</td><td class="default">default</td><td class="description">description</td></tr>
<tr><td>enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the manipulation system on or off. This property is optional. If you define any of the options below and enabled is undefined, this will be set to true.</td></tr>
<tr><td>initiallyActive</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle whether the toolbar is visible initially or if only the edit button is visible initially.</td></tr>
<tr><td>locale</td> <td class="mid">String</td> <td class="mid"><code>'en'</code></td> <td>Select the locale. By default, the language is English. If you want to use another language, you will need to define your own locale and refer to it here.</td></tr>
<tr><td>locales</td> <td class="mid">Object</td> <td class="mid">defaultLocales</td> <td>Locales object. By default only <code>'en'</code> and <code>'nl'</code> are supported. Take a look at the <a href="#locales" data-scroll="" data-options="{ &quot;easing&quot;: &quot;easeInCubic&quot; }">locales section below</a> for more explaination on how to customize this.</td></tr>
<tr><td>functionality</td> <td class="mid">Object</td> <td class="mid">Object</td> <td>You can use this object to switch certain functionalities on or off. By default they are all on.</td></tr>
<tr><td>functionality.addNode</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the adding of nodes.</td></tr>
<tr><td>functionality.addEdge</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the adding of edges.</td></tr>
<tr><td>functionality.editNode</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the editing of nodes. Even if this is enabled, it will only be shown if a handler function is set for <code>editNode</code>.</td></tr>
<tr><td>functionality.editEdge</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the editing of edges.</td></tr>
<tr><td>functionality.deleteNode</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the deletion of nodes.</td></tr>
<tr><td>functionality.deleteEdge</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the deletion of edges.</td></tr>
<tr><td>handlerFunctions</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>These functions are inserted before the action is performed. If a node is going to be added through the manipulation system, the addNode function will be called first. With this, you can provide a gui for your users, abort the process or anything else you want to do.</td></tr>
<tr><td>handlerFunctions.addNode</td> <td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when the user clicks the canvas in 'addNode' mode. This function will receive two variables: the properties of the node that can be created and a callback function. If you call the callback function with the properties of the new node, the node will be added. <br><br> Example:
<pre class="code">
var options = {
handlerFunctions: {
addNode: function(nodeData,callback) {
nodeData.label = 'hello world';
callback(nodeData);
}
}
}
</pre>
If you do not want the node created, do not call the callback function or call the callback function <pre>null</pre> or no argument.
</td></tr>
<tr><td>handlerFunctions.addEdge</td> <td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when the user drags the new edge from one node to the next in 'addEdge' mode. This function will receive two variables: the properties of the edge that can be created and a callback function. If you call the callback function with the properties of the new edge, the edge will be added. <br><br> Example:
<pre class="code">
var options = {
handlerFunctions: {
addEdge: function(edgeData,callback) {
if (edgeData.from === edgeData.to) {
var r = confirm("Do you want to connect the node to itself?");
if (r === true) {
callback(edgeData);
}
}
else {
callback(edgeData);
}
}
}
}
</pre>
This example code will show a popup if you connect a node to itself to ask you if that was what you wanted. If you do not want the edge created, do not call the callback function or call the callback function <pre>null</pre> or no argument.</td></tr>
<tr><td>handlerFunctions.editNode</td> <td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when a node is selected and the 'Edit Node' button on the toolbar is pressed. This function will be called like the <code>addNode</code> function with the node's data and a callback function.</td></tr>
<tr><td>handlerFunctions.editEdge</td> <td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when an edge is selcted and the 'Edit Edge' button on the toolbar is pressed. This function will be called in the same way the <code>addEdge</code> function was called. If the callback is not performed, the edge will remain hanging where it was released. To cancel, call the callback function with <pre>null</pre> as argument or without arguments.</pre></td></tr>
<tr><td>handlerFunctions.deleteNode</td><td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when a node is selected and the 'Delete selected' button is pressed.</td></tr>
<tr><td>handlerFunctions.deleteEdge</td><td class="mid">Function</td> <td class="mid"><code>undefined</code></td> <td>Called when an edge is selected and the 'Delete selected' button is pressed.</td></tr>
<tr><td>controlNodeStyle</td> <td class="mid">Object</td> <td class="mid">Object</td><td>You can supply any styling information you'd like here. All fields described in <a href="./nodes.html">the nodes module</a> are allowed except obviously for id, x, y and fixed. <br><br>Default:
<pre class="code">
{
shape:'dot',
size:6,
color: {
background: '#ff0000',
border: '#3c3c3c',
highlight: {
background: '#07f968',
border: '#3c3c3c'
}
},
borderWidth: 2,
borderWidthSelected: 2
}
</pre></td></tr>
</table>
<h3>Methods</h3>
<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>
<table class="moduleTable">
<tr class="header"> <td class="method">name</td><td>returns</td><td>description</td></tr>
<tr><td>enableEditMode()</td> <td class="mid">none</td><td>Programatically enable the edit mode. Similar effect to pressing the edit button.</td></tr>
<tr><td>disableEditMode()</td><td class="mid">none</td><td>Programatically disable the edit mode. Similar effect to pressing the close icon (small cross in the corner of the toolbar).</td></tr>
<tr><td>addNodeMode()</td> <td class="mid">none</td><td>Go into addNode mode. Having edit mode or manipulation enabled is not required. To get out of this mode, call <code>disableEditMode()</code>. The callback functions defined in <code>handlerFunctions</code> still apply. To use these methods without having the manipulation GUI, make sure you set <code>enabled</code> to false. </td></tr>
<tr><td>editNodeMode()</td> <td class="mid">none</td><td>Go into editNode mode. The explaination from <code>addNodeMode</code> applies here as well.</td></tr>
<tr><td>addEdgeMode()</td> <td class="mid">none</td><td>Go into addEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td></tr>
<tr><td>editEdgeMode()</td> <td class="mid">none</td><td>Go into editEdge mode. The explaination from <code>addNodeMode</code> applies here as well.</td></tr>
<tr><td>deleteSelected()</td> <td class="mid">none</td><td>Delete selected. Having edit mode or manipulation enabled is not required.</td></tr>
</table>
<h3>Events</h3>
<p>There are no events emitted by the layout module.</p>
<h3 id="locales">Locales</h3>
<p>The locales object has the following format:</p>
<pre class="code">
var locales = {
en: {
edit: 'Edit',
del: 'Delete selected',
back: 'Back',
addNode: 'Add Node',
addEdge: 'Add Edge',
editNode: 'Edit Node',
editEdge: 'Edit Edge',
addDescription: 'Click in an empty space to place a new node.',
edgeDescription: 'Click on a node and drag the edge to another node to connect them.',
editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.',
createEdgeError: 'Cannot link edges to a cluster.',
deleteClusterError: 'Clusters cannot be deleted.',
editClusterError: 'Clusters cannot be edited.'
}
}</pre>
<p>If you want to define your own locale, you can change the key ('en' here) and change all the string. You can then use your new key in the locale option.</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../js/ie10-viewport-bug-workaround.js"></script>

+ 12
- 19
docs/network/new_network.html View File

@ -25,12 +25,6 @@
</script>
<style>
td.blue {
background-color: #89b3ff;
}
td.gren {
background-color: #bfffc7;
}
</style>
</head>
<!-- NAVBAR
@ -77,19 +71,18 @@
<h3>Modules</h3>
<table class="moduleTable">
<tr><td width="120px" class="gren"><a href="./canvas.html">canvas</a></td> <td>Handles the HTML part of the network.</td></tr>
<tr><td class="gren"><a href="./configure.html">configure</a></td> <td>Generates an interactive option editor with filtering.</td></tr>
<tr><td class="gren"><a href="./rendering.html">rendering</a></td> <td>Handles the rendering aspect of vis. It governs the render loop, it draws the nodes and edges and provides events to allow users to hook into the drawing.</td></tr>
<tr><td class="gren"><a href="./groups.html">groups</a></td> <td>Contains the groups and some options on how to handle nodes with non-existing groups.</td></tr>
<tr><td class="gren"><a href="./nodes.html">nodes</a></td> <td>Handles the creation and deletion of nodes and contains the global node options and styles.</td></tr>
<tr><td class="gren"><a href="./edges.html">edges</a></td> <td>Handles the creation and deletion of edges and contains the global edge options and styles.</td></tr>
<tr><td class="gren"><a href="./layout.html">layout</a></td> <td>Governs the initial and hierarchical positioning.</td></tr>
<tr><td class="gren"><a href="./physics.html">physics</a></td> <td>Does all the simulation moving the nodes and edges to their final positions, also governs stabilization.</td></tr>
<tr><td class="gren"><a href="./view.html">view</a></td> <td>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</td></tr>
<tr><td class="gren"><a href="./interaction.html">interaction</a></td> <td>Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups.</td></tr>
<tr><td class="gren"><a href="./selection.html">selection</a></td> <td>Handles the selection of nodes and edges.</td></tr>
<tr><td class="gren"><a href="./clustering.html">clustering</a></td> <td>Provides the clustering api, giving users full control over the formed clusters.</td></tr>
<tr><td class="blue"><a href="./manipulation.html">manipulation</a></td> <td>Supplies an API and optional GUI to alter the data in the network.</td></tr>
<tr><td><a href="./clustering.html">clustering</a></td> <td>Provides the clustering api, giving users full control over the formed clusters.</td></tr>
<tr><td><a href="./configure.html">configure</a></td> <td>Generates an interactive option editor with filtering.</td></tr>
<tr><td><a href="./edges.html">edges</a></td> <td>Handles the creation and deletion of edges and contains the global edge options and styles.</td></tr>
<tr><td><a href="./groups.html">groups</a></td> <td>Contains the groups and some options on how to handle nodes with non-existing groups.</td></tr>
<tr><td><a href="./interaction.html">interaction</a></td> <td>Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups.</td></tr>
<tr><td><a href="./layout.html">layout</a></td> <td>Governs the initial and hierarchical positioning.</td></tr>
<tr><td><a href="./manipulation.html">manipulation</a></td> <td>Supplies an API and optional GUI to alter the data in the network.</td></tr>
<tr><td><a href="./nodes.html">nodes</a></td> <td>Handles the creation and deletion of nodes and contains the global node options and styles.</td></tr>
<tr><td><a href="./physics.html">physics</a></td> <td>Does all the simulation moving the nodes and edges to their final positions, also governs stabilization.</td></tr>
<tr><td><a href="./rendering.html">rendering</a></td> <td>Handles the rendering aspect of vis. It governs the render loop, it draws the nodes and edges and provides events to allow users to hook into the drawing.</td></tr>
<tr><td><a href="./view.html">view</a></td> <td>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</td></tr>
<tr><td><a href="./selection.html">selection</a></td> <td>Handles the selection of nodes and edges.</td></tr>
</table>
<h3>All Methods</h3>

+ 48
- 44
docs/network/nodes.html View File

@ -24,9 +24,7 @@
smoothScroll.init();
</script>
<style>
</style>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
================================================== -->
@ -70,57 +68,63 @@
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable">
<tr class="header"><td>name</td> <td>type</td> <td>default</td> <td>description</td></tr>
<table class="moduleTable" id="optionTable">
<tr class="header">
<td class="name">name</td>
<td class="type">type</td>
<td class="default">default</td>
<td class="description">description</td>
</tr>
<tr><td>borderWidth</td> <td class="mid">Number</td> <td class="mid"><code>1</code></td> <td>The width of the border of the node.</td></tr>
<tr><td>borderWidthSelected</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>The width of the border of the node when it is selected. When undefined, the borderWidth is used</td></tr>
<tr><td>brokenImage</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option can be an URL to a backup image in case the URL supplied in the image option cannot be resolved.</td></tr>
<tr><td>color</td> <td class="mid">Object | String</td><td class="mid"><code>Object</code></td> <td>The color object contains the color information of the node in every situation. When the node only needs a single color, a color value like <code>'rgba(120,32,14,1)'</code>, <code>'#ffffff'</code> or <code>'red'</code> can be supplied instead of an object.</td></tr>
<tr><td>color.border</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>color.background</td> <td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when it is not selected or hovered over <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>color.highlight</td> <td class="mid">Object | String</td><td class="mid"><code>Object</code></td> <td>The color the node when it is selected. Alternatively you can just supply a string color value.</td></tr>
<tr><td>color.highlight.border</td><td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when it is selected.</td></tr>
<tr><td>color.highlight.background</td><td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when it is selected.</td></tr>
<tr><td>color.hover</td> <td class="mid">Object/String</td><td class="mid"><code>Object</code></td> <td>The color the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>. Shorthand like above is also supported.</td></tr>
<tr><td>color.hover.border</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>color.hover.background</td> <td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','color', this);"><td><span parent="color" class="right-caret"></span> color</td> <td class="mid">Object or String</td><td class="mid"><code>Object</code></td> <td>The color object contains the color information of the node in every situation. When the node only needs a single color, a color value like <code>'rgba(120,32,14,1)'</code>, <code>'#ffffff'</code> or <code>'red'</code> can be supplied instead of an object.</td></tr>
<tr parent="color" class="hidden"><td class="indent">color.border</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when it is not selected or hovered over <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr parent="color" class="hidden"><td class="indent">color.background</td> <td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when it is not selected or hovered over <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr parent="color" class="hidden"><td class="indent">color.highlight</td> <td class="mid">Object or String</td><td class="mid"><code>Object</code></td> <td>The color the node when it is selected. Alternatively you can just supply a string color value.</td></tr>
<tr parent="color" class="hidden"><td class="indent2">color.highlight.border</td><td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when it is selected.</td></tr>
<tr parent="color" class="hidden"><td class="indent2">color.highlight.background</td><td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when it is selected.</td></tr>
<tr parent="color" class="hidden"><td class="indent">color.hover</td> <td class="mid">Object or String</td><td class="mid"><code>Object</code></td> <td>The color the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>. Shorthand like above is also supported.</td></tr>
<tr parent="color" class="hidden"><td class="indent2">color.hover.border</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the border of the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr parent="color" class="hidden"><td class="indent2">color.hover.background</td> <td class="mid">String</td> <td class="mid"><code>'#D2E5FF'</code></td> <td>The color of the background of the node when the mouse hovers over it <i>(assuming hover is enabled in the interaction module)</i>.</td></tr>
<tr><td>fixed</td> <td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the node will not move but IS part of the physics simulation. When defined as an object, movement in either X or Y direction can be disabled.</td></tr>
<tr><td>fixed.x</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the node will not move in the X direction.</td></tr>
<tr><td>fixed.y</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the node will not move in the Y direction.</td></tr>
<tr><td>font</td> <td class="mid">Object | String</td><td class="mid"><code>false</code></td> <td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face color'</code> for example: <code>'14px arial red'</code>.</td></tr>
<tr><td>font.color</td> <td class="mid">String</td> <td class="mid"><code>'#343434'</code></td> <td>Color of the label text.</td></tr>
<tr><td>font.size</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>Size of the label text.</td></tr>
<tr><td>font.face</td> <td class="mid">String</td> <td class="mid"><code>'arial'</code></td> <td>Font face (or font family) of the label text.</td></tr>
<tr><td>font.background</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind the label in the supplied color.</td></tr>
<tr><td>font.stroke</td> <td class="mid">Number</td> <td class="mid"><code>0</code></td> <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value higher than 0 is supplied, the stroke will be drawn.</td></tr>
<tr><td>font.strokeColor</td> <td class="mid">String</td> <td class="mid"><code>'#ffffff'</code></td> <td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','fixed', this);"><td><span parent="fixed" class="right-caret"></span> fixed</td> <td class="mid">Object or Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the node will not move but IS part of the physics simulation. When defined as an object, movement in either X or Y direction can be disabled.</td></tr>
<tr parent="fixed" class="hidden"><td class="indent">fixed.x</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the node will not move in the X direction.</td></tr>
<tr parent="fixed" class="hidden"><td class="indent">fixed.y</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the node will not move in the Y direction.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','font', this);"><td><span parent="font" class="right-caret"></span> font</td> <td class="mid">Object or String</td><td class="mid"><code>false</code></td> <td>This object defines the details of the label. A shorthand is also supported in the form <code>'size face color'</code> for example: <code>'14px arial red'</code>.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.color</td> <td class="mid">String</td> <td class="mid"><code>'#343434'</code></td> <td>Color of the label text.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.size</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>Size of the label text.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.face</td> <td class="mid">String</td> <td class="mid"><code>'arial'</code></td> <td>Font face (or font family) of the label text.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.background</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>When not <code>undefined</code> but a <b>color string</b>, a background rectangle will be drawn behind the label in the supplied color.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.stroke</td> <td class="mid">Number</td> <td class="mid"><code>0</code></td> <td>As an alternative to the background rectangle, a stroke can be drawn around the text. When a value higher than 0 is supplied, the stroke will be drawn.</td></tr>
<tr parent="font" class="hidden"><td class="indent">font.strokeColor</td> <td class="mid">String</td> <td class="mid"><code>'#ffffff'</code></td> <td>This is the color of the stroke <i>assuming the value for stroke is higher than 0</i>.</td></tr>
<tr><td>group</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>When not <code>undefined</code>, the</td></tr>
<tr><td>hidden</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>When true, the node will not be shown. It will still be part of the physics simulation though!</td></tr>
<tr><td>icon.face</td> <td class="mid">String</td> <td class="mid"><code>'FontAwesome'</code></td><td>These options are only used when the shape is set to <code>icon</code>. The possible options for the face are: <code>'FontAwesome'</code> and <code>'Ionicons'</code>.</td></tr>
<tr><td>icon.code</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>This is the code of the icon, for example <code>'\uf007'</code>.</td></tr>
<tr><td>icon.size</td> <td class="mid">Number</td> <td class="mid"><code>50</code></td> <td>The size of the icon.</td></tr>
<tr><td>icon.color</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the icon.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','icon', this);"><td><span parent="icon" class="right-caret"></span> icon</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td><td>These options are only used when the shape is set to <code>icon</code>.</td></tr>
<tr parent="icon" class="hidden"><td class="indent">icon.face</td> <td class="mid">String</td> <td class="mid"><code>'FontAwesome'</code></td><td>These options are only used when the shape is set to <code>icon</code>. The possible options for the face are: <code>'FontAwesome'</code> and <code>'Ionicons'</code>.</td></tr>
<tr parent="icon" class="hidden"><td class="indent">icon.code</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>This is the code of the icon, for example <code>'\uf007'</code>.</td></tr>
<tr parent="icon" class="hidden"><td class="indent">icon.size</td> <td class="mid">Number</td> <td class="mid"><code>50</code></td> <td>The size of the icon.</td></tr>
<tr parent="icon" class="hidden"><td class="indent">icon.color</td> <td class="mid">String</td> <td class="mid"><code>'#2B7CE9'</code></td> <td>The color of the icon.</td></tr>
<tr><td>image</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>When the shape is set to <code>image</code> or <code>circularImage</code>, this option should be the URL to an image. If the image cannot be found, the brokenImage option can be used.</td></tr>
<tr><td>label</td> <td class="mid">String</td> <td class="mid"><code>undefined</code></td> <td>The label is the piece of text shown in or under the node, depending on the shape.</td></tr>
<tr><td>level</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>When using the hierarchical layout, the level determines where the node is going to be positioned.</td></tr>
<tr><td>mass</td> <td class="mid">Number</td> <td class="mid"><code>1</code></td> <td>The barnesHut physics model (which is enabled by default) is based on an inverted gravity model. By increasing the mass of a node, you increase it's repulsion. Values lower than 1 are not recommended.</td></tr>
<tr><td>physics</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>When false, the node is not part of the physics simulation. It will not move except for from manual dragging.</td></tr>
<tr><td>scaling</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>If the <code>value</code> option is specified, the size of the nodes will be scaled according to the properties in this object. All node shapes can be scaled, but some only when label scaling is enabled as their size is based on the size of the label.
<tr class='toggle collapsible' onclick="toggleTable('optionTable','scaling', this);"><td><span parent="scaling" class="right-caret"></span> scaling</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>If the <code>value</code> option is specified, the size of the nodes will be scaled according to the properties in this object. All node shapes can be scaled, but some only when label scaling is enabled as their size is based on the size of the label.
Only scalable when label scaling is enabled are:
<code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
Always scalable are:
<code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and <code>icon</code>. Keep in mind that when using scaling, the <code>size</code> option is neglected.</td></tr>
<tr><td>scaling.min</td> <td class="mid">Number</td> <td class="mid"><code>10</code></td> <td>If nodes have a value, their sizes are determined by the value, the scaling function and the min max values. The min value is the minimum allowed value.</td></tr>
<tr><td>scaling.max</td> <td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>This is the maximum allowed size when the nodes are scaled using the value option.</td></tr>
<tr><td>scaling.label</td> <td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td><td>This can be false if the label is not allowed to scale with the node. If true it will scale using default settigns. For further customization, you can supply an object.</td></tr>
<tr><td>scaling.label.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr><td>scaling.label.min</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>The minimum font-size used for labels when scaling.</td></tr>
<tr><td>scaling.label.max</td> <td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>The maximum font-size used for labels when scaling.</td></tr>
<tr><td>scaling.label.maxVisible</td><td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this option. If set to 30, the font will never look larger than size 30 zoomed at 100%.</td></tr>
<tr><td>scaling.label.drawThreshold</td><td class="mid">Number</td> <td class="mid"><code>3</code></td> <td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn. When using font scaling, you can use this together with the maxVisible to first show labels of important nodes when zoomed out and only show the rest when zooming in.</td></tr>
<tr><td>scaling.customScalingFunction</td> <td class="mid">Function</td> <td class="mid">in description</td> <td>If nodes have <code>value</code> fields, this function determines how the size of the nodes are scaled based on their values. The default function is:
<tr parent="scaling" class="hidden"><td class="indent">scaling.min</td> <td class="mid">Number</td> <td class="mid"><code>10</code></td> <td>If nodes have a value, their sizes are determined by the value, the scaling function and the min max values. The min value is the minimum allowed value.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent">scaling.max</td> <td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>This is the maximum allowed size when the nodes are scaled using the value option.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent">scaling.label</td> <td class="mid">Object or Boolean</td><td class="mid"><code>Object</code></td><td>This can be false if the label is not allowed to scale with the node. If true it will scale using default settigns. For further customization, you can supply an object.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent2">scaling.label.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent2">scaling.label.min</td> <td class="mid">Number</td> <td class="mid"><code>14</code></td> <td>The minimum font-size used for labels when scaling.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent2">scaling.label.max</td> <td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>The maximum font-size used for labels when scaling.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent2">scaling.label.maxVisible</td><td class="mid">Number</td> <td class="mid"><code>30</code></td> <td>When zooming in, the font is drawn larger as well. You can limit the perceived font size using this option. If set to 30, the font will never look larger than size 30 zoomed at 100%.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent2">scaling.label.drawThreshold</td><td class="mid">Number</td> <td class="mid"><code>3</code></td> <td>When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn. When using font scaling, you can use this together with the maxVisible to first show labels of important nodes when zoomed out and only show the rest when zooming in.</td></tr>
<tr parent="scaling" class="hidden"><td class="indent">scaling.customScalingFunction</td> <td class="mid">Function</td> <td class="mid">in description</td> <td>If nodes have <code>value</code> fields, this function determines how the size of the nodes are scaled based on their values. The default function is:
<pre>
function (min,max,total,value) {
if (max === min) {
@ -139,17 +143,17 @@ var diff = maxSize - minSize;
mySize = minSize + diff * scale;
</pre>
</td></tr>
<tr><td>shadow</td> <td class="mid">Object | Boolean</td> <td class="mid"><code>Object</code></td><td>When true, the node casts a shadow using the default settings. This can be further refined by supplying an object.</td></tr>
<tr><td>shadow.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr><td>shadow.size</td> <td class="mid">Number</td> <td class="mid"><code>10</code></td> <td>The blur size of the shadow.</td></tr>
<tr><td>shadow.x</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The x offset.</td></tr>
<tr><td>shadow.y</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The y offset.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','shadow', this);"><td><span parent="shadow" class="right-caret"></span> shadow</td> <td class="mid">Object or Boolean</td> <td class="mid"><code>Object</code></td><td>When true, the node casts a shadow using the default settings. This can be further refined by supplying an object.</td></tr>
<tr parent="shadow" class="hidden"><td class="indent">shadow.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>false</code></td> <td>Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties in this object are defined.</td></tr>
<tr parent="shadow" class="hidden"><td class="indent">shadow.size</td> <td class="mid">Number</td> <td class="mid"><code>10</code></td> <td>The blur size of the shadow.</td></tr>
<tr parent="shadow" class="hidden"><td class="indent">shadow.x</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The x offset.</td></tr>
<tr parent="shadow" class="hidden"><td class="indent">shadow.y</td> <td class="mid">Number</td> <td class="mid"><code>5</code></td> <td>The y offset.</td></tr>
<tr><td>shape</td> <td class="mid">String</td> <td class="mid"><code>'ellipse'</code></td> <td>The shape defines what the node looks like. There are two types of nodes. One type has the label inside of it and the other type has the label underneath it. The types with the label inside of it are:
<code>ellipse</code>, <code>circle</code>, <code>database</code>, <code>box</code>, <code>text</code>.
The ones with the label outside of it are: <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>, <code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and <code>icon</code>.</td></tr>
<tr><td>size</td> <td class="mid">Number</td> <td class="mid"><code>25</code></td> <td>The size is used to determine the size of node shapes that do not have the label inside of them. These shapes are: <code>image</code>, <code>circularImage</code>, <code>diamond</code>, <code>dot</code>,
<code>star</code>, <code>triangle</code>, <code>triangleDown</code>, <code>square</code> and <code>icon</code></td></tr>
<tr><td>title</td> <td class="mid">String | Element</td> <td class="mid"><code>undefined</code></td> <td>Title to be displayed when the user hovers over the node. The title can be an HTML element or a string containing plain text or HTML.</td></tr>
<tr><td>title</td> <td class="mid">String or Element</td> <td class="mid"><code>undefined</code></td> <td>Title to be displayed when the user hovers over the node. The title can be an HTML element or a string containing plain text or HTML.</td></tr>
<tr><td>value</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>When a value is set, the nodes will be scaled using the options in the scaling object defined above.</td></tr>
<tr><td>x</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>This gives a node an initial x position. When using the hierarchical layout, either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization, the stabilized position may be different from the initial one. To lock the node to that position use the physics or fixed options.</td></tr>
<tr><td>y</td> <td class="mid">Number</td> <td class="mid"><code>undefined</code></td> <td>This gives a node an initial y position. When using the hierarchical layout, either the x or y position is set by the layout engine depending on the type of view. The other value remains untouched. When using stabilization, the stabilized position may be different from the initial one. To lock the node to that position use the physics or fixed options.</td></tr>

+ 5
- 11
docs/network/physics.html View File

@ -25,12 +25,6 @@
smoothScroll.init();
</script>
<style>
td.properties {
width:350px;
}
</style>
<script type="text/javascript" src="../js/toggleTable.js"></script>
</head>
<!-- NAVBAR
@ -75,23 +69,23 @@
<h3>Options</h3>
<p>This is a list of all the methods in the public API. They are collected here from all individual modules.</p>
<table class="moduleTable" id="physicsTable">
<table class="moduleTable" id="optionTable">
<tr class="header"><td class="name">name</td><td class="type">type</td><td>default</td><td>description</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('physicsTable','barnesHut', this);"><td><span parent="barnesHut" class="right-caret"></span> barnesHut</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','barnesHut', this);"><td><span parent="barnesHut" class="right-caret"></span> barnesHut</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.gravitationalConstant</td> <td class="mid">Number</td> <td class="mid"><code>-2000</code></td> <td>Gravity attracts. We like repulsion. So the value is negative. If you want the repulsion to be stronger, decrease the value (so -10000, -50000).</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.centralGravity</td> <td class="mid">Number</td> <td class="mid"><code>0.3</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springLength</td> <td class="mid">Number</td> <td class="mid"><code>95</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.springConstant</td> <td class="mid">Number</td> <td class="mid"><code>0.04</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
<tr parent="barnesHut" class="hidden"><td class="indent">barnesHut.damping</td> <td class="mid">Number</td> <td class="mid"><code>0.09</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('physicsTable','repulsion', this);"><td><span parent="repulsion" class="right-caret"></span> repulsion</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','repulsion', this);"><td><span parent="repulsion" class="right-caret"></span> repulsion</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).</td></tr>
<tr parent="repulsion" class="hidden"><td class="indent">repulsion.nodeDistance</td> <td class="mid">Number</td> <td class="mid"><code>100</code></td> <td>This is the range of influence for the repulsion.</td></tr>
<tr parent="repulsion" class="hidden"><td class="indent">repulsion.centralGravity</td> <td class="mid">Number</td> <td class="mid"><code>0.2</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<tr parent="repulsion" class="hidden"><td class="indent">repulsion.springLength</td> <td class="mid">Number</td> <td class="mid"><code>200</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
<tr parent="repulsion" class="hidden"><td class="indent">repulsion.springConstant</td> <td class="mid">Number</td> <td class="mid"><code>0.05</code></td> <td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
<tr parent="repulsion" class="hidden"><td class="indent">repulsion.damping</td> <td class="mid">Number</td> <td class="mid"><code>0.09</code></td> <td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('physicsTable','hierarchicalRepulsion', this);"><td><span parent="hierarchicalRepulsion" class="right-caret"></span> hierarchicalRepulsion</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','hierarchicalRepulsion', this);"><td><span parent="hierarchicalRepulsion" class="right-caret"></span> hierarchicalRepulsion</td> <td class="mid">Object</td> <td class="mid"><code>Object</code></td> <td>This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.</td></tr>
<tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.nodeDistance</td> <td class="mid">Number</td> <td class="mid"><code>120</code></td> <td>This is the range of influence for the repulsion.</td></tr>
<tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.centralGravity</td> <td class="mid">Number</td> <td class="mid"><code>0.0'</code></td> <td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<tr parent="hierarchicalRepulsion" class="hidden"><td class="indent">hierarchicalRepulsion.springLength</td> <td class="mid">Number</td> <td class="mid"><code>100</code></td> <td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
@ -101,7 +95,7 @@
<tr><td>maxVelocity</td> <td class="mid">Number</td> <td class="mid"><code>50</code></td> <td>The physics module limits the maximum velocity of the nodes to increase the time to stabilization. This is the maximium value.</td></tr>
<tr><td>minVelocity</td> <td class="mid">Number</td> <td class="mid"><code>0.1</code></td> <td>Once the minimum velocity is reached for all nodes, we assume the network has been stabilized and the simulation stops.</td></tr>
<tr><td>solver</td> <td class="mid">String</td> <td class="mid"><code>'barnesHut'</code></td><td>You can select your own solver. Possible options: <code>'barnesHut','repulsion','hierarchicalRepulsion'</code>. When setting the hierarchical layout, the hierarchical repulsion solver is automaticaly selected, regardless of what you fill in here.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('physicsTable','stabilization', this);"><td><span parent="stabilization" class="right-caret"></span> stabilization</td> <td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.</td></tr>
<tr class='toggle collapsible' onclick="toggleTable('optionTable','stabilization', this);"><td><span parent="stabilization" class="right-caret"></span> stabilization</td> <td class="mid">Object | Boolean</td><td class="mid"><code>Object</code></td> <td>When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.</td></tr>
<tr parent="stabilization" class="hidden"><td class="indent">stabilization.enabled</td> <td class="mid">Boolean</td> <td class="mid"><code>true</code></td> <td>Toggle the stabilization. This is an optional property. If undefined, it is automatically set to true when any of the properties of this object are defined.</td></tr>
<tr parent="stabilization" class="hidden"><td class="indent">stabilization.iterations</td> <td class="mid">Number</td> <td class="mid"><code>1000</code></td> <td>The physics module tries to stabilize the network on load up til a maximum number of iterations defined here. If the network stabilized with less, you are finished before the maximum number.</td></tr>
<tr parent="stabilization" class="hidden"><td class="indent">stabilization.updateInterval</td> <td class="mid">Number</td> <td class="mid"><code>100</code></td> <td>When stabilizing, the DOM can freeze. You can chop the stabilization up into pieces to show a loading bar for instance. The interval determines after how many iterations the <code>stabilizationProgress</code> event is triggered.</td></tr>

+ 5
- 1
examples/network/01_basic_usage.html View File

@ -44,7 +44,11 @@
edges: edges
};
var options = {
manipulation:true,
// manipulation: {
// handlerFunctions:{
// editEdge: function (data,callback) {console.log("h12ere");setTimeout(function() {callback(null)},1000);}
// }
// },
groups:{'bla':{color:{background:'red'}, borderWidth:5}}
// physics:{stabilization:true}

+ 1
- 1
examples/network/layout.html View File

@ -75,7 +75,7 @@
};
var options = {
edges: {arrows: 'to', smooth:true},
layout:{hierarchical:{direction:'UD',levelSeparation: "260"}},
// layout:{hierarchical:{direction:'UD',levelSeparation: "260"}},
configure:'physics',
// "physics": {
// "hierarchicalRepulsion": {

+ 3
- 3
lib/network/modules/ConfigurationSystem.js View File

@ -99,7 +99,7 @@ class ConfigurationSystem {
align: ['horizontal', 'top', 'middle', 'bottom']
},
hidden: false,
hoverWidth: [1.5, 0, 10, 0.1],
hoverWidth: [2, 0, 5, 0.1],
physics: true,
scaling: {
min: [1, 0, 100, 1],
@ -112,6 +112,7 @@ class ConfigurationSystem {
drawThreshold: [3, 0, 20, 1]
}
},
selectionWidth: [1.5, 0, 5, 0.1],
selfReferenceSize: [20, 0, 200, 1],
shadow:{
enabled: false,
@ -125,8 +126,7 @@ class ConfigurationSystem {
type: ['continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW'],
roundness: [0.5, 0, 1, 0.05]
},
width: [1, 0, 30, 1],
widthSelectionMultiplier: [2, 0, 5, 0.1]
width: [1, 0, 30, 1]
},
layout: {
randomSeed: [0, 0, 500, 1],

+ 1
- 1
lib/network/modules/EdgesHandler.js View File

@ -72,6 +72,7 @@ class EdgesHandler {
}
}
},
selectionWidth: 1,
selfReferenceSize:20,
shadow:{
enabled: false,
@ -87,7 +88,6 @@ class EdgesHandler {
},
title:undefined,
width: 1,
widthSelectionMultiplier: 2,
value: undefined
};

+ 4
- 1
lib/network/modules/InteractionHandler.js View File

@ -600,11 +600,13 @@ class InteractionHandler {
this.popup.setPosition(pointer.x + 3, pointer.y - 5);
this.popup.setText(this.popupObj.getTitle());
this.popup.show();
this.body.emitter.emit('showPopup',this.popupObj.id);
}
}
else {
if (this.popup) {
if (this.popup !== undefined) {
this.popup.hide();
this.body.emitter.emit('hidePopup');
}
}
}
@ -644,6 +646,7 @@ class InteractionHandler {
if (stillOnObj === false) {
this.popupObj = undefined;
this.popup.hide();
this.body.emitter.emit('hidePopup');
}
}

+ 142
- 69
lib/network/modules/ManipulationSystem.js View File

@ -32,7 +32,7 @@ class ManipulationSystem {
this.options = {};
this.defaultOptions = {
enabled: false,
initiallyVisible: false,
initiallyActive: false,
locale: 'en',
locales: locales,
functionality:{
@ -76,7 +76,7 @@ class ManipulationSystem {
this.options.enabled = true;
util.deepExtend(this.options, options);
}
if (this.options.initiallyVisible === true) {
if (this.options.initiallyActive === true) {
this.editMode = true;
}
this._setup();
@ -90,27 +90,38 @@ class ManipulationSystem {
* @private
*/
toggleEditMode() {
this.editMode = !this.editMode;
if (this.editMode === true) {
this.disableEditMode();
}
else {
this.enableEditMode();
}
}
enableEditMode() {
this.editMode = true;
this._clean();
if (this.guiEnabled === true) {
let toolbar = this.manipulationDiv;
let closeDiv = this.closeDiv;
let editModeDiv = this.editModeDiv;
if (this.editMode === true) {
toolbar.style.display = 'block';
closeDiv.style.display = 'block';
editModeDiv.style.display = 'none';
this._bindHammerToDiv(closeDiv, this.toggleEditMode.bind(this));
this.showManipulatorToolbar();
}
else {
toolbar.style.display = 'none';
closeDiv.style.display = 'none';
editModeDiv.style.display = 'block';
this._createEditButton();
}
this.manipulationDiv.style.display = 'block';
this.closeDiv.style.display = 'block';
this.editModeDiv.style.display = 'none';
this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
this.showManipulatorToolbar();
}
}
disableEditMode() {
this.editMode = false;
this._clean();
if (this.guiEnabled === true) {
this.manipulationDiv.style.display = 'none';
this.closeDiv.style.display = 'none';
this.editModeDiv.style.display = 'block';
this._createEditButton();
}
}
/**
* Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar.
@ -124,50 +135,71 @@ class ManipulationSystem {
// reset global letiables
this.manipulationDOM = {};
let selectedNodeCount = this.selectionHandler._getSelectedNodeCount();
let selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount();
let selectedTotalCount = selectedNodeCount + selectedEdgeCount;
let locale = this.options.locales[this.options.locale];
let needSeperator = false;
// if the gui is enabled, draw all elements.
if (this.guiEnabled === true) {
let selectedNodeCount = this.selectionHandler._getSelectedNodeCount();
let selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount();
let selectedTotalCount = selectedNodeCount + selectedEdgeCount;
let locale = this.options.locales[this.options.locale];
let needSeperator = false;
if (this.options.functionality.addNode === true) {
this._createAddNodeButton(locale);
needSeperator = true;
}
if (this.options.functionality.addEdge === true) {
if (needSeperator === true) {this._createSeperator(1);} else {needSeperator = true;}
this._createAddEdgeButton(locale);
}
if (selectedNodeCount === 1 && typeof this.options.handlerFunctions.editNode === 'function' && this.options.functionality.editNode === true) {
if (needSeperator === true) {this._createSeperator(2);} else {needSeperator = true;}
this._createEditNodeButton(locale);
}
else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.functionality.editEdge === true) {
if (needSeperator === true) {this._createSeperator(3);} else {needSeperator = true;}
this._createEditEdgeButton(locale);
}
if (this.options.functionality.addNode === true) {
this._createAddNodeButton(locale);
needSeperator = true;
}
if (this.options.functionality.addEdge === true) {
if (needSeperator === true) {
this._createSeperator(1);
} else {
needSeperator = true;
}
this._createAddEdgeButton(locale);
}
// remove buttons
if (selectedTotalCount !== 0) {
if (selectedNodeCount === 1 && this.options.functionality.deleteNode === true) {
if (needSeperator === true) {this._createSeperator(4);}
this._createDeleteButton(locale);
if (selectedNodeCount === 1 && typeof this.options.handlerFunctions.editNode === 'function' && this.options.functionality.editNode === true) {
if (needSeperator === true) {
this._createSeperator(2);
} else {
needSeperator = true;
}
this._createEditNodeButton(locale);
}
else if (selectedNodeCount === 0 && this.options.functionality.deleteEdge === true) {
if (needSeperator === true) {this._createSeperator(4);}
this._createDeleteButton(locale);
else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.functionality.editEdge === true) {
if (needSeperator === true) {
this._createSeperator(3);
} else {
needSeperator = true;
}
this._createEditEdgeButton(locale);
}
// remove buttons
if (selectedTotalCount !== 0) {
if (selectedNodeCount === 1 && this.options.functionality.deleteNode === true) {
if (needSeperator === true) {
this._createSeperator(4);
}
this._createDeleteButton(locale);
}
else if (selectedNodeCount === 0 && this.options.functionality.deleteEdge === true) {
if (needSeperator === true) {
this._createSeperator(4);
}
this._createDeleteButton(locale);
}
}
}
// bind the close button
this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
// bind the close button
this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this));
// refresh this bar based on what has been selected
this._temporaryBindEvent('select', this.showManipulatorToolbar.bind(this));
// refresh this bar based on what has been selected
this._temporaryBindEvent('select', this.showManipulatorToolbar.bind(this));
}
// redraw to show any possible changes
this.body.emitter.emit('_redraw');
}
@ -177,7 +209,12 @@ class ManipulationSystem {
* @private
*/
addNodeMode() {
// clear the toolbar
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
}
// restore the state of any bound functions or events, remove control nodes, restore physics
this._clean();
if (this.guiEnabled === true) {
@ -200,6 +237,14 @@ class ManipulationSystem {
* @private
*/
editNodeMode() {
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
}
// restore the state of any bound functions or events, remove control nodes, restore physics
this._clean();
if (typeof this.options.handlerFunctions.editNode === 'function') {
let node = this.selectionHandler._getSelectedNode();
if (node.isCluster !== true) {
@ -233,7 +278,12 @@ class ManipulationSystem {
* @private
*/
addEdgeMode() {
// _clean the system
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
}
// restore the state of any bound functions or events, remove control nodes, restore physics
this._clean();
if (this.guiEnabled === true) {
@ -263,7 +313,12 @@ class ManipulationSystem {
* @private
*/
editEdgeMode() {
// clear the system
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
}
// restore the state of any bound functions or events, remove control nodes, restore physics
this._clean();
if (this.guiEnabled === true) {
@ -324,6 +379,14 @@ class ManipulationSystem {
* @private
*/
deleteSelected() {
// when using the gui, enable edit mode if it wasnt already.
if (this.editMode !== true) {
this.enableEditMode();
}
// restore the state of any bound functions or events, remove control nodes, restore physics
this._clean();
let selectedNodes = this.selectionHandler.getSelectedNodes();
let selectedEdges = this.selectionHandler.getSelectedEdges();
let deleteFunction = undefined;
@ -349,9 +412,11 @@ class ManipulationSystem {
let data = {nodes: selectedNodes, edges: selectedEdges};
if (deleteFunction.length === 2) {
deleteFunction(data, (finalizedData) => {
this.body.data.edges.remove(finalizedData.edges);
this.body.data.nodes.remove(finalizedData.nodes);
this.body.emitter.emit('startSimulation');
if (finalizedData !== null && finalizedData !== undefined) {
this.body.data.edges.remove(finalizedData.edges);
this.body.data.nodes.remove(finalizedData.nodes);
this.body.emitter.emit('startSimulation');
}
});
}
else {
@ -890,7 +955,6 @@ class ManipulationSystem {
* @private
*/
_finishConnect(event) {
console.log("finishd")
let pointer = this.body.functions.getPointer(event.center);
let pointerObj = this.selectionHandler._pointerToPositionObject(pointer);
@ -947,8 +1011,10 @@ class ManipulationSystem {
if (typeof this.options.handlerFunctions.addNode === 'function') {
if (this.options.handlerFunctions.addNode.length === 2) {
this.options.handlerFunctions.addNode(defaultData, (finalizedData) => {
this.body.data.nodes.add(finalizedData);
this.showManipulatorToolbar();
if (finalizedData !== null && finalizedData !== undefined) {
this.body.data.nodes.add(finalizedData);
this.showManipulatorToolbar();
}
});
}
else {
@ -969,14 +1035,15 @@ class ManipulationSystem {
* @private
*/
_performCreateEdge(sourceNodeId, targetNodeId) {
console.log('sou',sourceNodeId, targetNodeId)
let defaultData = {from: sourceNodeId, to: targetNodeId};
if (this.options.handlerFunctions.addEdge) {
if (this.options.handlerFunctions.addEdge.length === 2) {
this.options.handlerFunctions.addEdge(defaultData, (finalizedData) => {
this.body.data.edges.add(finalizedData);
this.selectionHandler.unselectAll();
this.showManipulatorToolbar();
if (finalizedData !== null && finalizedData !== undefined) {
this.body.data.edges.add(finalizedData);
this.selectionHandler.unselectAll();
this.showManipulatorToolbar();
}
});
}
else {
@ -1000,9 +1067,15 @@ class ManipulationSystem {
if (this.options.handlerFunctions.editEdge) {
if (this.options.handlerFunctions.editEdge.length === 2) {
this.options.handlerFunctions.editEdge(defaultData, (finalizedData) => {
this.body.data.edges.update(finalizedData);
this.selectionHandler.unselectAll();
this.showManipulatorToolbar();
if (finalizedData === null || finalizedData === undefined) {
this.body.edges[defaultData.id].updateEdgeType();
this.body.emitter.emit('_redraw');
}
else {
this.body.data.edges.update(finalizedData);
this.selectionHandler.unselectAll();
this.showManipulatorToolbar();
}
});
}
else {

+ 33
- 4
lib/network/modules/components/Edge.js View File

@ -71,6 +71,7 @@ class Edge {
if (options.to !== undefined) {this.toId = options.to;}
if (options.title !== undefined) {this.title = options.title;}
// A node is connected when it has a from and to node that both exist in the network.body.nodes.
this.connect();
@ -78,6 +79,10 @@ class Edge {
this.updateLabelModule();
let dataChanged = this.updateEdgeType();
// if anything has been updates, reset the selection width and the hover width
this._setInteractionWidths();
return dataChanged;
}
@ -93,14 +98,12 @@ class Edge {
'line',
'opacity',
'physics',
'selectionWidth',
'selfReferenceSize',
'to',
'title',
'value',
'width',
'widthMin',
'widthMax',
'widthSelectionMultiplier'
];
// only deep extend the items in the field array. These do not have shorthand.
@ -158,6 +161,10 @@ class Edge {
}
}
/**
* update the options in the label module
*/
updateLabelModule() {
this.labelModule.setOptions(this.options);
if (this.labelModule.baseSize !== undefined) {
@ -165,13 +172,17 @@ class Edge {
}
}
/**
* update the edge type, set the options
* @returns {boolean}
*/
updateEdgeType() {
let dataChanged = false;
let changeInType = true;
if (this.edgeType !== undefined) {
if (this.edgeType instanceof BezierEdgeDynamic && this.options.smooth.enabled === true && this.options.smooth.dynamic === true) {changeInType = false;}
if (this.edgeType instanceof BezierEdgeStatic && this.options.smooth.enabled === true && this.options.smooth.dynamic === false){changeInType = false;}
if (this.edgeType instanceof StraightEdge && this.options.smooth.enabled === false) {changeInType = false;}
if (this.edgeType instanceof StraightEdge && this.options.smooth.enabled === false) {changeInType = false;}
if (changeInType === true) {
dataChanged = this.edgeType.cleanup();
@ -302,8 +313,26 @@ class Edge {
this.options.width = this.baseWidth;
this.options.font.size = this.baseFontSize;
}
this._setInteractionWidths();
}
_setInteractionWidths() {
if (typeof this.options.hoverWidth === 'function') {
this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width);
}
else {
this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width;
}
if (typeof this.options.selectionWidth === 'function') {
this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width);
}
else {
this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width;
}
}
/**
* Redraw a edge

+ 0
- 3
lib/network/modules/components/Node.js View File

@ -119,9 +119,6 @@ class Node {
if (options.x !== undefined) {this.x = options.x; this.predefinedPosition = true;}
if (options.y !== undefined) {this.y = options.y; this.predefinedPosition = true;}
if (options.size !== undefined) {this.baseSize = options.size;}
if (options.label === undefined && this.options.label === undefined) {
this.options.label = this.id;
}
// this transforms all shorthands into fully defined options
Node.parseOptions(this.options,options);

+ 0
- 2
lib/network/modules/components/edges/BezierEdgeDynamic.js View File

@ -47,9 +47,7 @@ class BezierEdgeDynamic extends BezierEdgeBase {
var nodeId = "edgeId:" + this.id;
var node = this.body.functions.createNode({
id: nodeId,
mass: 1,
shape: 'circle',
image:'',
physics:true,
hidden:true
});

+ 4
- 2
lib/network/modules/components/edges/util/EdgeBase.js View File

@ -7,6 +7,8 @@ class EdgeBase {
this.setOptions(options);
this.colorDirty = true;
this.color = {};
this.selectionWidth = 2;
this.hoverWidth = 1.5;
}
setOptions(options) {
@ -243,11 +245,11 @@ class EdgeBase {
*/
getLineWidth(selected, hover) {
if (selected === true) {
return Math.max(Math.min(this.options.widthSelectionMultiplier * this.options.width, this.options.scaling.max), 0.3 / this.body.view.scale);
return Math.max(this.selectionWidth, 0.3 / this.body.view.scale);
}
else {
if (hover === true) {
return Math.max(Math.min(this.options.hoverWidth, this.options.scaling.max), 0.3 / this.body.view.scale);
return Math.max(this.hoverWidth, 0.3 / this.body.view.scale);
}
else {
return Math.max(this.options.width, 0.3 / this.body.view.scale);

Loading…
Cancel
Save