Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to draw a diagram for packets scheduling in networks similar to the this one:

enter image description here

The same type of diagram (or very similar) can be used also for tasks scheduling.

Can you please indicate a template for this? Or a resource I could use.

Thanks a lot. The copyright for the image belongs to the authors from here.

share|improve this question
3  
Do you know about the pgfgantt package? See ctan.org/pkg/pgfgantt . This package typesets Gantt charts. –  Yori May 27 '12 at 17:21
    
knulp created a task diagram package. Check this: tex.stackexchange.com/questions/29679/pdflatex-and-pstricks –  user22273 Nov 18 '12 at 17:32
add comment

1 Answer

up vote 0 down vote accepted

sketch of an incomplete solution, to optimize

\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage[margin=15mm]{geometry}
\usetikzlibrary{shapes,arrows,fit,calc,positioning}


\begin{document}

\begin{tikzpicture}[xscale=1,transform shape]

\draw [-latex](-0.5,0) coordinate(dd)-- (0,0) coordinate (O1) -- (17,0)coordinate(ff) node[above]{$t$};
\draw [dashed,thick] (O1) -- (0,1) coordinate(S3) -- (0,3) coordinate(S2) -- (0,5) coordinate(e3) -- ++(0,1)coordinate(ff2);

\foreach \nn in{S3,S2,e3}{
\draw [thick] (dd|-\nn) node[above]{\nn}-- (\nn-|ff);
}

\foreach \xx in{1,2,...,16}{
\draw[dashed] (\xx,0) -- (\xx,0|- ff2);
}

\foreach \xx in{0,4,8,...,16}{
\draw[dashed] (\xx,0.2) -- (\xx,-0.2) node[below]{\xx 0};
}

\begin{scope}[shift={(e3)}]
\node[ above right=0.4cm and 0cm of e3,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n3a) {$3=f(e_3)$};
\draw[-latex,thick] (n3a.north west) -- ++(0,0.5)node[right]{$a^{e3}_{3=f(e3)}$};
\end{scope}

\begin{scope}[shift={(S2)}]
\coordinate(O2) at (2,0);
\node[ above right=0.4cm and 0cm of O2,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n4a) {$4=f(s_2)$};
\draw[-latex,thick,green] (n4a.north west) -- ++(0,0.5)node[right,fill=white]{$a^{S2}_{f(S2)}$};
\draw[-latex,thick,blue] ([xshift=2.7cm]n4a.north west) coordinate(bb1)-- ++(0,0.5)node[right,fill=white]{$a^{S2}_{3=f(e3)}$};
\draw[dashed,red] (n3a.south east) -- (bb1);
\node[right=0cm of n4a,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n3b) {$3=p(e_3)$};
\end{scope}

\begin{scope}[shift={(S3)}]
\coordinate(O3) at (0.5,0);
\node[ above right=0.4cm and 0cm of O3,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n1) {$1=f(s_2)$};
\node[right=0cm of n1,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n5) {$5$};
\node[right=0cm of n5,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n4b) {$4=p(S2)$};
\node[right=0cm of n4b,right,draw, minimum width=4cm,minimum height=0.8cm,fill=white](n3c) {$3$};
\end{scope}

\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thank you very much! –  ovdsrn May 28 '12 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.