Created
February 15, 2022 13:40
-
-
Save yitsushi/ce4c6ef2bb749fc4bb77c5127ac90ca8 to your computer and use it in GitHub Desktop.
Simple Communication Diagram with LaTeX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{standalone} | |
\usepackage{tikz} | |
\usepackage{transparent} | |
\usepackage{fontspec} | |
\usepackage{xcolor} | |
\usepackage{graphicx} | |
\usepackage{anyfontsize} | |
\usetikzlibrary{calc, backgrounds, positioning, matrix} | |
\newcommand{\layer}[3]{ | |
\node[draw] (top) at (#1, #2) {#3}; | |
\node[draw] (bottom) at (#1, 0) {#3}; | |
\draw (top.south) -| (bottom.north); | |
} | |
\newcommand{\arrow}[5]{ | |
\draw[-stealth] (#1, #3) -- (#2, #3) node [#5] {#4}; | |
} | |
\newcommand{\arrowstream}[6]{ | |
\draw[-stealth, dotted] (#1, #3) -- (#2, #4) node [#6] {#5}; | |
} | |
\definecolor{foreground}{RGB}{149, 149, 159} | |
\definecolor{background}{RGB}{41, 42, 45} | |
\begin{document} | |
\begin{tikzpicture}[ | |
draw=foreground, text=foreground, | |
label/.style={pos=0.5,above,font=\tiny, sloped} | |
] | |
\newcommand{\height}{5}; | |
\newcommand{\webui}{0}; | |
\newcommand{\gitops}{5}; | |
\newcommand{\mngc}{10}; | |
\newcommand{\leafca}{15}; | |
\layer{\webui} {\height} {Web UI}; | |
\layer{\gitops} {\height} {Backe-end}; | |
\layer{\mngc} {\height} {Agent}; | |
\layer{\leafca} {\height} {Cluster}; | |
\arrow{\webui}{\gitops}{4}{List all Releases}{label}; | |
\arrowstream{\gitops}{\webui}{1}{0.5}{Stream}{label}; | |
\arrow{\gitops}{\mngc}{3.5}{List all Releases} {label}; | |
\draw[dotted] (\mngc, 2.75) -- (7.5, 2.75); | |
\draw[dotted] (7.5, 2.75) -- (7.5, 1) | |
node [label, rotate=180] {Stream}; | |
\arrowstream{7.5}{\gitops}{1}{1}{}{}; | |
\arrow{\mngc}{\leafca}{3} | |
{List all Releases}{label}; | |
\draw[dotted] (\mngc, 2.5) -- (7.5, 2.5); | |
\arrowstream{\leafca}{\mngc}{2.5}{2.5} | |
{List of events (Releases)}{label}; | |
\arrowstream{\leafca}{\mngc}{2}{2} | |
{New events (Release)}{label}; | |
\arrowstream{\leafca}{\mngc}{1.5}{1.5} | |
{New events (Release)}{label}; | |
\draw[dotted] (\mngc,2) -- (7.5, 2); | |
\draw[dotted] (\mngc,1.5) -- (7.5, 1.5); | |
% Add a bit of margin ;) | |
\node[yshift=1em, xshift=-2em] at (0, \height) {}; | |
\node[yshift=-1em, xshift=2em] at (\leafca, 0) {}; | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With my "template" structure: https://gist.github.com/yitsushi/39c544191c58e1b41abce60bff9c7ef4