[Tex/LaTex] Issue with links and milestones in Gantt chart

pgfgantt

I am currently using pgfgantt to add a Gantt chart to a Latex document. The chart spans a period of just under a year. I have used the code from (Getting gantt chart week to show week number) to add week numbers and its working fine. I have two problems that I would like to solve:

  • milestones are almost invisible
  • I would prefer straight line, such as link type to (f-s), however without text (to avoid clutter).

    \documentclass[tikz]{standalone}
    \usepackage{pgfgantt}
    \title{Gantt Chart}
    \begin{document}
    
    \newcounter{myWeekNum}
    \stepcounter{myWeekNum}
    %
    \newcommand{\myWeek}{\themyWeekNum
            \stepcounter{myWeekNum}
            \ifnum\themyWeekNum=53
            \setcounter{myWeekNum}{1}
            \else\fi
    }
    \setcounter{myWeekNum}{26}
    \ganttset{%
            calendar week text={\myWeek{}}%
    }
    \begin{figure}[h!bt]
            \caption{Time Plan}
            \begin{center}
                    \begin{ganttchart}[
                            vgrid={*{6}{draw=none}, dotted},
                            hgrid={dotted},
                            x unit=.08cm,
                            y unit title=.6cm,
                            y unit chart=1cm,
                            time slot format=isodate,
                            link/.style={->, ultra thick},
                            link bulge=4,
                            time slot format/start date=2017-07-01]{2017-07-01}{2018-06-30}
                            \ganttset{bar height=.6}
                            \gantttitlecalendar{year, month=name, week} \\
                            \ganttmilestone[name=e0]{Start}{2017-07-03} \\
                            \ganttbar[name=e1]{Task01}{2017-07-03}{2017-08-15} \\
                            \ganttbar[name=e2]{Task02}{2017-08-01}{2017-08-08}\\
                            \ganttbar[name=e3]{Task03}{2017-08-01}{2017-12-29}\\
                            \ganttbar[name=e4]{Task04}{2017-08-01}{2017-08-15}\\
                            \ganttbar[name=e5]{Task05}{2017-08-16}{2017-08-31}\\
                            \ganttbar[name=e6]{Task06}{2017-09-01}{2017-09-21}\\
                            \ganttbar[name=e7]{Task07}{2017-09-22}{2017-10-31}\\
                            \ganttmilestone[name=e8]{M1}{2017-11-01}\\
                            \ganttbar[name=e9]{Task08}{2017-11-01}{2017-11-14}\\
                            \ganttbar[name=e10]{Task09}{2017-11-01}{2017-12-22}\\
                            \ganttbar[name=e11]{Task10}{2017-12-25}{2018-01-01}\\
                            \ganttbar[name=e12]{Task11}{2018-01-02}{2018-01-05}\\
                            \ganttmilestone[name=e13]{M2}{2018-01-08}\\
                            \ganttbar[name=e14]{Task14}{2018-01-08}{2018-02-07}\\
                            \ganttbar[name=e15]{Task15}{2018-02-08}{2018-03-14}\\
                            \ganttmilestone[name=e16]{M3}{2018-03-15}\\
                            \ganttbar[name=e17]{Task17}{2018-03-15}{2018-05-14}\\
                            \ganttbar[name=e18]{Task18}{2018-05-15}{2018-05-23}\\
                            \ganttbar[name=e19]{Task19}{2018-05-24}{2018-05-31}
                            \ganttlink[link mid=.8]{e3}{e16}
                            \ganttlink[link type=-]{e4}{e5}
                            \ganttlink{e5}{e6}
                            \ganttlink{e6}{e7}
                            \ganttlink{e7}{e8}
                            \ganttlink{e8}{e9}
                            \ganttlink{e8}{e10}
                            \ganttlink{e10}{e11}
                            \ganttlink{e11}{e12}
                            \ganttlink{e12}{e13}
                            \ganttlink{e13}{e14}
                            \ganttlink{e14}{e15}
                            \ganttlink{e15}{e16}
                            \ganttlink{e16}{e17}
                            \ganttlink{e17}{e18}
                            \ganttlink{e18}{e19}
                    \end{ganttchart}
            \end{center}
    \end{figure}
    \end{document}
    

Gantt chart

Do you have any pointers?

Best Answer

For 1., add milestone/.append style={inner ysep=3mm}, to the chart settings.

For 2. you can make a new type of link based on e.g. f-s, and set the text label to be empty:

\newganttlinktypealias{straight}{f-s}
\setganttlinklabel{straight}{}

Add those before the ganttchart, and use link type=straight.

A shortened complete example, so it's easier to see:

output of code

\documentclass[tikz,border=5mm]{standalone}
\usepackage{pgfgantt}
\begin{document}

\newcounter{myWeekNum}
\stepcounter{myWeekNum}
%
\newcommand{\myWeek}{\themyWeekNum
        \stepcounter{myWeekNum}
        \ifnum\themyWeekNum=53
        \setcounter{myWeekNum}{1}
        \else\fi
}
\setcounter{myWeekNum}{26}
\ganttset{%
        calendar week text={\myWeek{}}%
}

% define a new link type
\newganttlinktypealias{straight}{f-s}
% remove label
\setganttlinklabel{straight}{}
\begin{ganttchart}[
            vgrid={*{6}{draw=none}, dotted},
            hgrid={dotted},
            x unit=.08cm,
            y unit title=.6cm,
            y unit chart=1cm,
            time slot format=isodate,
            link/.style={->, ultra thick},
            link bulge=4,
            time slot format/start date=2017-07-01,
            milestone/.append style={inner ysep=3mm}, % <-- added
             ]{2017-06-15}{2017-09-03}
            \ganttset{bar height=.6}
            \gantttitlecalendar{year, month=name, week} \\
            \ganttmilestone[name=e0]{Start}{2017-07-03} \\
            \ganttbar[name=e1]{Task01}{2017-07-03}{2017-07-15}\\
            \ganttbar[name=e2]{Task02}{2017-07-16}{2017-08-01}\\
            \ganttbar[name=e4]{Task04}{2017-08-02}{2017-08-15}\\

           \ganttlink{e0}{e1} 
           \ganttlink[link type=-]{e1}{e2} 
           \ganttlink[link type=straight]{e2}{e4}

\end{ganttchart}
\end{document}