Usage
Signature:
interface DvtDiagramLayoutContextLink<K1, K2, D2 extends ojDiagram.Link<K2, K1>|any>
Generic Parameters
Parameter Description K1 Type of key of the nodeData dataprovider K2 Type of key of the linkData dataprovider D2 Type of data from the linkData dataprovider
Typescript Import Format
//To use this interface, import as below.
import {DvtDiagramLayoutContextLink} from "ojs/ojdiagram";
For additional information visit:
Methods
-
getCoordinateSpace : {K1}
-
Get coordinate space for the link. If the coordinate container id is specified, the link points will be applied relative to that container. If the coordinate container id is not specified, the link points are in the global coordinate space. The coordinate space is global by default. The coordinate space can be any container id that is an ancestor of both the start and end nodes.
Returns:
coordinate container id for the link
- Type
- K1
-
getData : {(D2|Array.<D2>)}
-
Get the corresponding data for the diagram link.
Returns:
a data object for the link if the link is not promoted or an array of data objects for each link that is represented by the promoted link if the link is promoted
- Type
- (D2|Array.<D2>)
-
getEndConnectorOffset : {number}
-
Get the offset of the end connector. This is the amount of space that the link should leave between its ending point and the node for the connector to be drawn.
Returns:
- Type
- number
-
getEndId : {K1}
-
Get the id of the end node of this link.
Returns:
- Type
- K1
-
getId : {K2}
-
Get the id of the link.
Returns:
- Type
- K2
-
getLabelBounds : {{x: number, y: number, w: number, h: number}}
-
Get the label bounds. The bounds are in the coordinate system of the label.
Properties:
Name Type Description h
number height w
number width x
number x-coordinate y
number y-coordinate Returns:
An object with the following properties for the label bound
- Type
- {x: number, y: number, w: number, h: number}
-
getLabelHalign : {('left'|'center'|'right')}
-
Get the horizontal alignment of the link label. The default value is left for locales with left-to-right reading direction and right for locales with right-to-left reading direction.
Supported Values:
Value center
left
right
Returns:
A string that specifies the horizontal label alignment
- Type
- ('left'|'center'|'right')
-
getLabelPosition : {{x: number, y: number}}
-
Get the position of the link label. The position is in the coordinate system of the link's container. The position represents the upper-left corner for locales with left-to-right reading direction and the upper-right corner for locales with right-to-left reading direction in the default alignment.
Properties:
Name Type Description x
number x-coordinate y
number y-coordinate Returns:
An object with the following properties for the position of the link label
- Type
- {x: number, y: number}
-
getLabelRotationAngle : {number}
-
Get the angle of rotation of the link label, relative to the label rotation point, in radians.
Returns:
- Type
- number
-
getLabelRotationPoint : {{x: number, y: number}}
-
Get the point about which to rotate the link label, in the coordinate system of the label.
Properties:
Name Type Description x
number x-coordinate y
number y-coordinate Returns:
An object with the following properties for the label rotation point
- Type
- {x: number, y: number}
-
getLabelValign : {('top'|'middle'|'bottom'|'baseline')}
-
Get the vertical alignment of the link label.
- Default Value:
"top"
Supported Values:
Value baseline
bottom
middle
top
Returns:
A string that specifies the vertical label alignment
- Type
- ('top'|'middle'|'bottom'|'baseline')
-
getLayoutAttributes : {object}
-
Get the corresponding object from the links option array.
- Deprecated:
-
Since Description 2.1.0
This method is deprecated. Please use the getData method instead
Returns:
- Type
- object
-
getLinkWidth : {number}
-
Get the width of this link.
Returns:
- Type
- number
-
getPoints : {array}
-
Get the points to use for rendering this link. The returned array can contain coordinates, like [x1, y1, x2, y2, ..., xn, yn], or SVG path commands, like ["M", x1, y1, "L", x2, y2, ..., "L", xn, yn]. The points are in the coordinate system of the link's container.
Returns:
- Type
- array
-
getSelected : {boolean}
-
Determine whether this link is selected.
Returns:
- Type
- boolean
-
getStartConnectorOffset : {number}
-
Get the offset of the start connector. This is the amount of space that the link should leave between its starting point and the node for the connector to be drawn.
Returns:
- Type
- number
-
getStartId : {K1}
-
Get the id of the start node of this link.
Returns:
- Type
- K1
-
isPromoted : {boolean}
-
Determine whether this link is promoted.
Returns:
true if the link is promoted
- Type
- boolean
-
setCoordinateSpace(containerId) : {void}
-
Set coordinate space for the link. If the coordinate container id is specified, the link points will be applied relative to that container. If the coordinate container id is not specified, the link points are in the global coordinate space. The coordinate space is global by default. The coordinate space can be any container id that is an ancestor of both the start and end nodes.
Parameters:
Name Type Description containerId
K1 coordinate container id for the link Returns:
- Type
- void
-
setLabelHalign(halign) : {void}
-
Set the horizontal alignment of the link label. The default value is left for locales with left-to-right reading direction and right for locales with right-to-left reading direction.
Parameters:
Name Type Description halign
'left' | 'center' | 'right' A string that specifies the horizontal label alignment Supported Values:
Value center
left
right
Returns:
- Type
- void
-
setLabelPosition(pos) : {void}
-
Set the position of the link label. The position is in the coordinate system of the link's container. The position represents the upper-left corner for locales with left-to-right reading direction and the upper-right corner for locales with right-to-left reading direction in the default alignment.
Parameters:
Name Type Description pos
{x: number, y: number} An object with the following properties for the position of the link label Properties:
Name Type Description x
number x-coordinate y
number y-coordinate Returns:
- Type
- void
-
setLabelRotationAngle(angle) : {void}
-
Set the angle of rotation of the link label, relative to the label rotation point, in radians.
Parameters:
Name Type Description angle
number angle of rotation Returns:
- Type
- void
-
setLabelRotationPoint(point) : {void}
-
Set the point about which to rotate the link label, in the coordinate system of the label.
Parameters:
Name Type Description point
{x: number, y: number} An object with the following properties for the label rotation point Properties:
Name Type Description x
number x-coordinate y
number y-coordinate Returns:
- Type
- void
-
setLabelValign(valign) : {void}
-
Set the vertical alignment of the link label.
Parameters:
Name Type Description valign
'top' | 'middle' | 'bottom' | 'baseline' A string that specifies the vertical label alignment. The "baseline" value is not supported when applied to multiline labels. If "baseline" is applied to a multiline label, the text element will default to "top" alignment. - Default Value:
"top"
Supported Values:
Value baseline
bottom
middle
top
Returns:
- Type
- void
-
setPoints(points) : {void}
-
Set the points to use for rendering this link. The given array can contain coordinates, like [x1, y1, x2, y2, ..., xn, yn], or SVG path commands, like ["M", x1, y1, "L", x2, y2, ..., "L", xn, yn]. The points are in the coordinate system of the link's container.
Parameters:
Name Type Description points
array array of points to use for rendering this link Returns:
- Type
- void