[Tex/LaTex] Message Sequence chart

boxesformattingspacingtikz-pgf

I'm drawing a sequencediagram with LaTeX. By now it looks like this:

enter image description here

  • Is it possible to remove the grey boxes?
  • Is it possible to put a space between handshake and ws.connect?

This is my Code:

\begin{figure}[hbtp!]
\begin{center}
    \fbox{
    \begin{sequencediagram}
        \newthread{c}{:Client}
        \newinst[4]{s}{:Server}

        \begin{call}
            {c}{Handshake}
            {s}{Handshake}
        \end{call}

        \begin{call}
            {c}{ws.connect}
            {s}{ws.connectes}
        \end{call}

        \mess{c}{ws.message}{s}
        \mess{s}{ws.message}{c}
        \mess{c}{ws.message}{s}

    \end{sequencediagram}
    }
\caption{WebSockets}
\end{center}
\end{figure}

Best Answer

Looking at pgf-umlsd.sty is not so difficult to find that by default, all threads are filled with gray!30. But being an optional parameter you can change it just declaring which color do you prefer: \newthread[white]{c}{:Client}. I've selected white because none draws transparent threads which don't cover the background dotted line.

Second question was more difficult because all call/message positions are based on several internal counters and harcoded factors. The best solution I could find was to step up the counter which places every call: \stepcounter{seqlevel}.

\documentclass[tikz, border=2mm]{standalone}

\usetikzlibrary{arrows,shadows}
\usepackage{pgf-umlsd}

\begin{document}
    \begin{sequencediagram}
        \newthread[white]{c}{:Client}
        \newinst[4]{s}{:Server}

        \begin{call}
            {c}{Handshake}
            {s}{Handshake}
        \end{call}

        \stepcounter{seqlevel}
        \begin{call}
            {c}{ws.connect}
            {s}{ws.connectes}
        \end{call}

        \stepcounter{seqlevel}
        \mess{c}{ws.message}{s}
        \mess{s}{ws.message}{c}
        \mess{c}{ws.message}{s}

    \end{sequencediagram}

\end{document}

enter image description here