I'm using the package pgfgantt to create Gantt charts. I've seen that with the "today" key one can have vertical line drawn in the chart. However, only one today key is allowed. How can I have several vertical lines? I want to draw a Gantt chart for several years, and I'm using the vertical grid to have dotted lines for each month, but I'd like to have a vertical solid line to split each of the years.
Asked
Active
Viewed 8,075 times
9
Torbjørn T.
- 206,688
Didac Busquets
- 1,081
2 Answers
6
Version 5.0 of pgfgantt (released January 11 2018) now features a \ganttvline macro for drawing vertical lines. The syntax is
\ganttvrule[<options>]{<label>}{>tss>}
An example from the manual:
\documentclass[border=5mm]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
vgrid,
hgrid,
vrule/.style={very thick, blue},
vrule label font=\bfseries
]{1}{8}
\gantttitle{2018}{8} \\
\ganttbar{}{1}{2} \\
\ganttbar{}{4}{8}
\ganttvrule{day x}{2}
\ganttvrule[
vrule/.append style={red, thin},
vrule offset=.2,
vrule label node/.append style={anchor=north west}
]{day z}{6}
\end{ganttchart}
\end{document}
Torbjørn T.
- 206,688
5
This is what I use, I'm not absolutely satisfied because with this solution I cannot have lines for months and weeks.
\begin{ganttchart}[
today=5,
today rule/.style= {blue, ultra thick},
vgrid={*{37}{dotted},*{1}{green,ultra thick},*{52}{dotted}}
]{ 49 }
\gantttitle{ 2013 }{ 38 }\gantttitle{ 2014 }{ 11 } \\
\gantttitlelist{ 15 ,..., 52 }{1}\gantttitlelist{ 1 ,..., 11 }{1}\\
\ganttmilestone { Commencement date }{ 0 }{ 1 } \\
\ganttgroup { Design }{ 2 }{ 4 } \\
\ganttbar { Supply 1 }{ 5 }{ 23 } \\
\ganttbar { Work 2 }{ 24 }{ 49 } \\
\ganttmilestone { Taking over }{ 49 }{ 49 }
\end{ganttchart}}

David Carlisle
- 757,742
Penbeuz
- 1,669
-
Thanks for the answer.
Apparently with my latex and/or pgfgantt version I cannot compile your code. It does not recognise the grid specification:Package pgfkeys Error: I do not know the key '/tikz/*{37}{dotted}' and I am going to ignore it. Perhaps you misspelled it.My latex version is (in MacOS): pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=pdflatex 2011.9.29)
And my pgfgantt version is: pgfgantt 2011/04/18 v1.1
– Didac Busquets May 16 '13 at 10:40 -

\setLinesmacro and the variousvgridstyles from another answer of mine could be related (similar to penbeuz’ answer). – Qrrbrbirlbel May 16 '13 at 10:09