<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<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 - Edges documentation.</title>
|
|
|
|
<!-- Bootstrap core CSS -->
|
|
<link href="../css/bootstrap.css" rel="stylesheet">
|
|
<!-- Tipue vendor css -->
|
|
<link href="../css/tipuesearch.css" rel="stylesheet">
|
|
|
|
<link href="../css/style.css" rel="stylesheet">
|
|
|
|
<link href="../css/prettify.css" type="text/css" rel="stylesheet"/>
|
|
<script type="text/javascript" src="../js/googleAnalytics.js"></script>
|
|
<script type="text/javascript" src="../js/prettify/prettify.js"></script>
|
|
|
|
<!-- 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>
|
|
|
|
<body onload="prettyPrint();">
|
|
|
|
<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="http://www.visjs.org/index.html#modules">Modules</a></li>
|
|
<li><a href="http://www.visjs.org/blog.html">Blog</a></li>
|
|
<li><a href="http://www.visjs.org/index.html#download_install">Download</a></li>
|
|
<li><a href="http://www.visjs.org/showcase/index.html">Showcase</a></li>
|
|
<li><a href="http://www.visjs.org/index.html#contribute">Contribute</a></li>
|
|
<li><a href="http://www.visjs.org/featureRequests.html">Feature requests</a></li>
|
|
<li><a href="http://www.visjs.org/index.html#licenses">License</a></li>
|
|
</ul>
|
|
<form class="navbar-form navbar-right" role="search">
|
|
<input name="q" id="tipue_search_input" autocomplete="off" type="text" class="form-control" placeholder="Enter keywords">
|
|
<button type="submit" class="btn btn-default">Go!</button>
|
|
</form>
|
|
<div id="search-results-wrapper" class="panel panel-default">
|
|
<div class="panel-body">
|
|
<div id="tipue_search_content"></div>
|
|
</div>
|
|
</div>
|
|
<div id="keyword-info" class="panel panel-success">
|
|
<div class="panel-body">
|
|
Found <span id="keyword-count"></span> results. Click <a id="keyword-jumper-button" href="">here</a> to jump to the first keyword occurence!
|
|
</div>
|
|
</div>
|
|
</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>The options for the edges have to be contained in an object titled 'edges'. All of these options can be supplied per edge as well. Obviously, 'id' should not be defined globally but per edge. Options defined
|
|
in the global edges object, are applied to all edges. If an edge has options of its own, those will be used instead of the global options.</p>
|
|
<p><b><i>When you have given an edge an option, you will override the global option for that property. If you then set that option to <code>null</code>,
|
|
it will revert back to the default value.</i></b>
|
|
</p>
|
|
<p>Click on the full options or shorthand options to show how these options are supposed to be used.</p>
|
|
<ul class="nav nav-tabs">
|
|
<li role="presentation" class="active" onclick="toggleTab(this)"><a href="#">options hidden</a></li>
|
|
<li role="presentation" onclick="toggleTab(this);" targetNode="fullOptions"><a href="#">full options</a></li>
|
|
<li role="presentation" onclick="toggleTab(this);" targetNode="shortOptions"><a href="#">shorthand options</a></li>
|
|
</ul>
|
|
<br>
|
|
<pre class="prettyprint lang-js options top hidden" id="fullOptions">
|
|
// these are all options in full.
|
|
var options = {
|
|
edges:{
|
|
arrows: {
|
|
to: {enabled: false, scaleFactor:1},
|
|
middle: {enabled: false, scaleFactor:1},
|
|
from: {enabled: false, scaleFactor:1}
|
|
},
|
|
color: {
|
|
color:'#848484',
|
|
highlight:'#848484',
|
|
hover: '#848484',
|
|
inherit: 'from',
|
|
opacity:1.0
|
|
},
|
|
dashes: false,
|
|
font: {
|
|
color: '#343434',
|
|
size: 14, // px
|
|
face: 'arial',
|
|
background: 'none',
|
|
strokeWidth: 2, // px
|
|
strokeColor: '#ffffff',
|
|
align:'horizontal'
|
|
},
|
|
hidden: false,
|
|
hoverWidth: 1.5,
|
|
label: undefined,
|
|
labelHighlightBold: true,
|
|
length: undefined,
|
|
physics: true,
|
|
scaling:{
|
|
min: 1,
|
|
max: 15,
|
|
label: {
|
|
enabled: true,
|
|
min: 14,
|
|
max: 30,
|
|
maxVisible: 30,
|
|
drawThreshold: 5
|
|
},
|
|
customScalingFunction: function (min,max,total,value) {
|
|
if (max === min) {
|
|
return 0.5;
|
|
}
|
|
else {
|
|
var scale = 1 / (max - min);
|
|
return Math.max(0,(value - min)*scale);
|
|
}
|
|
}
|
|
},
|
|
selectionWidth: 1,
|
|
selfReferenceSize:20,
|
|
shadow:{
|
|
enabled: false,
|
|
size:10,
|
|
x:5,
|
|
y:5
|
|
},
|
|
smooth: {
|
|
enabled: true,
|
|
type: "dynamic",
|
|
roundness: 0.5
|
|
},
|
|
title:undefined,
|
|
width: 1,
|
|
value: undefined
|
|
}
|
|
}
|
|
|
|
network.setOptions(options);
|
|
</pre>
|
|
|
|
<pre class="prettyprint lang-js options top hidden" id="shortOptions">
|
|
// here all options that have shorthand notations are shown.
|
|
var options = {
|
|
edges:{
|
|
arrows: 'to, from',
|
|
color: 'red',
|
|
font: '12px arial #ff0000',
|
|
scaling:{
|
|
label: true,
|
|
},
|
|
shadow: true,
|
|
smooth: true,
|
|
}
|
|
}
|
|
|
|
network.setOptions(options);
|
|
</pre>
|
|
|
|
<p>These options can also be set per individual edge.</p>
|
|
<table class="options" id="optionTable">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Type</th>
|
|
<th>Default</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
<tr class='toggle collapsible' onclick="toggleTable('optionTable','arrows', this);">
|
|
<td><span parent="arrows" class="right-caret"></span> arrows</td>
|
|
<td>Object or String</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><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>Boolean</td>
|
|
<td><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>Number</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><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>Object or String</td>
|
|
<td><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>String</td>
|
|
<td><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>String</td>
|
|
<td><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>String</td>
|
|
<td><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>String or Boolean</td>
|
|
<td><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>Number</td>
|
|
<td><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>Array or Boolean</td>
|
|
<td><code>false</code></td>
|
|
<td>When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an Array.
|
|
Array formart: Array of numbers, gap length, dash length, gap length, dash length, ... etc. The array is
|
|
repeated until the distance is filled.
|
|
<i>When using dashed lines in IE versions older than 11, the line will be drawn straight, not smooth</i>.
|
|
</td>
|
|
</tr>
|
|
<tr class='toggle collapsible' onclick="toggleTable('optionTable','font', this);">
|
|
<td><span parent="font" class="right-caret"></span> font</td>
|
|
<td>Object or String</td>
|
|
<td><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>String</td>
|
|
<td><code>'#343434'</code></td>
|
|
<td>Color of the label text.</td>
|
|
</tr>
|
|
<tr parent="font" class="hidden">
|
|
<td class="indent">font.size</td>
|
|
<td>Number</td>
|
|
<td><code>14</code></td>
|
|
<td>Size of the label text.</td>
|
|
</tr>
|
|
<tr parent="font" class="hidden">
|
|
<td class="indent">font.face</td>
|
|
<td>String</td>
|
|
<td><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>String</td>
|
|
<td><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.strokeWidth</td>
|
|
<td>Number</td>
|
|
<td><code>2</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>String</td>
|
|
<td><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>String</td>
|
|
<td><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>from</td>
|
|
<td>Number or String</td>
|
|
<td></td>
|
|
<td>Edges are between two nodes, one to and one from. This is where you define the from node. You have to supply the corresponding node ID. This naturally only applies to individual edges.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>hidden</td>
|
|
<td>Boolean</td>
|
|
<td><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>Number or Function</td>
|
|
<td><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>id</td>
|
|
<td>String</td>
|
|
<td><code>undefined</code></td>
|
|
<td>The id of the edge. The id is optional for edges. When not supplied, an UUID will be assigned to the edge. This naturally only applies to individual edges.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>label</td>
|
|
<td>String</td>
|
|
<td><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>labelHighlightBold</td>
|
|
<td>Boolean</td>
|
|
<td><code>true</code></td>
|
|
<td>Determines whether or not the label becomes bold when the edge is selected.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>length</td>
|
|
<td>Number</td>
|
|
<td><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>Boolean</td>
|
|
<td><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>Object</td>
|
|
<td><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>Number</td>
|
|
<td><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>Number</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><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>Boolean</td>
|
|
<td><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>Number</td>
|
|
<td><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>Number</td>
|
|
<td><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>Number</td>
|
|
<td><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>Number</td>
|
|
<td><code>5</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>Function</td>
|
|
<td>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>
|
|
Please note: <code>maxWidth</code> and <code>minWidth</code> are the values <code>scaling.max</code>
|
|
and <code>scaling.min</code> provided in the options.
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>selectionWidth</td>
|
|
<td>Number or Function</td>
|
|
<td><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>Number</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><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>Boolean</td>
|
|
<td><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>Number</td>
|
|
<td><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>Number</td>
|
|
<td><code>5</code></td>
|
|
<td>The x offset.</td>
|
|
</tr>
|
|
<tr parent="shadow" class="hidden">
|
|
<td class="indent">shadow.y</td>
|
|
<td>Number</td>
|
|
<td><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>Object or Boolean</td>
|
|
<td><code>Object</code></td>
|
|
<td>When true, the edge is drawn as a dynamic 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 picking a different type of smooth curves then dynamic for better performance.
|
|
</td>
|
|
</tr>
|
|
<tr parent="smooth" class="hidden">
|
|
<td class="indent">smooth.enabled</td>
|
|
<td>Boolean</td>
|
|
<td><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.type</td>
|
|
<td>String</td>
|
|
<td><code>'dynamic'</code></td>
|
|
<td>Possible options: <code>'dynamic', '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!
|
|
<br><br>
|
|
When using dynamic, the edges will have an invisible support node guiding the shape. This node is part of the
|
|
physics simulation.
|
|
</td>
|
|
</tr>
|
|
<tr parent="smooth" class="hidden">
|
|
<td class="indent">smooth.roundness</td>
|
|
<td>Number</td>
|
|
<td><code>0.5</code></td>
|
|
<td>Accepted range: <code>0 .. 1.0</code>. This parameter tweaks the roundness of the smooth curves for all types EXCEPT dynamic.
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>title</td>
|
|
<td>String</td>
|
|
<td><code>undefined</code></td>
|
|
<td>The title is shown in a pop-up when the mouse moves over the edge.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>to</td>
|
|
<td>Number or String</td>
|
|
<td></td>
|
|
<td>Edges are between two nodes, one to and one from. This is where you define the to node. You have to supply the corresponding node ID. This naturally only applies to individual edges.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>value</td>
|
|
<td>Number</td>
|
|
<td><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>Number</td>
|
|
<td><code>1</code></td>
|
|
<td>The width of the edge. If value is set, this is not used.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</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>
|
|
<!-- jquery extensions -->
|
|
<script src="../js/jquery.highlight.js"></script>
|
|
<script src="../js/jquery.url.min.js"></script>
|
|
<!-- Tipue vendor js -->
|
|
<script src="../js/tipuesearch.config.js"></script>
|
|
<script src="../js/tipuesearch.min.js"></script>
|
|
<!-- controller -->
|
|
<script src="../js/main.js"></script>
|