Appearance
Edge
Ogma edge entity class. Use this class to manipulate edges, change data, attributes, etc.
edge.isNode
Read-only property that is always false
.
edge.addClass(className[, options])
Add the specified class to the edge.
Arguments
- className
string
- options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.addClasses(classNames[, options])
Add the specified classes to the edge.
Arguments
- classNames
Array<string>
- options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.getAdjacentElements()
Retrieves the list of edges parallel to the edge, excluding the source edge plus the extremities of the edge.
Returns
edge.getAttribute(attributeName)
Returns the value of the specified attribute for the edge.
Arguments
- attributeName
PropertyPath
Attribute to retrieve.
Returns
-
any
edge.getAttributes([attributeNames])
Returns an object containing the specified attributes for the edge.
Arguments
- attributeNames(optional)
Array<PropertyPath>
List of attributes to include in the object. If not specified, includes all the edge attributes.
Returns
edge.getBoundingBox([options])
Returns the bounding box of the edge, in graph coordinates.
Arguments
- options(optional)
object
- ignoreCurvature(optional)
boolean
[=false]
Use it if you want to only take into account the edge sources and targets. - includeTexts(optional)
boolean
[=false]
Wether or not take texts in account in the bouding box
- ignoreCurvature(optional)
Returns
edge.getClassList()
Returns the list of classes that the edge has.
Returns
-
Array<string>
edge.getData([property])
Retrieve the specified data property of the edge. If no property is specified, retrieve the whole data object. This method method returns the internal data object; modifying it could cause unexpected behavior.
Arguments
- property(optional)
PropertyPath
Returns
-
any
edge.getExtremities()
Returns a NodeList
containing the source and the target of the edge.
Returns
edge.getId()
Returns the id of the edge.
Returns
edge.getMetaEdge()
If the edge is grouped inside a meta-edge, returns this meta-edge. Otherwise, returns null.
Returns
-
Edge|null
edge.getParallelEdges([options])
Retrieves the list of edges parallel to the edge, including the source edge itself.
Arguments
- options(optional)
object
- filter(optional)
Filter
[="visible"]
Indicates which edges to take into account
- filter(optional)
Returns
edge.getSource()
Returns the source node of the edge
Returns
edge.getSubEdges()
If the edge is a meta-edge (result of a grouping), returns the list of edges that are part of the group it represents. If it's not a meta-edge, returns null
.
Returns
-
EdgeList|null
edge.getTarget()
Returns the target node of the edge
Returns
edge.getTransformation()
Returns the transformation that created the edge, if it is virtual. Otherwise returns null
.
Returns
-
Transformation|null
edge.hasClass(className)
Indicates if the edge has the specified class.
Arguments
- className
string
Returns
-
boolean
edge.isInView([options])
Indicates if the edge is visible in the current view.
Arguments
- options(optional)
object
- margin(optional)
number
[=0]
Tolerance in pixels.
- margin(optional)
Returns
-
boolean
edge.isSelected()
Indicates if the edge is currently selected.
Returns
-
boolean
edge.isVirtual()
Indicates if the edge was created by a transformation (true
) or not (false
).
Returns
-
boolean
edge.isVisible()
Indicates if the edge is visible. A edge is not visible if it has been filtered out, or if it is used in a transformation. /!\ A edge with an opacity of 0 is considered visible!
Returns
-
boolean
edge.locate([options])
Centers the view on the edge.
Arguments
- options(optional)
LocateOptions
Returns
-
Promise<void>
edge.pulse([options])
Highlights the edge. It's a shorthand for the case when you want the elements pulse for number * (interval - 1) + duration
milliseconds. It will also update the pulse attributes of the items with the one provided in the .pulse()
call.
Arguments
- options(optional)
object
- duration(optional)
number
[=1000]
Duration of a pulse (milliseconds) - endColor(optional)
Color|"inherit"
[="rgb(0,0,0,0.0)"]
Ending color of the pulse - endRatio(optional)
number
[=2]
Where the pulse ends, relative to the edge siz (1 = at the edge's border) - interval(optional)
number
[=800]
Interval between two pulses (milliseconds) - number(optional)
number
[=1]
Number of pulses - startColor(optional)
Color|"inherit"
[="rgb(0,0,0,0.6)"]
Starting color of the pulse - startRatio(optional)
number
[=1]
Where the pulse starts, relative to the edge siz (1 = at the edge's border) - width(optional)
number
[=10]
Width of the pulse in pixels
- duration(optional)
Returns
-
Promise<Edge>
edge.removeClass(className[, options])
Remove the specified class from the edge.
Arguments
- className
string
- options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.removeClasses(classNames[, options])
Remove the specified class from the edge.
Arguments
- classNames
Array<string>
- options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.resetAttributes([attributeNames][, options])
Remove all attributes that have been applied through setAttributes
. Original attributes or attributes applied by the rules are not affected.
Arguments
- attributeNames(optional)
Array<PropertyPath>
List of attributes to clear. If no attribute is specified, clear all of them. - options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.setAttribute(attribute, value[, options])
Set the specified attribute of the edge.
Arguments
- attribute
PropertyPath
- value
any
- options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.setAttributes(attributes[, options])
Set the individual attributes of the edge.
Arguments
- attributes
EdgeAttributesValue
Attributes to update - options(optional)
AttributeAnimationOptions
Returns
-
Promise<Edge>
edge.setData([property], value)
Set the specified data property of the edge. If no property is specified, update the whole data object.
Arguments
- property(optional)
PropertyPath
- value
any|function(edge: Edge): any
Returns
edge.setSelected(active)
Add or remove the edge to/from the selection.
Arguments
- active
boolean
Whether to select or unselect the edge.
edge.setSource(source)
Set the source node of the edge.
Arguments
edge.setTarget(target)
Set the target node of the edge.
Arguments
edge.setVisible(value)
Hide or show the edge.
Arguments
- value
boolean
Whether to show or hide the edge.
edge.toJSON([options])
Returns an object containing the id, source id, target id, attributes and data of the edge.
Arguments
- options(optional)
object
- attributes(optional)
Array<PropertyPath>|"all"
[=[]]
List of attributes to retrieve. By default, retrieve all attributes. - data(optional)
function (data: any): any
Function that takes the edge's data in input and return the data to retrieve. By default return the whole object.
- attributes(optional)
Returns
edge.toList()
Returns a new EdgeList that contains only the edge.
Returns