排版甘特图

排版甘特图

所以我想排版如下图所示的甘特图。它应该是:年>月>日,最好按照第二张图的方向:

在此处输入图片描述

我得到的是:

在此处输入图片描述

我的代码:

\documentclass{article}
\usepackage{pgfgantt}
\usepackage{rotating}
\usepackage[graphicx]{realboxes}

\newganttchartelement*{mymilestone}{
mymilestone/.style={
shape=isosceles triangle,
inner sep=0pt,
draw=cyan,
top color=white,
bottom color=cyan!50
},
mymilestone incomplete/.style={
/pgfgantt/mymilestone,
draw=yellow,
bottom color=yellow!50
},
mymilestone label font=\slshape,
mymilestone left shift=0pt,
mymilestone right shift=0pt
}

\newgantttimeslotformat{stardate}{%
\def\decomposestardate##1.##2\relax{%
\def\stardateyear{##1}\def\stardateday{##2}%
}%
\decomposestardate#1\relax%
\pgfcalendardatetojulian{\stardateyear-01-01}{#2}%
\advance#2 by-1\relax%
\advance#2 by\stardateday\relax%
}


\begin{document}
\begin{sidewaysfigure}
\begin{ganttchart}[vgrid, hgrid]{1}{24}
\gantttitle{2019}{12} 
\gantttitle{2020}{12}\\
\gantttitlelist{1,...,24}{1}\\
%First Group
\ganttgroup{Group 1}{1}{10} \\
\ganttbar{Task 1}{2}{3} \\
\ganttbar{Task 2}{4}{10} \\
\ganttbar{Task 3}{9}{12}\\
%\ganttlink{elem0}{elem1}
\ganttlink{elem1}{elem2}
\ganttlink{elem2}{elem3}
%\ganttmilestone{Milestone 1}{11}
%Second Group
\ganttgroup{Group 2}{14}{20} \\
\ganttbar{Task 1}{15}{18} \\
\ganttbar{Task 2}{18}{21} \\
\ganttbar{Task 3}{22}{24}\\
%\ganttlink{elem4}{elem5}
\ganttlink{elem5}{elem6}
\ganttlink{elem6}{elem7}
%\ganttmilestone{Milestone 1}{11}
\end{ganttchart}
\end{sidewaysfigure}

\end{document}

相关内容