Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (C4 styled) Sequence Diagram support #308

Merged
merged 5 commits into from
May 27, 2023

Conversation

kirchsth
Copy link
Contributor

@kirchsth kirchsth commented May 21, 2023

related to #307

In the final solutions the sequence diagram supports descriptions, line breaks, links, ... of all elements.
The only main difference are
a) boundaries have to be defined without { and } and instead of } the Boundary_End() macro has to be called
b) descriptions of the elements (person, system,... ) are deactivated; they can be activated via the layout option SHOW_ELEMENT_DESCRIPTIONS(?show)
c) in contrast to a normal sequence diagram the foot boxes are deactivated; they can be activated via SHOW_FOOT_BOXES(?show)

The C4 language itself is basically not extended, missing new features like Grouping messages have to added with native PlantUML syntax.

I have no useful sample at the moment, maybe someone can attach a more practical sample

(part of the new docu)

(C4 styled) Sequence diagram

C4-PlantUML does not offer a full sequence diagram support,
but existing elements and relationships can be reused as participants and calls in the corresponding styles.

!!! Contrary to all other diagrams, please define boundaries without { and } and mark a boundary end with Boundary_End() !!!

  • Import: !include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Sequence.puml

  • Additional Macros (based on component diagram macros):

    • Basically all element specific macros (Person, System, Container...) can be reused with following differences:
      • element descriptions are typically not displayed (can be activated via SHOW_ELEMENT_DESCRIPTIONS())
      • boundaries have to be defined without { and } and instead of } the Boundary_End() macro has to be called
    • Additional (element specific) Macros:
      • Boundary_End()
    • Additional (element specific) Layout Options:
      • SHOW_ELEMENT_DESCRIPTIONS(?show)
      • SHOW_FOOT_BOXES(?show)
    • Only following 3 relationship specific macros are supported:
      • Rel($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
      • RelIndex($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
      • RelSpecialIndex($rel, $e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link=""):
        $rel enables the definition of all PlantUML specific arrow types, details see e.g.
        All arrow types and
        Slanted or odd arrows
    • The 5 index related macros (like the dynamic diagram)
      • (lowercase) increment($offset=1): increase current index (procedure which has no direct output)
      • (lowercase) setIndex($new_index): set the new index (procedure which has no direct output)
      • LastIndex(): return the last used index (function which can be used as argument)
      • Index($offset=1): returns current index and calculates next index (function which can be used as argument)
      • SetIndex($new_index): returns new set index and calculates next index (function which can be used as argument)
  • (Typically additional used) PlantUML statements:

(end of the new docu)

Themes supports sequence diagrams too (details see new section in Themes.md)

It can be tested via my extended branch

BR Helmut

@kirchsth kirchsth requested a review from Potherca May 21, 2023 18:17
@kirchsth kirchsth merged commit 0fac328 into plantuml-stdlib:master May 27, 2023
1 check passed
@kirchsth kirchsth deleted the feature/sequence branch May 27, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants