Federico Destefanis
Federico Destefanis

Reputation: 1078

plantuml - better disposition of arrows and text

I'm trying to plot this component diagram with plantuml

@startuml
skinparam linetype ortho
left to right direction

folder BASE {
    folder foo {
        component aaa
    }
    folder bar {
        component bbb
        folder ENV {
              artifact ccc <<config>>
              artifact ddd <<db>>
        }
    }

}

folder lorem {
    folder ipsum {
        component eee
        component fff
        component ggg
    }
    folder amet {
        component panel <<jar>>
    }
    folder dolor {
        artifact hhh <<config>>
    }
}

folder fox {
    folder jumps {
    artifact jjj <<document>>
    artifact kkk <<document>>
    artifact mmm<<document>>

    }
    folder lazy {
        artifact context.txt
    }
}

aaa --> context.txt : write
aaa --> bbb : launch
bbb --> hhh : read
bbb --> panel : launch
panel --> ccc : read
panel --> ddd : read

panel --> eee : run
panel --> fff : run
panel --> ggg : run

panel --> kkk : write
eee --> jjj : read
eee --> mmm: write

ggg --> jjj : write
ggg --> mmm: read

@enduml

the result is a bit messy: arrows overlapping and text on arrows difficult to read

see enter image description here

Is there a way to better control arrows and text disposition? (for example something for minimizing arrow intersections and having text closer to the corresponding arrow)

Upvotes: 7

Views: 11042

Answers (1)

Fuhrmanator
Fuhrmanator

Reputation: 12882

When a diagram is complex, it can be a nondeterministic struggle to make it more readable. Some suggestions:

  • make the associations wider with skinparam ArrowThickness 3 or change the font for the text on the arrows to bold in a similar way.
  • try skinparam linetype polyline
  • put the names at the start or the end of an arrow, e.g. instead of panel --> eee : run use panel "run" --> eee (for the name at the start) or panel --> "run" eee (for the name at the end)
  • group two packages inside a together {...} (it's like a hidden rectangle, and will perhaps add more space).
  • toggle the left to right direction instruction (with a comment).

Here are a few of things applied to your diagram, but it could be better:

@startuml
skinparam linetype polyline
'left to right direction

skinparam Arrow {
    MessageAlignment left
    Thickness 3
    FontStyle Bold
    Color Blue
}

folder BASE {
    folder foo {
        component aaa
    }
    folder bar {
        component bbb
        folder ENV {
              artifact ccc <<config>>
              artifact ddd <<db>>
        }
    }

}

folder lorem {
    folder ipsum {
        component eee
        component fff
        component ggg
    }
    folder amet {
        component panel <<jar>>
    }
    folder dolor {
        artifact hhh <<config>>
    }
}

folder fox {
    folder jumps {
    artifact jjj <<document>>
    artifact kkk <<document>>
    artifact mmm<<document>>

    }
    folder lazy {
        artifact context.txt
    }
}

aaa --> "write" context.txt
aaa --> "launch" bbb 
bbb --> "read" hhh
bbb --> panel : launch
panel --> ccc : read
panel --> ddd : read

panel --> eee : run
panel --> fff : run
panel --> ggg : run

panel --> kkk : write
eee --> jjj : read
eee --> mmm: write

ggg --> jjj : write
ggg --> mmm: read
@enduml

Polyline and other hacks

Upvotes: 4

Related Questions