对于给定的甘特图
\begin{ganttchart}[hgrid, vgrid, x unit=0.7cm, progress=today, today=4, newline shortcut=true, bar progress label node/.append style={right=5pt}]{1}{16}
\gantttitlelist[title list options={var=\y, evaluate=\y as \x using {"Year \y"}}]{1, 2, 3, 4}{4} \\
\gantttitlelist[title list options={var=\y, evaluate=\y as \x using {"Q\y"}}]{1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4}{1} \\
\ganttgroup[progress=25]{Progress}{1}{16} \\
\ganttbar{WP 1}{1}{1} \\
\ganttlinkedbar{WP 2}{2}{6} \\
\ganttlinkedbar{WP 3}{7}{16}
\end{ganttchart}
是否可以将进度值对齐到右侧(就像 WP 3 或整体进度一样?
答案1
请参阅手册第 30 页上的默认班次,对于组,有以下值:
/pgfgantt/group left shift =-.1
/pgfgantt/group right shift =.1
如果将这些值设置为 0,您将获得所需的结果。
梅威瑟:
\documentclass[border=20pt]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
%Gantchart config
hgrid,
vgrid,
x unit=0.7cm,
progress=today,
today=4,
newline shortcut=true,
group right shift=0, % Line added
group left shift=0, % Line added
bar progress label node/.append style={right=5pt}
]{1}{16}
\gantttitlelist[title list options={var=\y, evaluate=\y as \x using {"Year \y"}}]{1, 2, 3, 4}{4} \\
\gantttitlelist[title list options={var=\y, evaluate=\y as \x using {"Q\y"}}]{1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4}{1} \\
\ganttgroup[progress=25]{Progress}{1}{16} \\
\ganttbar{WP 1}{1}{1} \\
\ganttlinkedbar{WP 2}{2}{6} \\
\ganttlinkedbar{WP 3}{7}{16}
\end{ganttchart}
\end{document}