PlantUML: How to Insert a Newline or <br> in Between Legend & Footer and Caption Spacing?
Asked Answered
T

3

6

Have created a sequence diagram using PlantUML generating containing a legend and footer.

The footer contains my company's name along with copyright date.

The legend is very close to the footer and I need to insert a new line (or a <br> or a <p>) in between the legend and footer. Also, my caption seems to have a large space in between the caption and legend.

My puml DSL file:


@startuml
skinparam Shadowing false
title __Dating API Sequence Diagram__\n
caption \nVersion 1.0 - 6/26/2020 (Draft)\n
autonumber
activate DatingApp
DatingApp -> DatingRestController: hitExternalApi()
activate DatingRestController
DatingRestController -> DatingService: processService()
activate DatingService
DatingService -> DatingService: findProfile()
activate DatingService #90EE90
DatingService -> DatingService: doSomething()
DatingService -> DatingService: doSomethingElse()
deactivate DatingService
DatingService -> DatingRestController: return retValue
DatingRestController -> DatingApp: jsonPayload
deactivate DatingRestController
deactivate DatingApp
legend bottom right
Legend
|=Color |= Name |= Type |= Lifeline |
|<back:#FFFFFF>           </back>| DatingApp.hitExternalApi() | method | default |
|<back:#FFFFFF>           </back>| DatingRestController.processService() | method | default |
|<back:#FFFFFF>           </back>| DatingService.findProfile | method | default |
|<back:#90EE90>           </back>| DatingService.doSomething() | method | nested |
|<back:#90EE90>           </back>| DatingService.doSomethingElse() | method | nested |
endlegend
center footer MyCompany.com (c) 2020
@enduml

Here's the generated diagram from IntelliJ IDEA:

Generated Seq


Question(s):

  1. How to reduce the excessive space with the caption and legend (tried putting an <hr> but got an error inside IntelliJ IDEA as a workaround)?

  2. How to create horizontal lines (using <hr>) inside my sequence diagram to denote different sections?

  3. How to place a new line break or <p> or \n in between the legend and footer?

Thesis answered 29/6, 2020 at 8:42 Comment(1)
Out of your problems the messages 5,6 and 7 must be return messages (--> rather than ->). About (2) there is no 'section' in a SD, are you speaking about combined fragment ? Else that can indicate your SD is too complex and must be cut in several SDsFilaria
H
5

I use |||. This generates a vertical space, similar to a <br> in HTML.

Haldan answered 8/11, 2021 at 20:56 Comment(0)
D
4

For me, \n works within a sequence diagram text.

Delta answered 27/7, 2023 at 7:32 Comment(0)
F
0

I don't know the answer to your questions 1 and 3 but you have two options for question 2: So-called "Dividers" or groups.

Dividers

Here is the example from the PlantUML manual:

== Initialization ==
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

== Repetition ==
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response

Groups

You can also draw a box around one part of your diagramme and add a custom label to it, although people might mix the box up with combined fragments (alt, opt etc.).

Alice -> Bob: Authentication Request

group My own label
    Bob -> Alice: Authentication Accepted
    Alice -> Bob : Another request
    Bob -> Alice: Another answer
end

Alice -> Bob : and so forth
Francophile answered 30/6, 2020 at 13:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.