|
|
- <!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>
-
- <style>
- td.type {
- width: 90px;
- }
- </style>
- <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 - 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" 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) {
- return 0.5;
- }
- else {
- var scale = 1 / (max - min);
- return Math.max(0,(value - min)*scale);
- }
- }
- </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:
- <pre>
- var scale = customScalingFunction(min,max,total,value);
- var diff = maxWidth - minWidth;
- myWidth = minWidth + diff * scale;
- </pre>
- </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/>
- </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>
|