From 8b35c22097ca10a6ce43f9e566a0da76cbdf2d71 Mon Sep 17 00:00:00 2001 From: Xu Yuan Date: Sun, 2 Oct 2011 00:18:22 +0200 Subject: better legend position --- dev/pgf-pie.sty | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dev/pgf-pie.sty b/dev/pgf-pie.sty index e26c4fb..7407f90 100644 --- a/dev/pgf-pie.sty +++ b/dev/pgf-pie.sty @@ -152,11 +152,12 @@ chart by using PGF/Tikz package.] \setcounter{pgfpie@angleEnd}{0} + \setcounter{pgfpie@sliceLength}{0} + \foreach \p/\e in {#2} { \addtocounter{pgfpie@sliceLength}{1} } + \ifpolar - \setcounter{pgfpie@sliceLength}{0} \xdef\maxValue{0} \foreach \p/\e in {#2} { - \addtocounter{pgfpie@sliceLength}{1} \ifnum \maxValue < \p \xdef\maxValue{\p} \fi @@ -208,7 +209,10 @@ chart by using PGF/Tikz package.] % legend \iflegend - \coordinate[xshift=0.8cm] (legendpos) at (current bounding box.north east); + \coordinate[xshift=0.8cm, + yshift=(\value{pgfpie@sliceLength}*0.5+1)*0.5cm] (legendpos) at + (current bounding box.east); + \begin{scope}[node distance=0.5cm] \foreach \p/\t [count=\i from 0] in {#2} { -- cgit v1.2.3