summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-12 23:05:40 +0000
committerKarl Berry <karl@freefriends.org>2011-10-12 23:05:40 +0000
commit09e27593abfce1a48d0883cfa4a972d7a83e1f29 (patch)
treeec57209d48faa25d1190040af32d51fd50ed49ea /Master/texmf-dist/tex
parentb151324ce8df6fb72fde191a90ba892eba91254a (diff)
pgfgantt 2.0 (12oct11)
git-svn-id: svn://tug.org/texlive/trunk@24273 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/pgfgantt/pgfgantt.sty584
1 files changed, 366 insertions, 218 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfgantt/pgfgantt.sty b/Master/texmf-dist/tex/latex/pgfgantt/pgfgantt.sty
index 4f6666fa2e0..d2437ec3df3 100644
--- a/Master/texmf-dist/tex/latex/pgfgantt/pgfgantt.sty
+++ b/Master/texmf-dist/tex/latex/pgfgantt/pgfgantt.sty
@@ -16,19 +16,20 @@
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
-\ProvidesPackage{pgfgantt}[2011/04/18 v1.1 Draw Gantt diagrams with TikZ]
+\ProvidesPackage{pgfgantt}[2011/10/10 v2.0 Draw Gantt diagrams with TikZ]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-
\RequirePackage{tikz}
\usetikzlibrary{arrows,backgrounds,calc,patterns,positioning}
\newcounter{gtt@width}
\newcounter{gtt@currentline}
-\newcounter{gtt@lastline}
\newcounter{gtt@lasttitleline}
\newcounter{gtt@lasttitleslot}
-\def\gtt@lastslot{0}
+\newcounter{gtt@elementid}
+\newcounter{gtt@currgrid}
+\def\gtt@lastelement{}
+\def\gtt@currentelement{}
\newif\ifgtt@intitle
\def\ganttset#1{\pgfqkeys{/pgfgantt}{#1}}
@@ -45,13 +46,12 @@
}%
}
\def\@gtt@linkkeydef#1#2#3#4{%
- \pgfkeysdef{/pgfgantt/#2-#3}{%
+ \pgfkeysdef{/pgfgantt/link type/#1}{%
\def\gtt@link@type{#1}%
- \def\gtt@link@starttype{#2}%
- \def\gtt@link@endtype{#3}%
+ \def\gtt@link@startanchor{#3}%
+ \def\gtt@link@endanchor{#4}%
}%
- \def\@tempa{#4}%
- \ifx\@tempa\relax\else\ganttset{link label={#2-#3}{#4}}\fi%
+ \ganttset{link label={#1}{#2}}%
}
\@gtt@stylekeydef{hgrid style}
@@ -65,15 +65,14 @@
\gtt@hgridtrue%
\def\@tempb{true}%
\ifx\@tempa\@tempb%
- \pgfkeys{/pgfgantt/hgrid style={dotted}}%
+ \def\gtt@hgridstyle{dotted}%
\else%
- \pgfkeys{/pgfgantt/hgrid style={#1}}%
+ \def\gtt@hgridstyle{#1}%
\fi%
\fi%
}
\pgfkeys{/pgfgantt/hgrid/.default=dotted}
-\@gtt@stylekeydef{vgrid style}
\newif\ifgtt@vgrid
\pgfkeysdef{/pgfgantt/vgrid}{%
\def\@tempa{#1}%
@@ -84,23 +83,23 @@
\gtt@vgridtrue%
\def\@tempb{true}%
\ifx\@tempa\@tempb%
- \pgfkeys{/pgfgantt/vgrid style={dotted}}%
+ \def\gtt@vgridstyle{dotted}%
\else%
- \pgfkeys{/pgfgantt/vgrid style={#1}}%
+ \def\gtt@vgridstyle{#1}%
\fi%
\fi%
}
\pgfkeys{/pgfgantt/vgrid/.default=dotted}
-\pgfkeysdef{/pgfgantt/vgrid lines list}{%
- \def\gtt@vgridlineslist{#1}%
-}
+
+
+\@gtt@keydef{x unit}
+\@gtt@keydef{y unit title}
+\@gtt@keydef{y unit chart}
\@gtt@stylekeydef{canvas}
\@gtt@keydef{today}
\@gtt@stylekeydef{today rule}
\@gtt@keydef{today label}
-\@gtt@keydef{hgrid shift}
-\@gtt@keydef{last line height}
\@gtt@stylekeydef{title}
\@gtt@keydef{title label font}
@@ -116,7 +115,9 @@
\newif\ifgtt@includetitle
\pgfkeys{/pgfgantt/include title in canvas/.is if=gtt@includetitle}
+\@gtt@keydef{name}
\@gtt@keydef{time slot modifier}
+
\@gtt@stylekeydef{bar}
\pgfkeysdef{/pgfgantt/bar label text}{%
\def\gtt@barlabeltext##1{#1}%
@@ -187,33 +188,31 @@
\@gtt@keydef{milestone yshift}
\@gtt@stylekeydef{link}
-\@gtt@keydef{link label font}
-\@gtt@stylekeydef{link label anchor}
\pgfkeysdefnargs{/pgfgantt/link label}{2}{%
\expandafter\def\csname gtt@link@#1@labeltext\endcsname{#2}%
}
+\pgfkeys{/pgfgantt/link type/.is choice}
+\@gtt@linkkeydef{arrow}{\relax}{}{}
+\@gtt@linkkeydef{s-s}{start-to-start}{lower left}{upper left}
+\@gtt@linkkeydef{s-f}{start-to-finish}{lower left}{upper right}
+\@gtt@linkkeydef{f-s}{finish-to-start}{lower right}{upper left}
+\@gtt@linkkeydef{f-f}{finish-to-finish}{lower right}{upper right}
+
+\@gtt@keydef{link label font}
+\@gtt@stylekeydef{link label anchor}
\@gtt@keydef{link mid}
\@gtt@keydef{link bulge}
\@gtt@keydef{link tolerance}
-\@gtt@linkkeydef 0 b b \relax
-\@gtt@linkkeydef 0 b m \relax
-\@gtt@linkkeydef 0 m b \relax
-\@gtt@linkkeydef 0 m m \relax
-\@gtt@linkkeydef 1 s s {start-to-start}
-\@gtt@linkkeydef 1 s f {start-to-finish}
-\@gtt@linkkeydef 1 f s {finish-to-start}
-\@gtt@linkkeydef 1 f f {finish-to-finish}
\ganttset{
canvas={fill=white},
+ x unit=.5cm,
+ y unit title=1cm,
+ y unit chart=1cm,
hgrid style=dotted,
- vgrid style=dotted,
- vgrid lines list={2,3,...,\value{gtt@width}},
today=none,
today rule={dashed, line width=1pt},
today label=TODAY,
- hgrid shift=-.3,
- last line height=.7,
title={fill=white},
title label font=\small,
title label anchor={anchor=mid},
@@ -223,6 +222,7 @@
title height=.6,
title list options={var=\x, evaluate=\x},
include title in canvas,
+ name={},
time slot modifier=-1,
bar={fill=white},
bar label text={\strut#1},
@@ -230,7 +230,7 @@
bar label anchor={anchor=east},
bar left shift=0,
bar right shift=0,
- bar top shift=0,
+ bar top shift=.3,
bar height=.4,
group={fill=black},
group label text={\strut#1},
@@ -238,7 +238,7 @@
group label anchor={anchor=east},
group left shift=-.1,
group right shift=.1,
- group top shift=.1,
+ group top shift=.4,
group height=.2,
group peaks={.2}{.4}{.1},
progress=none,
@@ -253,22 +253,72 @@
milestone width=.8,
milestone height=.4,
milestone xshift=0,
- milestone yshift=.2,
+ milestone yshift=.5,
link={-latex, rounded corners=1pt},
- link label font=\scriptsize\itshape,
+ link type=arrow,
+ link label font=\scriptsize\itshape\normalcolor,
link label anchor={anchor=west},
- b-b,
link mid=.5,
link bulge=.4,
- link tolerance=0.6,
+ link tolerance=0.6
+}
+
+\def\gtt@vgrid@do#1,{%
+ \ifx\relax#1\else%
+ \ifnum\value{gtt@currgrid}>\value{gtt@width}\else%
+ \gtt@vgrid@analyze#1\relax%
+ \expandafter\expandafter\expandafter\gtt@vgrid@do%
+ \expandafter\fi%
+ \fi%
+}
+
+\def\gtt@vgrid@analyze{%
+ \@ifstar{\gtt@vgrid@draw}{\gtt@vgrid@draw1}%
+}
+
+\def\gtt@vgrid@draw#1#2\relax{%
+ \foreach \i in {1,...,#1} {%
+ \draw[#2] (\value{gtt@currgrid} * \@gtt@get{x unit}, \y@upper pt) --%
+ (\value{gtt@currgrid} * \@gtt@get{x unit}, \y@lower pt);%
+ \stepcounter{gtt@currgrid}%
+ \ifnum\value{gtt@currgrid}>\value{gtt@width}\breakforeach\fi%
+ }%
+}
+
+\def\gtt@hgrid@do#1,{%
+ \ifx\relax#1\else
+ \ifnum\value{gtt@currgrid}<\value{gtt@currentline}\else%
+ \gtt@hgrid@analyze#1\relax%
+ \expandafter\expandafter\expandafter\gtt@hgrid@do%
+ \expandafter\fi%
+ \fi%
+}
+
+\def\gtt@hgrid@analyze{%
+ \@ifstar{\gtt@hgrid@draw}{\gtt@hgrid@draw1}%
+}
+
+\def\gtt@hgrid@draw#1#2\relax{%
+ \foreach \i in {1,...,#1} {%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title} +%
+ (\value{gtt@currgrid} - \value{gtt@lasttitleline})%
+ * \@gtt@get{y unit chart}%
+ }%
+ \draw[#2] (0pt, \y@upper pt) --
+ (\value{gtt@width} * \@gtt@get{x unit}, \y@upper pt);%
+ \addtocounter{gtt@currgrid}{-1}%
+ \ifnum\value{gtt@currgrid}<\value{gtt@currentline}\breakforeach\fi%
+ }%
}
\newenvironment{ganttchart}[2][]{%
\ganttset{#1}%
\setcounter{gtt@width}{#2}%
\setcounter{gtt@currentline}{0}%
- \setcounter{gtt@lastline}{0}%
\setcounter{gtt@lasttitleline}{0}%
+ \setcounter{gtt@elementid}{0}%
+ \setcounter{gtt@currgrid}{1}%
\gtt@intitletrue%
\let\\\ganttnewline%
}{%
@@ -276,37 +326,47 @@
\ifgtt@includetitle%
\def\y@upper{0}%
\else%
- \def\y@upper{\value{gtt@lasttitleline}-\@gtt@get{hgrid shift}}%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}%
+ }%
\fi%
- \def\y@lower{\value{gtt@currentline}-\@gtt@get{last line height}}%
+ \pgfmathsetmacro\y@lower{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}%
+ + (\value{gtt@currentline} - \value{gtt@lasttitleline} - 1)%
+ * \@gtt@get{y unit chart}%
+ }%
\draw[/pgfgantt/canvas@style]
- (0, \y@upper) rectangle
- (\value{gtt@width}, \y@lower);%
- \ifgtt@vgrid%
- \foreach \t [evaluate=\t using \t-1]
- in \gtt@vgridlineslist {%
- \draw[/pgfgantt/vgrid style@style]
- (\t, \value{gtt@lasttitleline}-\@gtt@get{hgrid shift}) --
- (\t, \y@lower);%
+ (0pt, \y@upper pt) rectangle
+ (\value{gtt@width} * \@gtt@get{x unit}, \y@lower pt);%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}%
+ }%
+ \ifgtt@vgrid
+ \addtocounter{gtt@width}{-1}%
+ \foreach \x in {1,...,\value{gtt@width}} {%
+ \expandafter\gtt@vgrid@do\gtt@vgridstyle,\relax,%
+ \ifnum\value{gtt@currgrid}>\value{gtt@width}\breakforeach\fi%
}%
+ \stepcounter{gtt@width}%
\fi%
\ifgtt@hgrid%
- \ifgtt@includetitle\else\addtocounter{gtt@lasttitleline}{-1}\fi%
- \foreach \t [evaluate=\t]
- in {\value{gtt@lasttitleline},...,\value{gtt@currentline}} {%
- \draw[/pgfgantt/hgrid style@style]
- (0, \t-\@gtt@get{hgrid shift}) --
- (\value{gtt@width}, \t-\@gtt@get{hgrid shift});%
+ \ifgtt@includetitle%
+ \setcounter{gtt@currgrid}{\value{gtt@lasttitleline}}%
+ \else%
+ \pgfmathsetcounter{gtt@currgrid}{\value{gtt@lasttitleline}-1}%
+ \fi%
+ \edef\hgrid@upper{\thegtt@currgrid}%
+ \foreach \t in {\hgrid@upper,...,\value{gtt@currentline}} {%
+ \expandafter\gtt@hgrid@do\gtt@hgridstyle,\relax,%
+ \ifnum\value{gtt@currgrid}<\value{gtt@currentline}\breakforeach\fi%
}%
- \ifgtt@includetitle\else\stepcounter{gtt@lasttitleline}\fi%
\fi%
\def\@tempa{none}%
\ifx\gtt@today\@tempa\else%
\draw[/pgfgantt/today rule@style]
- (\@gtt@get{today},
- \value{gtt@lasttitleline}-\@gtt@get{hgrid shift}) --
- (\@gtt@get{today}, \y@lower);%
- \node at (\@gtt@get{today}, \y@lower)
+ (\@gtt@get{today} * \@gtt@get{x unit}, \y@upper pt) --
+ (\@gtt@get{today} * \@gtt@get{x unit}, \y@lower pt);%
+ \node at (\@gtt@get{today} * \@gtt@get{x unit}, \y@lower pt)
[anchor=north] {\@gtt@get{today label}};%
\fi%
\end{scope}%
@@ -315,11 +375,18 @@
\newcommand\ganttnewline[1][]{%
\def\@tempa{#1}%
\def\@tempb{grid}%
- \ifx\@tempa\@tempb%
- \draw[/pgfgantt/hgrid style@style]
- (0, \value{gtt@currentline}-1-\@gtt@get{hgrid shift}) --
- (\value{gtt@width},
- \value{gtt@currentline}-1-\@gtt@get{hgrid shift});%
+ \ifx\@tempa\@empty\else
+ \ifx\@tempa\@tempb%
+ \def\@tempa{/pgfgantt/hgrid style@style}%
+ \fi%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}%
+ + (\value{gtt@currentline} - \value{gtt@lasttitleline} - 1)%
+ * \@gtt@get{y unit chart}%
+ }
+ \expandafter\draw\expandafter[\@tempa]
+ (0pt, \y@upper pt) --
+ (\value{gtt@width} * \@gtt@get{x unit}, \y@upper pt);%
\fi%
\addtocounter{gtt@currentline}{-1}%
\ifgtt@intitle\addtocounter{gtt@lasttitleline}{-1}\fi%
@@ -329,19 +396,29 @@
\newcommand\gantttitle[3][]{%
\begingroup%
\ganttset{#1}%
- \def\x@left{\value{gtt@lasttitleslot}+\@gtt@get{title left shift}}%
- \def\x@right{\value{gtt@lasttitleslot}+#3+\@gtt@get{title right shift}}%
- \def\y@upper{\value{gtt@currentline}-\@gtt@get{title top shift}}%
- \def\y@lower{\value{gtt@currentline}-\@gtt@get{title top shift}%
- -\@gtt@get{title height}}%
+ \pgfmathsetmacro\x@left{%
+ (\value{gtt@lasttitleslot} + \@gtt@get{title left shift})%
+ * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\x@right{%
+ (\value{gtt@lasttitleslot} + #3 + \@gtt@get{title right shift})%
+ * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\y@upper{%
+ (\value{gtt@currentline} - \@gtt@get{title top shift})%
+ * \@gtt@get{y unit title}%
+ }%
+ \pgfmathsetmacro\y@lower{%
+ (\value{gtt@currentline} - \@gtt@get{title top shift}%
+ - \@gtt@get{title height}) * \@gtt@get{y unit title}%
+ }%
\draw[/pgfgantt/title@style]
- (\x@left, \y@upper) rectangle
- (\x@right, \y@lower);%
+ (\x@left pt, \y@upper pt) rectangle
+ (\x@right pt, \y@lower pt);%
\@gtt@get{title label font}%
- \node at ($(\x@left,\y@upper)!.5!(\x@right,\y@lower)$)
+ \node at ($(\x@left pt,\y@upper pt)!.5!(\x@right pt,\y@lower pt)$)
[/pgfgantt/title label anchor@style] {#2};%
\addtocounter{gtt@lasttitleslot}{#3}%
- \setcounter{gtt@lastline}{\value{gtt@currentline}}%
\endgroup%
}
@@ -352,17 +429,62 @@
\endgroup%
}
+\pgfdeclareshape{chart element}{%
+ \savedanchor\lowerleft{%
+ \pgfpoint{\x@left pt}{\y@lower pt}%
+ }%
+ \savedanchor\leftcenter{%
+ \pgfpoint{\x@left pt}{\y@upper pt / 2 + \y@lower pt / 2}%
+ }%
+ \savedanchor\upperleft{%
+ \pgfpoint{\x@left pt}{\y@upper pt}%
+ }%
+ \savedanchor\lowerright{%
+ \pgfpoint{\x@right pt}{\y@lower pt}%
+ }%
+ \savedanchor\rightcenter{%
+ \pgfpoint{\x@right pt}{\y@upper pt / 2 + \y@lower pt / 2}%
+ }%
+ \savedanchor\upperright{%
+ \pgfpoint{\x@right pt}{\y@upper pt}%
+ }%
+ \savedanchor\centerpoint{%
+ \pgfpoint{\x@right pt / 2 + \x@left pt / 2}%
+ {\y@upper pt / 2 + \y@lower pt / 2}%
+ }%
+ \anchor{lower left}{\lowerleft}%
+ \anchor{left}{\leftcenter}%
+ \anchor{upper left}{\upperleft}%
+ \anchor{lower right}{\lowerright}%
+ \anchor{right}{\rightcenter}%
+ \anchor{upper right}{\upperright}%
+ \anchor{center}{\centerpoint}%
+}
+
\newcommand\ganttbar[4][]{%
\begingroup%
\ganttset{#1}%
- \def\x@left{#3+\@gtt@get{time slot modifier}+\@gtt@get{bar left shift}}%
- \def\x@right{#4+\@gtt@get{bar right shift}}%
- \def\y@upper{\value{gtt@currentline}-\@gtt@get{bar top shift}}%
- \def\y@lower{\value{gtt@currentline}-\@gtt@get{bar top shift}%
- -\@gtt@get{bar height}}%
+ \pgfmathsetmacro\x@left{%
+ (#3 + \@gtt@get{time slot modifier} + \@gtt@get{bar left shift})%
+ * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\x@right{%
+ (#4 + \@gtt@get{bar right shift}) * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}
+ + (\value{gtt@currentline} - \value{gtt@lasttitleline}
+ - \@gtt@get{bar top shift}) * \@gtt@get{y unit chart}%
+ }%
+ \pgfmathsetmacro\y@lower{%
+ \y@upper - \@gtt@get{bar height} * \@gtt@get{y unit chart}%
+ }%
+ \ifx\gtt@name\@empty\edef\gtt@name{elem\thegtt@elementid}\fi%
+ \node[shape=chart element] (\@gtt@get{name})
+ at ($(\x@left pt, \y@upper pt)!.5!(\x@right pt, \y@lower pt)$) {};
\def\@tempa{#2}%
\ifx\@tempa\@empty\else%
- \node at ($(0, \y@upper)!.5!(0, \y@lower)$)
+ \node at ($(0pt, \y@upper pt)!.5!(0pt, \y@lower pt)$)
[/pgfgantt/bar label anchor@style]
{\@gtt@get{bar label font}{\gtt@barlabeltext{#2}}};%
\fi%
@@ -375,7 +497,8 @@
\let\gtt@pl@draw\relax%
\else%
\def\gtt@pl@draw{%
- \node at ($(\x@right, \y@upper)!.5!(\x@right, \y@lower)$)
+ \node at ($(\x@right pt, \y@upper pt)!.5!
+ (\x@right pt, \y@lower pt)$)
[/pgfgantt/progress label anchor@style] {%
\@gtt@get{progress label font}{%
\@gtt@get{progresslabeltext}{\@gtt@get{progress}}%
@@ -385,22 +508,25 @@
\fi%
\fi%
\begin{scope}%
- \clip (\x@left,\y@upper) rectangle
- ($(\x@left, \y@lower)!\gtt@progress/100!(\x@right, \y@lower)$);%
- \draw[/pgfgantt/bar@style, draw=none] (\x@left, \y@upper)
- rectangle (\x@right, \y@lower);%
+ \clip (\x@left pt, \y@upper pt) rectangle
+ ($(\x@left pt, \y@lower pt)!\gtt@progress/100!
+ (\x@right pt, \y@lower pt)$);%
+ \draw[/pgfgantt/bar@style, draw=none] (\x@left pt, \y@upper pt)
+ rectangle (\x@right pt, \y@lower pt);%
\end{scope}%
\begin{scope}%
- \clip ($(\x@left,\y@upper)!\gtt@progress/100!(\x@right,\y@upper)$)
- rectangle (\x@right,\y@lower);%
+ \clip ($(\x@left pt, \y@upper pt)!\gtt@progress/100!
+ (\x@right pt, \y@upper pt)$)
+ rectangle (\x@right pt, \y@lower pt);%
\draw[/pgfgantt/bar incomplete@style, draw=none]
- (\x@left, \y@upper) rectangle (\x@right, \y@lower);%
+ (\x@left pt, \y@upper pt) rectangle (\x@right pt, \y@lower pt);%
\end{scope}%
\draw[/pgfgantt/bar@style, fill=none]
- (\x@left, \y@upper) rectangle (\x@right, \y@lower);%
+ (\x@left pt, \y@upper pt) rectangle (\x@right pt, \y@lower pt);%
\gtt@pl@draw%
- \gdef\gtt@lastslot{#4}%
- \setcounter{gtt@lastline}{\value{gtt@currentline}}%
+ \xdef\gtt@lastelement{\gtt@currentelement}%
+ \xdef\gtt@currentelement{\@gtt@get{name}}%
+ \stepcounter{gtt@elementid}%
\global\gtt@intitlefalse%
\endgroup%
}
@@ -408,99 +534,64 @@
\newcommand\ganttlinkedbar[4][]{%
\begingroup%
\ganttset{#1}%
- \ganttlink{\gtt@lastslot}{-\value{gtt@lastline}-1}%
- {#3}{-\value{gtt@currentline}-1}%
\ganttbar{#2}{#3}{#4}%
+ \ganttlink{\gtt@lastelement}{\gtt@currentelement}
\endgroup%
}
-\newcommand\ganttlink[5][]{%
+\newcommand\ganttlink[3][]{%
\begingroup%
\ganttset{#1}%
- \ifcase\gtt@link@type%
- \def\x@left{#2+\@gtt@get{bar right shift}}%
- \def\x@right{%
- #4+\@gtt@get{time slot modifier}+\@gtt@get{bar left shift}%
- }%
- \def\y@upper{-#3+1-\@gtt@get{bar top shift}/2-\@gtt@get{bar height}/2}%
- \def\y@lower{-#5+1-\@gtt@get{bar top shift}/2-\@gtt@get{bar height}/2}%
- \def\@tempa{m}
- \ifx\gtt@link@starttype\@tempa
- \def\x@left{%
- #2+\@gtt@get{milestone xshift}+\@gtt@get{milestone width}/2%
- }%
- \def\y@upper{-#3+1-\@gtt@get{milestone yshift}}%
- \fi
- \ifx\gtt@link@endtype\@tempa
- \def\x@right{%
- #4+\@gtt@get{milestone xshift}-\@gtt@get{milestone width}/2%
- }%
- \def\y@lower{-#5+1-\@gtt@get{milestone yshift}}%
- \fi
- \pgfmathparse{#3==#5}%
+ \pgfpointanchor{#2}{right}
+ \edef\x@left{\the\pgf@x}
+ \edef\y@upper{\the\pgf@y}
+ \pgfpointanchor{#3}{left}
+ \edef\x@right{\the\pgf@x}
+ \edef\y@lower{\the\pgf@y}
+ \def\@tempa{arrow}
+ \ifx\@tempa\gtt@link@type%
+ \pgfmathparse{abs(\y@upper - \y@lower) <= 1}
\ifcase\pgfmathresult%
\pgfmathparse{%
- (#4+\@gtt@get{time slot modifier}-#2)>=\@gtt@get{link tolerance}%
+ (\x@right - \x@left)
+ >= \@gtt@get{link tolerance} * \@gtt@get{x unit}%
}%
\ifcase\pgfmathresult%
\draw[/pgfgantt/link@style]
- (\x@left, \y@upper) --
- (\x@left+\@gtt@get{link bulge}, \y@upper) --
- ($(\x@left+\@gtt@get{link bulge},\y@upper)!%
+ (#2.right) --
+ (\x@left + \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@upper) --
+ ($(\x@left + \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@upper)!%
\@gtt@get{link mid}!%
- (\x@left+\@gtt@get{link bulge},\y@lower)$) --
- ($(\x@right-\@gtt@get{link bulge},\y@upper)!%
+ (\x@left + \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@lower)$) --
+ ($(\x@right - \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@upper)!%
\@gtt@get{link mid}!%
- (\x@right-\@gtt@get{link bulge},\y@lower)$) --
- (\x@right-\@gtt@get{link bulge}, \y@lower) --
- (\x@right, \y@lower);%
+ (\x@right - \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@lower)$) --
+ (\x@right - \@gtt@get{link bulge} * \@gtt@get{x unit},
+ \y@lower) --
+ (#3.left);%
\else%
\draw[/pgfgantt/link@style]
- (\x@left, \y@upper) --
- ($(\x@left,\y@upper)!\@gtt@get{link mid}!(\x@right,\y@upper)$) --
- ($(\x@left,\y@lower)!\@gtt@get{link mid}!(\x@right,\y@lower)$) --
- (\x@right, \y@lower);%
- \fi%
- \else%
- \pgfmathparse{(#4+\@gtt@get{time slot modifier})==#2}%
- \ifcase\pgfmathresult%
- \draw[/pgfgantt/link@style]
- (\x@left, \y@upper) -- (\x@right, \y@lower);%
- \fi%
- \fi%
- \else%
- \def\@tempa{f}%
- \ifx\gtt@link@starttype\@tempa%
- \def\x@left{#2+\@gtt@get{bar right shift}}%
- \else
- \def\@tempa{s}
- \ifx\gtt@link@starttype\@tempa
- \def\x@left{%
- #2+\@gtt@get{time slot modifier}+\@gtt@get{bar right shift}%
- }%
+ (#2.right) --
+ ($(\x@left, \y@upper)!\@gtt@get{link mid}!
+ (\x@right, \y@upper)$) --
+ ($(\x@left, \y@lower)!\@gtt@get{link mid}!
+ (\x@right, \y@lower)$) --
+ (#3.left);%
\fi%
- \fi%
- \def\@tempa{f}%
- \ifx\gtt@link@endtype\@tempa%
- \def\x@right{#4+\@gtt@get{bar left shift}}%
\else
- \def\@tempa{s}
- \ifx\gtt@link@endtype\@tempa
- \def\x@right{%
- #4+\@gtt@get{time slot modifier}+\@gtt@get{bar left shift}%
- }%
- \fi%
- \fi%
- \def\y@upper{-#3+1-\@gtt@get{bar height}}%
- \def\y@lower{-#5+1-\@gtt@get{bar top shift}}%
+ \draw[/pgfgantt/link@style] (#2.right) -- (#3.left);
+ \fi
+ \else%
\draw[/pgfgantt/link@style]
- (\x@left, \y@upper) --
- (\x@right, \y@lower);%
- \node at ($(\x@left, \y@upper)!.5!(\x@right, \y@lower)$)
- [/pgfgantt/link label anchor@style] {%
+ (#2.\gtt@link@startanchor) -- (#3.\gtt@link@endanchor)
+ node [pos=.5, /pgfgantt/link label anchor@style] {%
\@gtt@get{link label font}{%
- \csname gtt@link@\gtt@link@starttype-\gtt@link@endtype%
- @labeltext\endcsname%
+ \csname gtt@link@\gtt@link@type @labeltext\endcsname%
}%
};%
\fi%
@@ -510,16 +601,27 @@
\newcommand\ganttgroup[4][]{%
\begingroup%
\ganttset{#1}%
- \def\x@left{%
- #3+\@gtt@get{time slot modifier}+\@gtt@get{group left shift}%
+ \pgfmathsetmacro\x@left{%
+ (#3 + \@gtt@get{time slot modifier} + \@gtt@get{group left shift})%
+ * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\x@right{%
+ (#4 + \@gtt@get{group right shift}) * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\y@upper{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}
+ + (\value{gtt@currentline} - \value{gtt@lasttitleline}
+ - \@gtt@get{group top shift}) * \@gtt@get{y unit chart}%
+ }%
+ \pgfmathsetmacro\y@lower{%
+ \y@upper - \@gtt@get{group height} * \@gtt@get{y unit chart}%
}%
- \def\x@right{#4+\@gtt@get{group right shift}}%
- \def\y@upper{\value{gtt@currentline}-\@gtt@get{group top shift}}%
- \def\y@lower{\value{gtt@currentline}-\@gtt@get{group top shift}%
- -\@gtt@get{group height}}%
+ \ifx\gtt@name\@empty\edef\gtt@name{elem\thegtt@elementid}\fi%
+ \node[shape=chart element] (\@gtt@get{name})
+ at ($(\x@left pt, \y@upper pt)!.5!(\x@right pt, \y@lower pt)$) {};
\def\@tempa{#2}%
\ifx\@tempa\@empty\else%
- \node at ($(0, \y@upper)!.5!(0, \y@lower)$)
+ \node at ($(0pt, \y@upper pt)!.5!(0pt, \y@lower pt)$)
[/pgfgantt/group label anchor@style]
{\@gtt@get{group label font}{\gtt@grouplabeltext{#2}}};%
\fi%
@@ -532,7 +634,8 @@
\let\gtt@pl@draw\relax%
\else%
\def\gtt@pl@draw{%
- \node at ($(\x@right, \y@upper)!.5!(\x@right, \y@lower)$)
+ \node at ($(\x@right pt, \y@upper pt)!.5!
+ (\x@right pt, \y@lower pt)$)
[/pgfgantt/progress label anchor@style] {%
\@gtt@get{progress label font}{%
\@gtt@get{progresslabeltext}{\@gtt@get{progress}}%
@@ -542,85 +645,130 @@
\fi%
\fi%
\pgfmathsetmacro\@maxpeak{%
- \gtt@grouprightpeaky>\gtt@groupleftpeaky?%
- \gtt@grouprightpeaky:\gtt@groupleftpeaky%
+ \gtt@grouprightpeaky > \gtt@groupleftpeaky ?%
+ \gtt@grouprightpeaky * \@gtt@get{y unit chart} :%
+ \gtt@groupleftpeaky * \@gtt@get{y unit chart}%
}%
\begin{scope}%
- \clip (\x@left,\y@upper) rectangle
- ($(\x@left,\y@lower-\@maxpeak)!%
+ \clip (\x@left pt, \y@upper pt) rectangle
+ ($(\x@left pt, \y@lower pt - \@maxpeak pt)!%
\gtt@progress/100!%
- (\x@right,\y@lower-\@maxpeak)$);%
+ (\x@right pt, \y@lower pt - \@maxpeak pt)$);%
\path[/pgfgantt/group@style,draw=none]
- (\x@left, \y@upper) --
- (\x@right, \y@upper) --
- (\x@right, \y@lower) --
- (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) --
- (\x@right+\gtt@grouprightpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) --
- (\x@left, \y@lower) --
+ (\x@left pt, \y@upper pt) --
+ (\x@right pt, \y@upper pt) --
+ (\x@right pt, \y@lower pt) --
+ (\x@right pt + \gtt@grouprightpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@grouprightpeaky * \@gtt@get{y unit chart}) --
+ (\x@right pt + \gtt@grouprightpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@groupleftpeaky * \@gtt@get{y unit chart}) --
+ (\x@left pt, \y@lower pt) --
cycle;%
\end{scope}%
\begin{scope}%
- \clip ($(\x@left,\y@upper)!%
+ \clip ($(\x@left pt, \y@upper pt)!%
\gtt@progress/100!%
- (\x@right,\y@upper)$)
- rectangle (\x@right,\y@lower-\@maxpeak);
+ (\x@right pt, \y@upper pt)$)
+ rectangle (\x@right pt, \y@lower pt - \@maxpeak pt);
\path[/pgfgantt/group incomplete@style]
- (\x@left, \y@upper) --
- (\x@right, \y@upper) --
- (\x@right, \y@lower) --
- (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) --
- (\x@right+\gtt@grouprightpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) --
- (\x@left, \y@lower) --
+ (\x@left pt, \y@upper pt) --
+ (\x@right pt, \y@upper pt) --
+ (\x@right pt, \y@lower pt) --
+ (\x@right pt + \gtt@grouprightpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@grouprightpeaky * \@gtt@get{y unit chart}) --
+ (\x@right pt + \gtt@grouprightpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@groupleftpeaky * \@gtt@get{y unit chart}) --
+ (\x@left pt, \y@lower pt) --
cycle;%
\end{scope}%
\path[/pgfgantt/group@style,fill=none]
- (\x@left, \y@upper) --
- (\x@right, \y@upper) --
- (\x@right, \y@lower) --
- (\x@right+\gtt@grouprightpeakmidx, \y@lower-\gtt@grouprightpeaky) --
- (\x@right+\gtt@grouprightpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakinnerx, \y@lower) --
- (\x@left+\gtt@groupleftpeakmidx, \y@lower-\gtt@groupleftpeaky) --
- (\x@left, \y@lower) --
+ (\x@left pt, \y@upper pt) --
+ (\x@right pt, \y@upper pt) --
+ (\x@right pt, \y@lower pt) --
+ (\x@right pt + \gtt@grouprightpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@grouprightpeaky * \@gtt@get{y unit chart}) --
+ (\x@right pt + \gtt@grouprightpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakinnerx * \@gtt@get{x unit},
+ \y@lower pt) --
+ (\x@left pt + \gtt@groupleftpeakmidx * \@gtt@get{x unit},
+ \y@lower pt - \gtt@groupleftpeaky * \@gtt@get{y unit chart}) --
+ (\x@left pt, \y@lower pt) --
cycle;%
\gtt@pl@draw%
+ \xdef\gtt@lastelement{\gtt@currentelement}%
+ \xdef\gtt@currentelement{\@gtt@get{name}}%
+ \stepcounter{gtt@elementid}%
\global\gtt@intitlefalse%
\endgroup%
}
+\newcommand\ganttlinkedgroup[4][]{%
+ \begingroup%
+ \ganttset{#1}%
+ \ganttgroup{#2}{#3}{#4}%
+ \ganttlink{\gtt@lastelement}{\gtt@currentelement}
+ \endgroup%
+}
+
\newcommand\ganttmilestone[3][]{%
\begingroup%
\ganttset{#1}%
- \def\x@mid{#3+\@gtt@get{milestone xshift}}%
- \def\y@mid{\value{gtt@currentline}-\@gtt@get{milestone yshift}}%
+ \pgfmathsetmacro\x@mid{%
+ (#3 + \@gtt@get{milestone xshift}) * \@gtt@get{x unit}%
+ }%
+ \pgfmathsetmacro\x@left{%
+ \x@mid - \@gtt@get{milestone width} / 2 * \@gtt@get{x unit}%
+ }
+ \pgfmathsetmacro\x@right{%
+ \x@mid + \@gtt@get{milestone width} / 2 * \@gtt@get{x unit}%
+ }
+ \pgfmathsetmacro\y@mid{%
+ \value{gtt@lasttitleline} * \@gtt@get{y unit title}%
+ + (\value{gtt@currentline} - \value{gtt@lasttitleline}%
+ - \@gtt@get{milestone yshift}) * \@gtt@get{y unit chart}%
+ }%
+ \pgfmathsetmacro\y@upper{%
+ \y@mid + \@gtt@get{milestone height} / 2 * \@gtt@get{y unit chart}%
+ }%
+ \pgfmathsetmacro\y@lower{%
+ \y@mid - \@gtt@get{milestone height} / 2 * \@gtt@get{y unit chart}%
+ }%
+ \ifx\gtt@name\@empty\edef\gtt@name{elem\thegtt@elementid}\fi%
+ \node[shape=chart element] (\@gtt@get{name})
+ at ($(\x@left pt, \y@upper pt)!.5!(\x@right pt, \y@lower pt)$) {};
\def\@tempa{#2}%
\ifx\@tempa\@empty\else%
- \node at (0, \y@mid)
+ \node at (0pt, \y@mid pt)
[/pgfgantt/milestone label anchor@style]
{\@gtt@get{milestone label font}{\gtt@milestonelabeltext{#2}}};%
\fi%
\path[/pgfgantt/milestone@style]
- (\x@mid-\@gtt@get{milestone width}/2, \y@mid) --
- (\x@mid, \y@mid-\@gtt@get{milestone height}/2) --
- (\x@mid+\@gtt@get{milestone width}/2, \y@mid) --
- (\x@mid, \y@mid+\@gtt@get{milestone height}/2) --
+ (\x@left pt, \y@mid pt) --
+ (\x@mid pt, \y@lower pt) --
+ (\x@right pt, \y@mid pt) --
+ (\x@mid pt, \y@upper pt) --
cycle;%
- \gdef\gtt@lastslot{#3}%
- \setcounter{gtt@lastline}{\value{gtt@currentline}}%
+ \xdef\gtt@lastelement{\gtt@currentelement}%
+ \xdef\gtt@currentelement{\@gtt@get{name}}%
+ \stepcounter{gtt@elementid}%
\global\gtt@intitlefalse%
\endgroup%
}
\newcommand\ganttlinkedmilestone[3][]{%
\begingroup%
- \ganttset{b-m,#1}%
- \ganttlink{\gtt@lastslot}{-\value{gtt@lastline}-1}%
- {#3}{-\value{gtt@currentline}-1}%
+ \ganttset{#1}%
\ganttmilestone{#2}{#3}%
+ \ganttlink{\gtt@lastelement}{\gtt@currentelement}
\endgroup%
}
\endinput