diff options
author | Xu Yuan <xu@informatik.hu-berlin.de> | 2011-10-01 15:43:25 +0200 |
---|---|---|
committer | Xu Yuan <xu@informatik.hu-berlin.de> | 2011-10-01 15:43:25 +0200 |
commit | ad44525af2f92d795a8cf0805f521145878fa203 (patch) | |
tree | a105d0baedd2f4e275a8fc4b6a4da1644434de93 | |
parent | 1f28e4dc5f1f6d8e61fea4f10ea3d2451138c408 (diff) | |
download | pgf-pie-ad44525af2f92d795a8cf0805f521145878fa203.tar.gz pgf-pie-ad44525af2f92d795a8cf0805f521145878fa203.tar.bz2 pgf-pie-ad44525af2f92d795a8cf0805f521145878fa203.zip |
shadow, pin text
-rw-r--r-- | dev/demo/shadow.tex | 4 | ||||
-rw-r--r-- | dev/demo/text.tex | 3 | ||||
-rw-r--r-- | dev/pgf-pie-manual.tex | 12 | ||||
-rw-r--r-- | dev/pgf-pie.sty | 10 |
4 files changed, 26 insertions, 3 deletions
diff --git a/dev/demo/shadow.tex b/dev/demo/shadow.tex new file mode 100644 index 0000000..9ccfd9f --- /dev/null +++ b/dev/demo/shadow.tex @@ -0,0 +1,4 @@ +% \usetikzlibrary{shadows} +\begin{tikzpicture} + \pie[style=drop shadow]{10/A, 20/B, 30/C, 40/D} +\end{tikzpicture} diff --git a/dev/demo/text.tex b/dev/demo/text.tex new file mode 100644 index 0000000..95ef108 --- /dev/null +++ b/dev/demo/text.tex @@ -0,0 +1,3 @@ +\begin{tikzpicture} + \pie[text=pin]{10/A, 20/B, 30/C, 40/D} +\end{tikzpicture}
\ No newline at end of file diff --git a/dev/pgf-pie-manual.tex b/dev/pgf-pie-manual.tex index 545b4d2..f591461 100644 --- a/dev/pgf-pie-manual.tex +++ b/dev/pgf-pie-manual.tex @@ -99,15 +99,23 @@ center of chart can be set by \texttt{pos}, default is \texttt{\{0,0\}}. \subsection{Explode} \demo{explode} -\subsection{Label} +\subsection{Text Label} +\subsubsection{Text inside pie} \demo[0.6]{before-after-number} +\subsubsection{Text outside pie} +The value of \texttt{text} can be \texttt{label}(default) or +\texttt{pin}. + +\demo[0.6]{text} + \subsection{Color} \demo{color} \subsection{Style} -\demo[0.6]{style} +\subsubsection{shadow} +\demo[0.6]{shadow} \section{Examples} diff --git a/dev/pgf-pie.sty b/dev/pgf-pie.sty index ffbee97..5021851 100644 --- a/dev/pgf-pie.sty +++ b/dev/pgf-pie.sty @@ -27,11 +27,15 @@ chart by using PGF/Tikz package.] \let\midangle\pgfmathresult \path (#8) -- ++(\midangle:#5) coordinate(O); + + \pgfmathparse{#7+#5} + \let\radius\pgfmathresult + % slice \draw[fill=#6, #9] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle; % outer label - \path (O) -- ++ (\midangle:#7) node[label=\midangle:#4]{}; + \path (O) -- ++ (\midangle:\radius) node[inner sep=0, \text=\midangle:#4]{}; % inner label \pgfmathparse{min((#2-#1-10)/110*(-0.3),0)} @@ -67,6 +71,9 @@ chart by using PGF/Tikz package.] \def\setafternumber#1\pgfeov{\def\afternumber{#1}} \pgfkeyslet{/after number/.@cmd}{\setafternumber} +\def\settext#1\pgfeov{\xdef\text{#1}} +\pgfkeyslet{/text/.@cmd}{\settext} + \newcommand{\pie}[2][] { \pgfkeys{ @@ -77,6 +84,7 @@ chart by using PGF/Tikz package.] style={thick}, before number=, after number=\%, + text=label, } \pgfkeys{#1} |