6

Im trying to do a UML diagram for a script below in PlantUML.

[plantuml, target=diagram-sequence, format=png] 
....
@startuml
-> A: test
opt ((Exterme_DANGER_Forwith_cIES_MICRO_GYRO) || (Exterme_DANGER_Forwith_cIES_PANASONIC_GYRO)  || (Exterme_DANGER_Forwith_cIES_VIRTUAL)    || (Exterme_DANGER_Forwith_cIES_Cobra)     || (Exterme_DANGER_Forwith_cIES_VTI)    || (Exterme_DANGER_Forwith_cIES_VTI_SPI)    || (Exterme_DANGER_Forwith_cIES_VIRTUAL)    || (Exterme_DANGER_Forwith_cIES_VTI)     || (Exterme_DANGER_Forwith_cIES_VTI_SPI)   || (Exterme_DANGER_Forwith_cIES_VIRTUAL))    || (Exterme_DANGER_Forwith_cIES_Cobra5)  || (Exterme_DANGER_Forwith_cIES_Cobra4))
<- A
end opt
@enduml
....

When I do this I cannot see the complete diagram. PlantUML DIAGRAM

Does anyone know of a way to show the big opt conditon in multiple lines in the diagram?

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
Jackie
  • 61
  • 1
  • 4
  • Maybe you should try a few `\n` in the code like ` @startuml ... opt ((Exterme_DANGER_Forwith_cIES_MICRO_GYRO) || (Exterme_DANGER_Forwith_cIES_PANASONIC_GYRO) || \n (Exterme_DANGER_Forwith_cIES_VIRTUAL) || (Exterme_DANGER_Forwith_cIES_Cobra) || \n ... end opt @enduml – albert Feb 23 '22 at 09:57
  • ah ok , if I use \n but keep it in the same line while scripting. It works. Thanks a lot! – Jackie Feb 24 '22 at 05:47

1 Answers1

5

Adding newlines \n will break the opt across multiple lines in the diagram, but it will still be on one in the PlantUML text file, which can be hard to read.

To make things more readable, adding \ at the end of the line will allow splitting text across multiple lines.

Combining \n with \ allow splitting the single line across multiple lines in both the diagram and the file:

@startuml
-> A: test
opt ( \
    (Exterme_DANGER_Forwith_cIES_MICRO_GYRO)       \n\
    || (Exterme_DANGER_Forwith_cIES_PANASONIC_GYRO)\n\
    || (Exterme_DANGER_Forwith_cIES_VIRTUAL)       \n\
    || (Exterme_DANGER_Forwith_cIES_Cobra)         \n\
    || (Exterme_DANGER_Forwith_cIES_VTI)           \n\
    || (Exterme_DANGER_Forwith_cIES_VTI_SPI)       \n\
    || (Exterme_DANGER_Forwith_cIES_VIRTUAL)       \n\
    || (Exterme_DANGER_Forwith_cIES_VTI)           \n\
    || (Exterme_DANGER_Forwith_cIES_VTI_SPI)       \n\
    || (Exterme_DANGER_Forwith_cIES_VIRTUAL))      \n\
    || (Exterme_DANGER_Forwith_cIES_Cobra5)        \n\
    || (Exterme_DANGER_Forwith_cIES_Cobra4)        \n\
)
<- A
end opt
@enduml

Potherca
  • 13,207
  • 5
  • 76
  • 94