d2 icon indicating copy to clipboard operation
d2 copied to clipboard

layout,syntax: Specify horizontal vs vertical arrangement

Open alixander opened this issue 2 years ago • 2 comments

These should be scoped to containers. E.g. something like

arrangement: horizontal

a: {
  arrangement: horizontal
  ...
}
b: {
  arrangement: vertical
}

so a and b would be horizontal, the contents of a would be horizontal, and the contents of b would be vertical.

not sure arrangement is the best keyword here.

also for the value, other tools use LR and TD, which... is perhaps more descriptive, but less obvious to read. e.g. it wasn't clear to me for a long time that graphviz's graph TD wasn't just a header to be placed on every diagram and that it actually stood for top-down.

alixander avatar Nov 24 '22 05:11 alixander

What about defining the relationship type in addition to the container layout?

peer is horizontal hierarchical is vertical and the default

a: Node 1
b: Node 2
c: Node 3
d: Application

a <-> b <-> c {
  type: peer
}

d -> a 
d -> b
d -> c

Or some variant of the above that fits within your standards. :)

prowave avatar Nov 24 '22 15:11 prowave

the ability to specify it on a relationship level is possible in TALA, since it's our custom engine and we can do anything, but I don't think that granularity is supported in dagre/graphviz/elk. it's a good idea, but we'll probably do the container one first since it's portable across layout engines. ty @prowave

alixander avatar Nov 24 '22 16:11 alixander

I agree - this is an important feature, especially when having extensive diagrams

guybarnhartmagen avatar Nov 28 '22 09:11 guybarnhartmagen

This should actually come after glob support. Because we want it to apply recursively.

e.g.

a: {
  # All descendants + this container will have vertical
  **.orientation: vertical
}

alixander avatar Nov 28 '22 19:11 alixander