From 29ef80d3c855001d3deca15a21d4f6a49afb34b4 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 15 Jun 2022 20:10:05 +0000
Subject: pgf-pie (15jun22)

git-svn-id: svn://tug.org/texlive/trunk@63603 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/pgf-pie/tikzlibrarypie.code.tex      | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex')

diff --git a/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex b/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex
index 6612fceb139..8b2963dd7aa 100644
--- a/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex
+++ b/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex
@@ -73,7 +73,12 @@
   % slice
   \draw[line join=round,fill={#6},\pgfpie@style] (pgfpie@O) -- ++({#1}:{#7}) arc ({#1}:{#2}:{#7}) -- cycle;
 
-  \pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)}
+  \pgfpie@ifchangedirection{%
+    \pgfmathparse{min(((#1)-(#2)-10)/110*(-0.3),0)}
+  }{%
+    \pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)}
+  }%
+  
   \pgfmathparse{(max(\pgfmathresult,-0.5) + 0.8)*(#7)}
   \let\pgfpie@innerpos\pgfmathresult
 
@@ -182,6 +187,9 @@
 
 \pgfpie@newif{legend}
 
+\pgfpie@newif{changedirection}
+\pgfqkeys{/pgfpie}{change direction/.is if=pgfpie@changedirection}
+
 \pgfpie@newif{square}
 \pgfqkeys{/pgfpie}{square/.is if=pgfpie@square}
 
@@ -233,13 +241,14 @@
     text=label,
     sum=100,
     rotate=0,
+    change direction=false,
     polar=false,
     square=false,
     cloud=false,
     scale font=false,
     hide number=false,
     hide label=false,
-    every pie/.try,
+    every pie/.try,%
     % load user's parameters
     #1]
 
@@ -430,6 +439,9 @@
     \xdef\pgfpie@theradius{\pgfpie@radius}%
   }
 
+  \pgfpie@ifchangedirection{%
+    \pgfmathsetlength{\pgfpie@angleEnd}{\pgfpie@sum}
+  }{}%
   \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd}
   % drawing loop
   \foreach \pgfpie@p/\pgfpie@t [count=\pgfpie@i from 0] in {#1}
@@ -441,9 +453,13 @@
       \pgfmathparse{sqrt(\pgfpie@p) * (\pgfpie@polarRadiusUnit)}
       \xdef\pgfpie@theradius{\pgfmathresult}
     }{%
-    % normal pie
-    \pgfmathaddtolength{\pgfpie@angleEnd}{\pgfpie@p}
-    }
+      % normal pie
+      \pgfpie@ifchangedirection{%
+        \pgfmathaddtolength{\pgfpie@angleEnd}{-(\pgfpie@p)}
+      }{%
+        \pgfmathaddtolength{\pgfpie@angleEnd}{\pgfpie@p}
+      }%
+    }%
 
     % find explode
     \pgfpie@findExplode{\pgfpie@i}
-- 
cgit v1.2.3

