|
- \documentclass{standalone}
- \usepackage{tikz,pgfplots}
- \usepackage{siltex}
- \usetikzlibrary{arrows.meta,positioning,calc,fadings}
- \pgfplotsset{compat=1.17}
- \begin{document}
- \begin{tikzpicture}
- \pgfmathsetlengthmacro{\xbarvalue}{-3mm}
- \pgfmathsetlengthmacro{\barwidthvalue}{4mm}
- \begin{axis}[
- xbar=\xbarvalue,
- bar width=\barwidthvalue,
- xmin=0,
- xmax=21,
- width=85mm,
- height=75mm,
- enlarge y limits=0.15,
- legend style={at={(0.98,0.95)},
- anchor=north east,legend columns=-1},
- xlabel={Days},
- symbolic y coords={Software Development,Development Cycle 2,Development Cycle 1,Test Protocol,Feature Definition,Initial Design,Specifications,Problem Description},
- ytick=data,
- ]
- \addplot[draw=red,fill=red!40] coordinates {(2,Problem Description) (3,Specifications) (3.5,Initial Design) (13,Feature Definition) (0.5,Test Protocol) (3,Development Cycle 1) (17,Development Cycle 2) (20,Software Development)};
- \addplot[draw=blue,fill=blue!40] coordinates {(2,Problem Description) (3,Specifications) (5,Initial Design) (6,Feature Definition) (1,Test Protocol) (3,Development Cycle 1) (13,Development Cycle 2)};
- \legend{Time Spend,Time Planned};
- \pgfmathsetlengthmacro{\baroffset}{\barwidthvalue+\xbarvalue/2}
- \pgfmathsetlengthmacro{\smeer}{7mm}
- \node (a) at ($(axis cs:3,Development Cycle 1)-(0.1mm,0mm)+(0mm,\baroffset)$) {};
- \node (b) at ($(axis cs:3,Development Cycle 1)-(0.1mm,0mm)-(0mm,\baroffset)$) {};
- \fill[white] (a) rectangle ++(\smeer,-\barwidthvalue-1mm);
- \fill[red!40,path fading=east] (b) rectangle ++(\smeer,1mm);
- \fill[blue!40,path fading=east] (a) rectangle ++(\smeer,-\barwidthvalue);
- \draw[white] ($(a)$) -- +(\smeer,0mm) ++(0mm,-\barwidthvalue) -- +(\smeer,0mm);
- \draw[white] ($(b)$) -- +(\smeer,0mm);
- \draw[blue,path fading=east] ($(a)$) -- +(\smeer,0mm) ++(0mm,-\barwidthvalue) -- +(\smeer,0mm);
- \draw[red,path fading=east] ($(b)$) -- +(\smeer,0mm);
- \end{axis}
- \end{tikzpicture}
- \end{document}
|