TransWikia.com

How to remove the text after the calculate percentage in a pgfgantt?

TeX - LaTeX Asked by Echo1870 on November 25, 2020

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}

One Answer

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} 

Correct answer by Ross on November 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP