place elk edge labels on right with more padding
This commit is contained in:
parent
9f9774b142
commit
6bb39115d4
1 changed files with 19 additions and 13 deletions
|
|
@ -78,13 +78,15 @@ type ELKGraph struct {
|
|||
}
|
||||
|
||||
type ELKLayoutOptions struct {
|
||||
Algorithm string `json:"elk.algorithm,omitempty"`
|
||||
HierarchyHandling string `json:"elk.hierarchyHandling,omitempty"`
|
||||
NodeSpacing float64 `json:"spacing.nodeNodeBetweenLayers,omitempty"`
|
||||
Padding string `json:"elk.padding,omitempty"`
|
||||
EdgeNodeSpacing float64 `json:"spacing.edgeNodeBetweenLayers,omitempty"`
|
||||
Direction string `json:"elk.direction"`
|
||||
SelfLoopSpacing float64 `json:"elk.spacing.nodeSelfLoop"`
|
||||
Algorithm string `json:"elk.algorithm,omitempty"`
|
||||
HierarchyHandling string `json:"elk.hierarchyHandling,omitempty"`
|
||||
NodeSpacing float64 `json:"spacing.nodeNodeBetweenLayers,omitempty"`
|
||||
Padding string `json:"elk.padding,omitempty"`
|
||||
EdgeNodeSpacing float64 `json:"spacing.edgeNodeBetweenLayers,omitempty"`
|
||||
Direction string `json:"elk.direction"`
|
||||
SelfLoopSpacing float64 `json:"elk.spacing.nodeSelfLoop"`
|
||||
EdgeLabelSpacing float64 `json:"spacing.edgeLabel,omitempty"`
|
||||
LabelSideSelection string `json:"elk.layered.edgeLabels.sideSelection,omitempty"`
|
||||
}
|
||||
|
||||
func Layout(ctx context.Context, g *d2graph.Graph) (err error) {
|
||||
|
|
@ -107,11 +109,13 @@ func Layout(ctx context.Context, g *d2graph.Graph) (err error) {
|
|||
elkGraph := &ELKGraph{
|
||||
ID: "root",
|
||||
LayoutOptions: &ELKLayoutOptions{
|
||||
Algorithm: "layered",
|
||||
HierarchyHandling: "INCLUDE_CHILDREN",
|
||||
NodeSpacing: 100.0,
|
||||
EdgeNodeSpacing: 50.0,
|
||||
SelfLoopSpacing: 50.0,
|
||||
Algorithm: "layered",
|
||||
HierarchyHandling: "INCLUDE_CHILDREN",
|
||||
NodeSpacing: 100.0,
|
||||
EdgeNodeSpacing: 50.0,
|
||||
SelfLoopSpacing: 50.0,
|
||||
EdgeLabelSpacing: 5.0,
|
||||
LabelSideSelection: "SMART_UP",
|
||||
},
|
||||
}
|
||||
switch g.Root.Attributes.Direction.Value {
|
||||
|
|
@ -155,7 +159,9 @@ func Layout(ctx context.Context, g *d2graph.Graph) (err error) {
|
|||
|
||||
if len(obj.ChildrenArray) > 0 {
|
||||
n.LayoutOptions = &ELKLayoutOptions{
|
||||
Padding: "[top=75,left=75,bottom=75,right=75]",
|
||||
Padding: "[top=75,left=75,bottom=75,right=75]",
|
||||
EdgeLabelSpacing: 5.0,
|
||||
LabelSideSelection: "SMART_UP",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue