未链接的甘特图组

未链接的甘特图组

我创建了一个甘特图,其中包含一些甘特图组,用于指示各个阶段。但是这些甘特图组与我不想要的任务相关联(例如第一个图,我希望它像红色箭头一样)。

我尝试将之前的对象与甘特图组之后的对象链接起来,但是没有成功(就像第二张图我尝试将对象 3 与对象 5 链接起来一样)。

有什么解决办法吗?!

第一个图

第二幅图

\begin{ganttchart}[
vgrid
]{0}{17}
\gantttitle{Weeks}{18} \\
\gantttitlecalendar*[title left shift=1,title right shift=1]{1}{16}{day}
 \\[grid]

\ganttgroup{Phase 1}{1}{5} \\
\ganttbar{System Analysis}{1}{3} \\
\ganttlinkedbar{System Design}{4}{5} \ganttnewline
\ganttmilestone{System Architecture}{5} \ganttnewline

\ganttgroup{Phase 3}{6}{12} \\
\ganttlinkedbar{System Implementation}{6}{8} \ganttnewline
\ganttlinkedbar{Benchmarks Implementation}{9}{12} \ganttnewline
\ganttmilestone{System and Benchmarks code}{12} \ganttnewline

\ganttgroup{Phase 4}{13}{13} \\
\ganttlinkedbar{System Evaluation}{13}{13} \ganttnewline
\ganttmilestone{Evaluation Results}{13} \ganttnewline

\ganttgroup{Phase 4}{13}{16} \\
\ganttbar{Documentation}{13}{16}\ganttnewline
\ganttmilestone{Milestone}{16} 

\ganttlink{elem1}{elem2}
\ganttlink{elem2}{elem3}
\ganttlink{elem3}{elem5}
\ganttlink{elem5}{elem6}
\ganttlink{elem6}{elem7}
\ganttlink{elem7}{elem8}
\ganttlink{elem8}{elem9}
\ganttlink{elem9}{elem10}
\ganttlink{elem10}{elem11}
\ganttlink{elem11}{elem12}
\ganttlink{elem12}{elem13}

\end{ganttchart}

答案1

您必须尝试使用​​链接的参数,即link bulgelink mid。它们允许您指定垂直链接的凸起和位置。pgfgantt有关更多信息,请参阅文档,第 38 页。

无论如何,代码:

\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
       \begin{ganttchart}[
    vgrid
    ]{0}{17}
    \gantttitle{Weeks}{18} \\
    \gantttitlecalendar*[title left shift=1,title right shift=1]{1}{16}{day}
     \\[grid]

    \ganttgroup{Phase 1}{1}{5} \\
    \ganttbar{System Analysis}{1}{3} \\
    \ganttlinkedbar{System Design}{4}{5} \ganttnewline
    \ganttmilestone{System Architecture}{5} \ganttnewline

    \ganttgroup{Phase 3}{6}{12} \\
    \ganttbar{System Implementation}{6}{8} \ganttnewline
    \ganttlinkedbar{Benchmarks Implementation}{9}{12} \ganttnewline
    \ganttmilestone{System and Benchmarks code}{12} \ganttnewline

    \ganttgroup{Phase 4}{13}{13} \\
    \ganttbar{System Evaluation}{13}{13} \ganttnewline
    \ganttmilestone{Evaluation Results}{13} \ganttnewline

    \ganttgroup{Phase 4}{13}{16} \\
    \ganttbar{Documentation}{13}{16}\ganttnewline
    \ganttmilestone{Milestone}{16} 

    \ganttlink{elem1}{elem2}
    \ganttlink{elem2}{elem3}
    \ganttlink[link bulge=1,link mid=0.3]{elem3}{elem5}
    \ganttlink{elem5}{elem6}
    \ganttlink{elem6}{elem7}

    \ganttlink[link bulge=1,link mid=0.3]{elem7}{elem9}
    \ganttlink{elem9}{elem10}

    \ganttlink[link bulge=1,link mid=0.3]{elem10}{elem12}
    \ganttlink{elem12}{elem13}

    \end{ganttchart}\end{document}

结果:

在此处输入图片描述

编辑

由于用户在评论中完善了他的请求,因此我在此报告了新代码。为了使组的第一个项目不链接到组本身,只需将 替换为 即可\ganttlinkedbar\ganttbar我在以下行中完成了此操作:

 \ganttbar{System Implementation}{6}{8} \ganttnewline

新代码:

    \documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
vgrid
]{0}{17}
\gantttitle{Weeks}{18} \\
\gantttitlecalendar*[title left shift=1,title right shift=1]{1}{16}{day}
 \\[grid]

\ganttgroup{Phase 1}{1}{5} \\
\ganttbar{System Analysis}{1}{3} \\
\ganttlinkedbar{System Design}{4}{5} \ganttnewline
\ganttmilestone{System Architecture}{5} \ganttnewline

\ganttgroup{Phase 3}{6}{12} \\
\ganttbar{System Implementation}{6}{8} \ganttnewline
\ganttlinkedbar{Benchmarks Implementation}{9}{12} \ganttnewline
\ganttmilestone{System and Benchmarks code}{12} \ganttnewline

\ganttgroup{Phase 4}{13}{13} \\
\ganttlinkedbar{System Evaluation}{13}{13} \ganttnewline
\ganttmilestone{Evaluation Results}{13} \ganttnewline

\ganttgroup{Phase 4}{13}{16} \\
\ganttbar{Documentation}{13}{16}\ganttnewline
\ganttmilestone{Milestone}{16} 

\ganttlink{elem1}{elem2}
\ganttlink{elem2}{elem3}
\ganttlink[link bulge=2,link mid=0.3]{elem3}{elem5}
\ganttlink{elem5}{elem6}
\ganttlink{elem6}{elem7}
\ganttlink{elem7}{elem8}
\ganttlink{elem8}{elem9}
\ganttlink{elem9}{elem10}
\ganttlink{elem10}{elem11}
\ganttlink{elem11}{elem12}
\ganttlink{elem12}{elem13}

\end{ganttchart}
\end{document}

生成:

在此处输入图片描述

相关内容