未連結的甘特圖組

未連結的甘特圖組

我創建了一個甘特圖,其中包含一些指示階段的甘特組。然而,這些甘特組與我不想要的任務相關聯(就像第一個圖,我希望它像紅色箭頭一樣)。

我嘗試將先前的物件與甘特群組之後的物件連結起來,但這對我來說不起作用(就像我嘗試將物件 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}

生產:

在此輸入影像描述

相關內容