I would like to implement a gantt chart function inside pgfplots. To draw the tasks, I have a macro that calculates the start and finish time of a task. However, when I use multiple tasks, the values inside are overridden and as a result it only shows a single task.
\documentclass[10pt]{article}
\usepackage{pgfplots}
\begin{document}
\newcommand{\task}[7]{
\pgfmathparse{#1/365+#2/12+#3}
\edef\taskstart{\pgfmathresult}
\pgfmathparse{#4/365+#5/12+#6}
\edef\taskfinish{\pgfmathresult}
\pgfmathparse{#7-0.4}
\edef\bottom{\pgfmathresult}
\pgfmathparse{#7+0.4}
\edef\top{\pgfmathresult}
\draw[blue,fill=blue!50!white] (axis cs:\taskstart,\bottom) rectangle (axis cs:\taskfinish,\top);
}
\begin{tikzpicture}
\begin{axis}[xmin=2011,xmax=2013,ymin=0,ymax=10]
\task{26}{1}{2011}{23}{6}{2011}{1} % this is not drawn
\task{26}{1}{2012}{23}{6}{2012}{3} % only this is drawn
\end{axis}
\end{tikzpicture}
\end{document}
I know that this is a question of expansion, but I have to admit that I do not know how to handle it within the axis.

pgfganttpackage. – percusse Sep 20 '12 at 18:02