Methods
-
(static) getLayout<K1, K2, D1, D2>(obj) : {(context: DvtDiagramLayoutContext<K1, K2, D1, D2>) => void}
-
A function that generates the layout callback function for the ojDiagram component.
Parameters:
Name Type Description objObject JSON object that defines positions of nodes, links paths and label layouts. The object supports the following properties. - {DvtDiagramLayoutContext} - layout context for the diagram
- {DvtDiagramLayoutContextNode} - layout context for the current node
- {DvtDiagramLayoutContext} - layout context for the diagram
- {DvtDiagramLayoutContextLink} - layout context for the current link
- {DvtDiagramLayoutContext} - layout context for the diagram
- {DvtDiagramLayoutContextLink} - layout context for the current link
- {DvtDiagramLayoutContext} - layout context for the diagram
Properties:
Name Type Argument Description obj.nodesArray.<Object> An array of objects with the following properties that describe a position for the diagram node and a layout for the node's label Properties
Name Type Argument Description idK1 id for the node xnumber x-coordinate for the node ynumber y-coordinate for the node labelLayoutoj.DiagramUtils.LabelLayout <optional>
An object that defines label layout for the node. See oj.DiagramUtils.LabelLayout object. The object defines absolute coordinates for label position. obj.linksArray.<Object> <optional>
An array of objects with the following properties that describe a path for the diagram link and a layout for the link's label. Properties
Name Type Argument Description idK2 id for the link pathstring <optional>
A string that represents an SVG path for the link. coordinateSpaceK1 <optional>
The coordinate container id for the link. If specified the link points will be applied relative to that container. If the value is not set, the link points are in the global coordinate space. labelLayoutoj.DiagramUtils.LabelLayout <optional>
An object that defines label layout for the link. See oj.DiagramUtils.LabelLayout object. obj.nodeDefaultsObject <optional>
An object that defines the default layout of the node label Properties
Name Type Description labelLayoutoj.DiagramUtils.LabelLayout | ((context: DvtDiagramLayoutContext<K1, K2, D1, D2>, node: DvtDiagramLayoutContextNode<K1, D1>) => DiagramUtils.LabelLayout) An object that defines default label layout for diagram nodes. See oj.DiagramUtils.LabelLayout object. The object defines relative coordinates for label position. E.g. if all the node labels should be positioned with a certain offset relative to the node, a label position can be defined using an object in node defaults. Alternatively a label layout can be defined with a function. The function will receive the following parameters:
obj.linkDefaultsObject <optional>
An object that defines a function for generating a link path and a default layout for the link label Properties
Name Type Argument Description path(context: DvtDiagramLayoutContext<K1, K2, D1, D2>, link: DvtDiagramLayoutContextLink<K1, K2, D2>) => string <optional>
a callback function that will be used to generate a link path. The function will receive the following parameters: labelLayout(context: DvtDiagramLayoutContext<K1, K2, D1, D2>, link: DvtDiagramLayoutContextLink<K1, K2, D2>) => DiagramUtils.LabelLayout <optional>
a function that defines default label layout for diagram links. The function will receive the following parameters: obj.viewport{x: number, y: number, w: number, h: number} | ((context: DvtDiagramLayoutContext<K1, K2, D1, D2>) => {x: number, y: number, w: number, h: number}) <optional>
An object with the following properties that defines diagram viewport. Alternatively a viewport can be defined with a function. The function will receive the following parameters:
Properties
Name Type Description xnumber x-coordinate ynumber y-coordinate wnumber width hnumber height Returns:
layout callback function- Type
- (context: DvtDiagramLayoutContext<K1, K2, D1, D2>) => void
Type Definitions
-
LabelLayout
-
The complete label layout object used to position node and link label
Properties:
Name Type Argument Description xnumber x-coordinate for the label ynumber y-coordinate for the label rotationPointXnumber <optional>
x-coordinate for label rotation point rotationPointYnumber <optional>
y-coordinate for label rotation point anglenumber <optional>
rotation angle for the label halignstring <optional>
horizontal alignment for the label. Valid values are "left", "right" or "center" valignstring <optional>
vertical alignment for the label. Valid values are "top", "middle", "bottom" or "baseline". The default value is "top"