任务重叠,在 pgfgantt 中显示为粗体

任务重叠,在 pgfgantt 中显示为粗体

在此处输入图片描述

在我的pgfgantt图表中,任务 6 和任务 7 重叠并且与其他任务相比看起来很粗。

\documentclass[xcolor=table]{beamer}
\usepackage{pgfgantt}
\usetheme{Madrid}

\begin{document}
\begin{frame}{Work plan}{Tasks}
\frametitle{Gantt charts}
\begin{ganttchart}[
    today=18,
    today rule/.style= {blue, thick},
    x unit=0.25cm,
    y unit title=0.5cm,
    y unit chart=0.35cm,
    title label font=\tiny,
    bar label font=\tiny,
    group label font=\tiny\bfseries,
    milestone label font=\tiny\itshape,
    vgrid, hgrid]{1}{36}
    \gantttitle{2017}{12}
    \gantttitle{2018}{24} \\
    \gantttitle{October}{4}
    \gantttitle{November}{4}
    \gantttitle{December}{4}
    \gantttitle{January}{4}
    \gantttitle{February}{4}
    \gantttitle{March}{4}
    \gantttitle{April}{4} 
    \gantttitle{May}{4}
    \gantttitle{June}{4} \\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 1}{1}{36} \\
    \ganttbar[bar/.append style={fill=blue!10}]{Task 2}{5}{6} \\
    \ganttbar[bar/.append style={fill=blue!10}]{Task 3}{8}{10} \\
    \ganttbar[bar/.append style={fill=blue!10}]{Task 4}{11}{13} \\
    \ganttbar[bar/.append style={fill=blue!10}]{Task 5}{12}{18} \\
    \ganttmilestone{Task 5.1}{18}\\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 6}{13}{24} 
    \ganttbar[bar/.append style={fill=blue!40}]{Task 6}{29}{29}
    \ganttbar[bar/.append style={fill=blue!40}]{Task 6}{31}{32}\\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 7}{25}{28} 
    \ganttbar[bar/.append style={fill=blue!40}]{Task 7}{33}{36} \\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 8}{30}{30} \\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 9}{17}{32} \\
    \ganttmilestone{Task 9.1}{32}\\
    \ganttbar[bar/.append style={fill=blue!40}]{Task 10}{30}{35} \\
    \ganttmilestone{Task 11}{35}
    \ganttlink{elem1}{elem2}
    \ganttlink{elem2}{elem3}
    \ganttlink{elem4}{elem5}
    \ganttlink{elem6}{elem9}
    \ganttlink{elem9}{elem7}
    \ganttlink{elem7}{elem11}
    \ganttlink{elem11}{elem8}
    \ganttlink{elem8}{elem10}
    \ganttlink{elem12}{elem13}
    \ganttlink{elem14}{elem15}
\end{ganttchart}
\end{frame}
\end{document}

你能给我一个解决方案吗?谢谢。

答案1

它看起来很粗,因为Task 6在同一个地方打印了三次。但我认为你只需要打印一次,所以在任务的最后两部分中将标签留空。例如,\ganttbar[bar/.append style={fill=blue!40}]{}{29}{29}而不是\ganttbar[bar/.append style={fill=blue!40}]{Task 6}{29}{29}

\ganttset顺便说一下,您可以通过使用图表内部来简化一些代码。

非粗体

\documentclass[xcolor=table]{beamer}
\usepackage{pgfgantt}
\usetheme{Madrid}

\begin{document}
\begin{frame}{Work plan}{Tasks}
\frametitle{Gantt charts}
\begin{ganttchart}[
    today=18,
    today rule/.style= {blue, thick},
    x unit=0.25cm,
    y unit title=0.5cm,
    y unit chart=0.35cm,
    title label font=\tiny,
    bar label font=\tiny,
    group label font=\tiny\bfseries,
    milestone label font=\tiny\itshape,
    bar/.append style={fill=blue!40},
    vgrid, hgrid]{1}{36}
    \gantttitle{2017}{12}
    \gantttitle{2018}{24} \\
    \gantttitle{October}{4}
    \gantttitle{November}{4}
    \gantttitle{December}{4}
    \gantttitle{January}{4}
    \gantttitle{February}{4}
    \gantttitle{March}{4}
    \gantttitle{April}{4} 
    \gantttitle{May}{4}
    \gantttitle{June}{4} \\
    \ganttbar{Task 1}{1}{36} \\
    \ganttset{bar/.append style={fill=blue!10}}
    \ganttbar{Task 2}{5}{6} \\
    \ganttbar{Task 3}{8}{10} \\
    \ganttbar{Task 4}{11}{13} \\
    \ganttbar{Task 5}{12}{18} \\
    \ganttmilestone{Task 5.1}{18}\\
    \ganttset{bar/.append style={fill=blue!40}}
    \ganttbar{Task 6}{13}{24} 
    \ganttbar{}{29}{29} % <-- empty label
    \ganttbar{}{31}{32}\\ % <-- empty label
    \ganttbar{Task 7}{25}{28} 
    \ganttbar{}{33}{36} \\ % <-- empty label
    \ganttbar{Task 8}{30}{30} \\
    \ganttbar{Task 9}{17}{32} \\
    \ganttmilestone{Task 9.1}{32}\\
    \ganttbar{Task 10}{30}{35} \\
    \ganttmilestone{Task 11}{35}
    \ganttlink{elem1}{elem2}
    \ganttlink{elem2}{elem3}
    \ganttlink{elem4}{elem5}
    \ganttlink{elem6}{elem9}
    \ganttlink{elem9}{elem7}
    \ganttlink{elem7}{elem11}
    \ganttlink{elem11}{elem8}
    \ganttlink{elem8}{elem10}
    \ganttlink{elem12}{elem13}
    \ganttlink{elem14}{elem15}
\end{ganttchart}
\end{frame}
\end{document}

相关内容