shadow, pin text
authorXu Yuan <xu@informatik.hu-berlin.de>
Sat, 1 Oct 2011 13:43:25 +0000 (15:43 +0200)
committerXu Yuan <xu@informatik.hu-berlin.de>
Sat, 1 Oct 2011 13:43:25 +0000 (15:43 +0200)
dev/demo/shadow.tex [new file with mode: 0644]
dev/demo/text.tex [new file with mode: 0644]
dev/pgf-pie-manual.tex
dev/pgf-pie.sty

diff --git a/dev/demo/shadow.tex b/dev/demo/shadow.tex
new file mode 100644 (file)
index 0000000..9ccfd9f
--- /dev/null
@@ -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 (file)
index 0000000..95ef108
--- /dev/null
@@ -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
index 545b4d2..f591461 100644 (file)
@@ -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}
 
index ffbee97..5021851 100644 (file)
@@ -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}