Network - edges

Handles the creation and deletion of edges and contains the global edge options and styles.

Options

This is a list of all the methods in the public API. They are collected here from all individual modules.

name type default description
arrows Object or String undefined To draw an arrow with default settings a string can be supplied. For example: arrows:'to, from, middle' or 'to;from', any combination with any seperating symbol is fine. If you want to control the size of the arrowheads, you can supply an object.
color Object or String Object 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 'rgb(120,32,14)', '#ffffff' or 'red' can be supplied instead of an object.
dashes Object or Boolean Object When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an object. When using dashed lines in IE versions older than 11, the line will be drawn straight, not smooth.
font Object or String false This object defines the details of the label. A shorthand is also supported in the form 'size face color' for example: '14px arial red'.
hidden Boolean false When true, the edge is not drawn. It is part still part of the physics simulation however!
hoverWidth Number or Function 0.5 Assuming the hover behaviour is enabled in the interaction module, 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 added 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:
var options: {
  edges: {
    hoverWidth: function (width) {return width+1;}
  }
}
It receives the Number width 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 Number.
label String undefined The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.
length Number undefined The physics simulation gives edges a spring length. This value can override the length of the spring in rest.
physics Boolean true When true, the edge is part of the physics simulation. When false, it will not act as a spring.
scaling Object Object If the value 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 width option is neglected.
selectionWidth Number or Function 1 The selectionWidth determines the width of the edge when the edge is selected. If a number is supplied, this number will be added 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:
var options: {
  edges: {
    selectionWidth: function (width) {return width*2;}
  }
}
It receives the Number width 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 Number.
selfReferenceSize Number false When the to and from nodes are the same, a circle is drawn. This is the radius of that circle.
shadow Object or Boolean Object When true, the edge casts a shadow using the default settings. This can be further refined by supplying an object.
smooth Object or Boolean Object 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.
title String undefined The title is shown in a pop-up when the mouse moves over the edge.
value Number undefined When a value is set, the edges' width will be scaled using the options in the scaling object defined above.
width Number 1 The width of the edge. If value is set, this is not used.

Methods

The nodes module has no methods.

Events

The nodes module emits no events. Click and select events are emitted from the interaction and selection modules.