4

I would like to remove the "complete" after the percentage in the progress label and keep the 60% only, without a digit.

enter image description here

Thank you for your help.

Please find bellow a MWE.

\documentclass[11pt]{report}
\usepackage{pgfgantt}
\usepackage{tikz}

\begin{document}

\begin{ganttchart}[ vgrid, hgrid, bar/.append style={fill=green}, bar incomplete/.append style={fill=red}, progress=today, today=3, group progress label node/.append style={below=3pt} ]{1}{12} \gantttitle{Title}{12} \ \ganttbar{Task 1}{1}{5} \ \end{ganttchart}

\end{document}

  • 1
    Try \ganttset{progress label text={\pgfmathprint{round(#1)}\%}} – Ross Aug 14 '20 at 11:37
  • 1
    Thank you it works very well but I have one more problem, it gives "60.0%". Is it possible to have no digit behind? Like "60%"

    Thank you for your precious help

    – Echo1870 Aug 14 '20 at 18:52

1 Answers1

4

The default setting for the progress label text key is progress label text={#1\% complete}. You can amend this to style the % completion as desired. Here we can write: progress label text={\pgfmathprintnumber[fixed, precision=1]{#1}\%}. This writes the text with just the number #1 and % sign, without complete. The number is formatted using \pgfmathprintnumber[fixed, precision=1] to give an integer.

enter image description here

\documentclass[11pt]{report}
\usepackage{pgfgantt}

\begin{document}

\begin{ganttchart}[ vgrid, hgrid, progress label text={\pgfmathprintnumber[fixed, precision=1]{#1}%}, bar/.append style={fill=green}, bar incomplete/.append style={fill=red}, progress=today, today=3, group progress label node/.append style={below=3pt} ]{1}{12} \gantttitle{Title}{12} \ \ganttbar{Task 1}{1}{5} \ \end{ganttchart}

\end{document}

Ross
  • 5,656
  • 2
  • 14
  • 38