2.7.2. Sequence Diagram¶
sphinxcontrib-seqdiag is a Sphinx extension for embedding
sequence diagrams. You can embed sequence diagrams with the .. seqdiag::
directive.
- PyPI Package
- Documentation
- Git Repository
Sphinx extension for embedding sequence diagrams using seqdiag.
- Features
Generate sequence-diagram from dot like text (basic feature).
Multilingualism for node-label (utf-8 only).
Directive Body Diagram¶
-
.. seqdiag::
¶ For more details, see sphinxcontrib-seqdiag in the extension demonstration and the
README.rst
in the extension Git repository.- The example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
.. seqdiag:: :align: center seqdiag { # define order of elements # seqdiag sorts elements by order they appear browser; database; webserver; browser -> webserver [label = "GET /index.html"]; browser <-- webserver; browser -> webserver [label = "POST /blog/comment"]; webserver -> database [label = "INSERT comment"]; webserver <-- database; browser <-- webserver; }
- Which gives
Description Table¶
- the example
1 2 3 4 5 6 7 8 9 10
.. seqdiag:: :align: center :desctable: seqdiag { A -> B -> C; A [description = "browsers in each client"]; B [description = "web server"]; C [description = "database server"]; }
- which gives
Name
Description
A
browsers in each client
B
web server
C
database server
Include Diagram¶
- the example
1 2 3 4
.. seqdiag:: seqdiag/example.diag :caption: Style attributes to diagram and edges (Sequence Diagram example) :align: center :height: 480
- which gives
Figure 2.47 Style attributes to diagram and edges (Sequence Diagram example)¶
- which needs
The example above comes from the original Sample diagrams web page and processed the following file content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
seqdiag { // Set edge metrix. edge_length = 300; // default value is 192 span_height = 80; // default value is 40 // Set fontsize. default_fontsize = 16; // default value is 11 // Do not show activity line activation = none; // Numbering edges automaticaly autonumber = True; // Change note color default_note_color = lightgreen; browser -> webserver [label = "GET \n/index.html"]; browser <-- webserver [note = "Apache works!"]; // Separator === Separator line === // color of edge browser -> webserver [label = "misformatted", color = red]; // failed edge browser -> webserver [label = "failed browser", failed]; }