terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.

Home Page:https://d2lang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

elk: postprocess to balance bends

alixander opened this issue · comments

We can postprocess ELK layouts to make the bends in the middle of routes to look nicer.

Screen Shot 2023-12-25 at 1 09 48 PM
style: {
  fill: transparent
}
*.style: {
  fill: transparent
  stroke: black
}

# How to apply stroke color to all connections?
# * -> *.style: {
#   stroke: black
# }

# This will override terminator class styling.
# *: {
#   height: 100
#   width: 150
# }

classes: {
  terminator: {
    # label: ""
    height: 50
    width: 150
    style: {
      border-radius: 1000
    }
  }
  process: {
    height: 100
    width: 150
  }
  input: {
    height: 100
    width: 150
    shape: parallelogram
  }
  condition: {
    height: 100
    width: 150
    shape: diamond
  }
  loop: {
    height: 100
    width: 150
    shape: hexagon
  }
}

start1 -> data -> condition1

true: from diamond's\n right corner
false: from diamond's\n left corner

condition1 -> false: no
condition1 -> true: yes

false -> end1
true -> end1

start2 -> loop1 -> process1
process1 -> loop1: continue
loop1 -> end2: break

start1.class: terminator
start2.class: terminator
end1.class: terminator
end2.class: terminator
process1: inside loop
process1.class: process

data.class: input

loop1: i = 0(1)n
loop1.class: loop

condition1
condition1.class: condition

https://play.d2lang.com/?script=lJPBitswEIbv8xQ_m0PbhQ32wl4Eba99gB57UexJLKJozEhpGkrevUi2vGYbSjcQohn9880vjRLT1bPBbwL2znuDpDbE0SqHRDd63P5TAMSkcmSDnbfdkW5EG3yTC5LAjqO_zvvoxIuWrPfoJATukpMQv9IGj3j6glWjDd5iNyjg74OLuDjvIT9Z1fWMxHpywSZRdN7GiExx4bDN3Aob2B2GZNA2TYkvrk-DQfvSTORSyXE65CtxioENvN2xN3h4KHHFvTQlXNFQnC_3lT870Z71SW3vzrFYmGQ3mr6jSscx1oK11b_gWe_CeE7_pQbiYEc2GK1a79nLQe1pxnQSepcn8D5U7-xJQj9DvMj4vvqBf9mDhFJ_I4rJamrz-HubbP5dfLVESc9ssFc51b4f4o8AzY3QiQZW2lsf74k87xcNvUJzi7kkyJv81O7KkSZqznHo2-JjCSbPzznOxy-V8wxbqotl1-QDJRfOTIuaQ_9ssFO2x3oD2_ICzertzW3ubGQX99P31NWRgQsx_2GyjSVbC-aYKI-hJstLI5rP4fAZzcf2U5gSVVRwq4tcLatkydCfAAAA__8%3D&layout=elk&