Documentation
¶
Overview ¶
d2elklayout is a wrapper around the Javascript port of ELK.
Coordinates are relative to parents. See https://www.eclipse.org/elk/documentation/tooldevelopers/graphdatastructure/coordinatesystem.html
Index ¶
- Variables
- func DefaultLayout(ctx context.Context, g *d2graph.Graph) (err error)
- func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err error)
- type ConfigurableOpts
- type Direction
- type ELKEdge
- type ELKEdgeSection
- type ELKGraph
- type ELKLabel
- type ELKNode
- type ELKPoint
- type ELKPort
- type PortSide
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOpts = ConfigurableOpts{
Algorithm: "layered",
NodeSpacing: 70.0,
Padding: "[top=50,left=50,bottom=50,right=50]",
EdgeNodeSpacing: 40.0,
SelfLoopSpacing: 50.0,
}
Functions ¶
func DefaultLayout ¶ added in v0.1.4
Types ¶
type ConfigurableOpts ¶ added in v0.1.4
type ConfigurableOpts struct {
Algorithm string `json:"elk.algorithm,omitempty"`
NodeSpacing int `json:"spacing.nodeNodeBetweenLayers,omitempty"`
Padding string `json:"elk.padding,omitempty"`
EdgeNodeSpacing int `json:"spacing.edgeNodeBetweenLayers,omitempty"`
SelfLoopSpacing int `json:"elk.spacing.nodeSelfLoop"`
}
type ELKEdgeSection ¶
type ELKGraph ¶
type ELKGraph struct {
ID string `json:"id"`
LayoutOptions *elkOpts `json:"layoutOptions"`
Children []*ELKNode `json:"children,omitempty"`
Edges []*ELKEdge `json:"edges,omitempty"`
}
func ConvertGraph ¶ added in v0.6.9
func ConvertGraph(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (_ *ELKGraph, err error)
This is mostly copy paste from Layout until elk.layout step
type ELKNode ¶
type ELKNode struct {
ID string `json:"id"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
Children []*ELKNode `json:"children,omitempty"`
Ports []*ELKPort `json:"ports,omitempty"`
Labels []*ELKLabel `json:"labels,omitempty"`
LayoutOptions *elkOpts `json:"layoutOptions,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.