14

Can I have two sets of milestones in one gantt chart? Each with a different style (such as colour, shape, etc.)?

1
  • Welcome to TeX.SX! Your question seems to be too generic; could you add some code to show your intentions more clearly?
    – egreg
    Commented Mar 12, 2014 at 11:27

3 Answers 3

14

You can use the usual pgf styling mechanisms to set up different styles, here Mile1 and Mile2, that you can pass to the optional argument of \ganttmilestone:

Sample output

\documentclass{article}

\usepackage{pgfgantt}

\begin{document}
\begin{ganttchart}[Mile1/.style={milestone/.append style={fill=red}},
  Mile2/.style={milestone/.append style={fill=blue,shape=rectangle}}]{1}{12}
  \gantttitle{2011}{12} \\
  \gantttitlelist{1,...,12}{1} \\
  \ganttgroup{Group 1}{1}{7} \\
  \ganttbar{Task 1}{1}{2} \\
  \ganttlinkedbar{Task 2}{3}{7}
  \ganttnewline
  \ganttmilestone[Mile1]{Milestone}{7}
  \ganttnewline
  \ganttbar{Final Task}{8}{12}
  \ganttlink{elem2}{elem3}
  \ganttlink{elem3}{elem4}
  \ganttnewline
  \ganttmilestone[Mile2]{Milestone}{10}
  \ganttnewline
  \ganttmilestone[Mile1]{Milestone}{12}
\end{ganttchart}
\end{document}
5

Sure you can do it. You can use the starred version of \newganttchartelement. Refer to Section 2.7 Defining Custom Chart Elements of the package documentation. A little example defining a second type of milestone, which I called mymilestone with different shape, colors, fonts:

\documentclass{article}
\usepackage{pgfgantt}

\newganttchartelement*{mymilestone}{
mymilestone/.style={
  shape=isosceles triangle,
  inner sep=0pt,
  draw=cyan,
  top color=white,
  bottom color=cyan!50
  },
mymilestone incomplete/.style={
  /pgfgantt/mymilestone,
  draw=yellow,
  bottom color=yellow!50
  },
mymilestone label font=\slshape,
mymilestone left shift=0pt,
mymilestone right shift=0pt
}

\begin{document}

\begin{ganttchart}[
  milestone/.append style={fill=orange}]{1}{12}
\gantttitle{2011}{12} \\
\gantttitlelist{1,...,12}{1} \\
\ganttgroup{Group 1}{1}{7} \\
\ganttbar{Task 1}{1}{2} \\
\ganttlinkedbar{Task 2}{3}{7} \ganttnewline
\ganttmilestone{Milestone}{7} \ganttnewline
\ganttmymilestone{New milestone}{8} \ganttnewline
\ganttbar{Final Task}{9}{12}
\ganttlink{elem2}{elem3}
\ganttlink{elem3}{elem4}
\ganttlink{elem4}{elem5}
\end{ganttchart}

\end{document}

enter image description here

2
1

Using Fontawesome 5 Symbols as Milestones

\documentclass[margin=1cm]{standalone}
\usepackage{pgfgantt}
\usepackage{fontawesome5}

\newganttchartelement*{checkin}{
  checkin/.style={font={\faSignIn*}}
}

\newganttchartelement*{checkout}{
  checkout/.style={font={\faSignOut*}}
}

\begin{document}
  \begin{ganttchart}{1}{12}
    \gantttitle{2022}{12} \\
    \gantttitlelist{1,...,12}{1} \\
    \ganttgroup{Group 1}{1}{7} \\
    \ganttbar{Task 1}{1}{2} \\
    \ganttlinkedbar{Task 2}{3}{7} \ganttnewline
    \ganttcheckin{}{4}
    \ganttmilestone{Milestone}{7}
    \ganttcheckout{}{10}\ganttnewline
    \ganttbar{Final Task}{8}{12}
    \ganttlink{elem2}{elem3}
    \ganttlink{elem3}{elem6}
  \end{ganttchart}
\end{document}

enter image description here

Notes

  • The LaTeX package fontawesome5 provides symbols via a single symbol name (in the example \faIcon{sign-in-alt} or \faSignIn*). On fontawesome.com you might encounter aliases which you cannot use. For sign-in-alt exists the alias right-to-bracket. Check first the documentation of the LaTeX package to clarify which one you can use in LaTeX when you encounter errors like this:

    Package fontawesome5 Error: The requested icon right-to-bracket was not found.
    
  • Another reason can be that the symbol has been added in a later version.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .