Bessere Kontrolle über die Positionierung von Fortschrittsbeschriftungen in pgfgantt

Bessere Kontrolle über die Positionierung von Fortschrittsbeschriftungen in pgfgantt

Das folgende MWE ist ein kleiner Missbrauch des pgfgantt-Pakets. Es soll den relativen Aufwand verschiedener Unteraufgaben, die eine größere Aufgabe bilden, und den Fertigstellungsstatus jeder Unteraufgabe usw. zeigen. Es soll einen Eindruck vom Gesamtfertigstellungsstatus der Hauptaufgabe vermitteln, ohne die Zeitplanung einzelner Unteraufgaben zu berücksichtigen.

Ich habe einige Zeit damit verbracht, die Positionierung der Beschriftungen zu verbessern, die den Fortschritt einzelner Unteraufgaben anzeigen, allerdings ohne großen Erfolg.

Vorschläge zur Platzierung der Fortschrittsbeschriftungen unterhalb oder oberhalb der Mitte desgesamteTeilaufgaben (nicht an der Grenze zwischen abgeschlossen und unabgeschlossen) sind willkommen.

\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}

Die Ausgabe sieht wie folgt aus:

Bildbeschreibung hier eingeben

Antwort1

Wenn Sie hinzufügen bar progress label node/.append style={anchor=north,yshift=0.2em},, erhalten Sie

\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}

Bildbeschreibung hier eingeben

verwandte Informationen