# How to customize Tikz Gantt chart

I am trying to find a way to obtain the following using tikz (actually using pgfgantt):

The code I have so far is:

\documentclass[tikz]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[ hgrid, group progress label node/.append style={below=3pt} ]{1}{12}
\ganttbar[]{Devices On}{3}{11} \\
\ganttbar[]{Lights On}{1}{12}\\
\gantttitle{Daily Working Time}{12}
\end{ganttchart}
\end{document}


For what I obtain:

How to obtain nearly the exact result?

-
Do you need just what you show in the image, or will the chart be expanded with more info? – Torbjørn T. Mar 19 at 20:39
@TorbjørnT. Thanks for the quick reply. Well, right now I just need it (basically) exactly the same. But I'd like a solution that allows me to expanded intuitively (you know, colors, maybe more xlabels and all that stuff). – Hans Mar 19 at 20:40

One suggestion. The colors of the bars can be changed by modifying the bar style in the optional argument to \ganttbar. For the Daily working time I suggest adding it as a label to the canvas instead of as an element in the chart, that way you don't need any additional work to remove the lines and reduce the height of the box surrounding the bars.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[
hgrid,
group progress label node/.append style={below=3pt},
canvas/.append style={label=below:Daily working time} ]{1}{12}
\ganttbar[bar/.append style={draw=orange!50,fill=orange!30}]{Devices On}{3}{11} \\
\ganttbar[bar/.append style={draw=blue!50,fill=blue!30}]{Lights On}{1}{12}
\end{ganttchart}
\end{document}


-
For the sake of curiosity, what is the border=3mm parameter in the document class declaration for? Also, isn't there a way to have a transparent color as the fill (instead of mixing white with orange)? – Hans Mar 19 at 21:01
@Hans Oh, that just adds a border at the sides of the page, try it and you'll see. Makes it easier to take a screenshot of the output (without getting any of the grey background from the PDF viewer) that I can paste directly into the image upload dialog here. – Torbjørn T. Mar 19 at 21:07
Thanks for the explanation. On the other hand, based on your explanation I posted my own answer (that I will not accept because the code is just a modification of yours) in an informative manner. Feel free to check it out. – Hans Mar 19 at 21:38

Based on the suggestion from the accepted answer, a code that reproduces almost exactly the image above is the following:

\documentclass[tikz]{standalone}
\usepackage{pgfgantt}
\definecolor{TableOrange}{RGB}{255,151,46}
\definecolor{TableBlue}{RGB}{38,125,184}
\begin{document}
\begin{ganttchart}[
hgrid,
group progress label node/.append style={below=3pt},
canvas/.append style={label=below:Daily working time} ]{1}{12}
\ganttbar[bar/.append style={line width=1pt, draw=TableOrange,fill=TableOrange,fill opacity=0.6274509804}]{Devices On}{3}{11} \\
\ganttbar[bar/.append style={line width=1pt, draw=TableBlue,fill=TableBlue,fill opacity=0.6274509804}]{Lights On}{1}{12}
\end{ganttchart}
\end{document}


-