PGF 甘特图,内部有组标签

PGF 甘特图,内部有组标签

当对甘特图组使用“内联”选项时,标签写在组上方。我想加粗组(这可以通过参数组高度来实现)并显示标签的名称里面组。我苦苦思索“组内联标签节点”参数,但未能得到我想要的结果。下面是一个例子来说明我想做什么。

下面的代码生成了此图。我想将“组的标签”写在灰色区域内(如果可能的话,居中)。

在此处输入图片描述

\documentclass[a4paper,11pt]{article}


\usepackage{tikz}
\usepackage{pgfgantt}
\usepackage{color}
\colorlet{mylightgray}{gray!35}

\begin{document}
\ganttset{milestone/.append style={red,rounded corners=5pt},
progress label node anchor/.append style={text=red}}

\begin{ganttchart}[
 x unit = 0.9cm,
 y unit title=0.5cm,
 y unit chart=0.7cm,
 vgrid, hgrid,
 title height=1,
 group right shift=0,
 group top shift=0.1,
 group height=0.7,
 group peaks width={0.2},
 group/.append style={fill=lightgray},
 ]{1}{6}
\gantttitle[]{2022}{3}    \gantttitle[]{2023}{3}\\
    \gantttitle{Jan}{1}
\gantttitle{Juin}{1}
\gantttitle{Oct}{1}
    \gantttitle{Jan}{1}
    \gantttitle{Juin}{1}
    \gantttitle{Oct}{1}
    \\
    \ganttgroup[inline=true]{Label of the group}{3}{6}\\
         \\
  \end{ganttchart}


\end{document}

谢谢你的帮助 !

答案1

添加选项

group inline label node/.style={yshift=0pt,font=\bfseries}

ganttchart环境。

在此处输入图片描述

\documentclass{article}
\usepackage{pgfgantt}
\usepackage{color}
\colorlet{mylightgray}{gray!35}

\begin{document}
\ganttset{milestone/.append style={red,rounded corners=5pt},
progress label node anchor/.append style={text=red}}

\begin{ganttchart}[
 x unit = 0.9cm,
 y unit title=0.5cm,
 y unit chart=0.7cm,
 vgrid, hgrid,
 title height=1,
 group right shift=0,
 group top shift=0.1,
 group height=0.7,
 group peaks width={0.2},
 group/.append style={fill=lightgray},
 group inline label node/.style={yshift=0pt,font=\bfseries}
 ]{1}{6}
    \gantttitle[]{2022}{3}    \gantttitle[]{2023}{3}\\
    \gantttitle{Jan}{1}
    \gantttitle{Juin}{1}
    \gantttitle{Oct}{1}
    \gantttitle{Jan}{1}
    \gantttitle{Juin}{1}
    \gantttitle{Oct}{1} \\
    \ganttgroup[inline]{Label of the group}{3}{6}\\
     \\
\end{ganttchart}
\end{document}

相关内容