1

Here is an example of what I got:

\documentclass[10pt,a4paper]{article}
\usepackage{pgfgantt}

\begin{document}
\begin{ganttchart}[
    expand chart=\textwidth,
    vgrid=true, hgrid=true,
    canvas/.style={draw=none},
    include title in canvas=false,
    y unit title=0.5cm,
    y unit chart=0.6cm,
    title/.style={draw=none, fill=none},
    title label font=\footnotesize
  ]{0}{14}
  \gantttitlelist{0,...,14}{1}\\
  \ganttbar{$\tau_1$}{0}{0}
  \ganttbar[inline]{}{3}{3} \ganttbar[inline]{}{6}{6}
  \ganttbar[inline]{}{9}{9} \ganttbar[inline]{}{12}{12}
  \\
  \ganttbar{$\tau_2$}{2}{2} \ganttbar{}{7}{7}
  \\
  \ganttbar{$\tau_3$}{4}{5} \ganttbar{}{8}{8}
\end{ganttchart}
\end{document}

enter image description here

I want to draw vertical lines that just cover one row. For example, on the row labelled $\tau_1$ there should be lines on the left side of the cells 0, 3, 6, 9, 12. On the $\tau_2$ row there should be lines on the left side of the cells 2, 7, 12. On $\tau_3$ there should be lines on the left side of 2 and 12.

I know pgfgantt has features for drawing vertical lines, but I couldn't find any for drawing vertical lines that does not cover the whole grid.

1 Answer 1

1

I can not find any build in way to do this, but you can define your own style:

\documentclass[10pt,a4paper]{article}
\usepackage{pgfgantt}

\begin{document}

\newganttchartelement*{vline}{
vline/.style={
  draw, dotted, outer sep=0 pt, inner sep=0 pt,
}, 
vline right shift=-1,
vline top shift=0,
vline height=1,
}

\begin{ganttchart}[
    expand chart=\textwidth,
%    vgrid=true, 
    hgrid=true,
    canvas/.style={draw=none},
    include title in canvas=false,
    y unit title=0.5cm,
    y unit chart=0.6cm,
    title/.style={draw=none, fill=none},
    title label font=\footnotesize
  ]{0}{14}
  \gantttitlelist{0,...,14}{1}\\
  \ganttbar{$\tau_1$}{0}{0}
  \ganttvline{}{0} \ganttvline{}{3} \ganttvline{}{6} \ganttvline{}{9} \ganttvline{}{12} 
  \ganttbar[inline]{}{3}{3} \ganttbar[inline]{}{6}{6}
  \ganttbar[inline]{}{9}{9} \ganttbar[inline]{}{12}{12}
  \\
  \ganttbar{$\tau_2$}{2}{2}
  \ganttvline{}{2} \ganttvline{}{7} \ganttvline{}{12}
  \ganttbar{}{7}{7}
  \\
  \ganttbar{$\tau_3$}{4}{5}
  \ganttvline{}{2} \ganttvline{}{12}
  \ganttbar{}{8}{8}
\end{ganttchart}
\end{document}

Gantt diagram with vertical lines

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .