From 5f0de34b5de3bee2435ec6c1b4716711ff1f8ba0 Mon Sep 17 00:00:00 2001
From: Xu Yuan <xu@informatik.hu-berlin.de>
Date: Sun, 2 Oct 2011 15:54:01 +0200
Subject: label text inside pie

---
 dev/pgf-pie.sty | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

(limited to 'dev/pgf-pie.sty')

diff --git a/dev/pgf-pie.sty b/dev/pgf-pie.sty
index fe11dd2..1651e6f 100644
--- a/dev/pgf-pie.sty
+++ b/dev/pgf-pie.sty
@@ -35,19 +35,27 @@ chart by using PGF/Tikz package.]
   % slice
   \draw[line join=round, fill=#6, #9] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle;
 
-  % label
-  \iflegend
-  \else
-  \path (O) -- ++ (\midangle:\radius)
-  node[inner sep=0, \text=\midangle:#4]{};
-  \fi
-
-  % number
   \pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)}
   \let\temp\pgfmathresult
   \pgfmathparse{(max(\temp,-0.5) + 0.8)*#7}
   \let\innerpos\pgfmathresult
-  \path (O) -- ++(\midangle:\innerpos) node {#3};
+
+  \ifthenelse{\equal{\text}{inside}}
+  {
+    % label and number together
+    \path (O) -- ++(\midangle:\innerpos) node {\shortstack{#4 \\ #3}};
+  }
+  {
+    % label
+    \iflegend
+    \else
+    \path (O) -- ++ (\midangle:\radius)
+    node[inner sep=0, \text=\midangle:#4]{};
+    \fi
+
+    % number
+    \path (O) -- ++(\midangle:\innerpos) node {#3};
+  }
 }
 
 \newcommand{\pgfpie@findColor}[1]
-- 
cgit v1.2.3

