I've looked at the documentation, search on the forum, etcetera... and found no answer to my question.

I'm writing a Gantt chart,

      x unit=.4cm,
      y unit title=0.5cm,
      y unit chart=0.6cm,
      vgrid={*2{draw=none}, *1{dotted}},
      time slot format=isodate-yearmonth,
      compress calendar,
      title/.append style={draw=none, fill=blue!50!black},
      title label font=\sffamily\bfseries\color{white},
      title label node/.append style={below=-1.6ex},
      title left shift=.05,
      title right shift=-.05,
      title height=1,
      bar/.append style={draw=none, rounded corners=2pt, fill=OliveGreen!75},
      bar height=.6,
      bar label font=\normalsize\color{black!70},
      group label node/.append style={%
        text width=\widthof{L\'imites impuestos por mediciones de presici\'on},
      group right shift=0,
      group top shift=.6,
      group height=.3,
      group peaks height=.2,
      bar incomplete/.append style={fill=Maroon},
      %% Other customisation
      newline shortcut=true,
      bar label node/.append style={align=left},
    \gantttitlecalendar{year} \\
    \ganttgroup{Primer Periodo}{2014-10}{2015-09} \\
      bar progress label node/.append style={right=1ex},
    ]{Construcci\'on de modelos de part\'iculas
    }{2014-10}{2015-01} \\
    \ganttset{progress label text={}, link/.style={black, -to}}
    ]{L\'imites impuestos por mediciones del LHC}{2015-03}{2015-05} \\
    ]{L\'imites impuestos por mediciones de presici\'on}{2015-06}{2015-08}\\
    ]{Predicciones y L\'imites Experimentales}{2015-8} \\
    \ganttgroup{Segundo Periodo}{2015-10}{2016-09} \\
    \ganttbar[progress=0,name=Mez]{Mezcla}{2015-9}{2016-01} \\
    ]{An\'alisis de anomal\'ias en los modelos}{2016-3}{2016-06} \\

resulting on the chart

enter image description here

However, I'd like to use a "canvas" color for highlight the vacations... something like this

enter image description here

Does anyone know how to achieve this? or at least say whether it is possible... Thank you!



I have achieved something like this in the past. It's a little bit dirty (I had to enter the widths manually, and add a -11pt length to extend the shading to the bottom of the current line), but it was good enough for my needs.

Also, you may need to use \begin{scope}[on background layer]. That's what I used in my original document.


% top nodes
\ganttbar[name=holiday-2015-top,bar/.style={fill=none, draw=none}]{}{1}{1}
\ganttbar[name=holiday-2016-top,bar/.style={fill=none, draw=none}]{}{5}{5}
\ganttbar[name=holiday-2017-top,bar/.style={fill=none, draw=none}]{}{9}{9} \\

% gantt chart contents
\ganttgroup{Group 1}{1}{7} \\
\ganttbar{Task 1}{1}{2} \\
\ganttlinkedbar{Task 2}{3}{7} \ganttnewline
\ganttmilestone{Milestone}{7} \ganttnewline
\ganttbar{Final Task}{8}{12}

% bottom nodes
\ganttbar[name=holiday-2015-bottom,bar/.style={fill=none, draw=none}]{}{1}{1}
\ganttbar[name=holiday-2016-bottom,bar/.style={fill=none, draw=none}]{}{5}{5}
\ganttbar[name=holiday-2017-bottom,bar/.style={fill=none, draw=none}]{}{9}{9}

% shading
\draw [opacity=0.2,line width=12] (holiday-2015-top) -- ($(holiday-2015-bottom)+(0,-11pt)$);
\draw [opacity=0.2,line width=12] (holiday-2016-top) -- ($(holiday-2016-bottom)+(0,-11pt)$);
\draw [opacity=0.2,line width=12] (holiday-2017-top) -- ($(holiday-2017-bottom)+(0,-11pt)$);


enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.