Больший контроль над позиционированием меток прогресса в pgfgantt

Больший контроль над позиционированием меток прогресса в pgfgantt

Следующий mwe — это немного неправильное использование пакета pgfgantt. Он должен показывать относительные усилия различных подзадач, составляющих большую задачу, и состояние завершения каждой подзадачи и т. д. Он должен давать представление об общем состоянии завершения основной задачи без учета времени выполнения отдельных подзадач.

Я потратил некоторое время на улучшение расположения меток, показывающих ход выполнения отдельных подзадач, но это не принесло особого результата.

Предложения о том, как разместить метки хода выполнения под или над центромвесьподзадачи (не находящиеся на границе завершенности/незавершенности) приветствуются.

\NeedsTeXFormat{LaTeX2e}
\documentclass[12pt]{standalone}
\usepackage{pgfgantt}
\usepackage{times}

\definecolor{teal}{rgb}{0,0.57,0.81}%
\definecolor{aqua}{rgb}{0.51,0.81,0.79}%
\definecolor{blue_gray}{rgb}{0.36,0.52,0.63}%

% create a new command for a ganttbar entry
\newcommand{\ganttbarentryprogresscustom}[5]{%
\ganttbar[progress=#1,%
bar/.append style={pattern color = #2},%
bar progress label anchor=south,%
bar inline label node/.style={above=3pt}]%
{#3}{#4}{#5}%
}%

\begin{document}
\begin{ganttchart}[%
x unit=1.4cm,%
y unit chart=1.1cm,%
time slot unit=day,%
bar/.append style={pattern=north west lines, pattern color = cyan},%
inline%
]{0}{11}%
\ganttgroup[inline=false]{Task 1}{1}{10}\\%
\ganttbarentryprogresscustom{100}{blue_gray}{Subtask 1}{1}{6}
\ganttbarentryprogresscustom{90}{teal}{Subtask 2}{7}{8}%
\ganttbarentryprogresscustom{75}{aqua}{Subtask 3}{9}{10}%
\end{ganttchart}
\end{document}

Вывод выглядит так:

введите описание изображения здесь

решение1

Если вы добавите bar progress label node/.append style={anchor=north,yshift=0.2em},, вы получите

\NeedsTeXFormat{LaTeX2e}
\documentclass[12pt]{standalone}
\usepackage{pgfgantt}
\usepackage{times}

\definecolor{teal}{rgb}{0,0.57,0.81}%
\definecolor{aqua}{rgb}{0.51,0.81,0.79}%
\definecolor{blue_gray}{rgb}{0.36,0.52,0.63}%

% create a new command for a ganttbar entry
\newcommand{\ganttbarentryprogresscustom}[5]{%
\ganttbar[progress=#1,%
bar/.append style={pattern color = #2},%
bar progress label anchor=south,%
bar progress label node/.append style={anchor=north,yshift=0.2em},
bar inline label node/.style={above=3pt}]%
{#3}{#4}{#5}%
}%

\begin{document}
\begin{ganttchart}[%
x unit=1.4cm,%
y unit chart=1.1cm,%
time slot unit=day,%
bar/.append style={pattern=north west lines, pattern color = cyan},%
inline%
]{0}{11}%
\ganttgroup[inline=false]{Task 1}{1}{10}\\%
\ganttbarentryprogresscustom{100}{blue_gray}{Subtask 1}{1}{6}
\ganttbarentryprogresscustom{90}{teal}{Subtask 2}{7}{8}%
\ganttbarentryprogresscustom{75}{aqua}{Subtask 3}{9}{10}%
\end{ganttchart}
\end{document}

введите описание изображения здесь

Связанный контент