diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-04 22:26:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-04 22:26:13 +0000 |
commit | 91807c5514100ebba5c8825abdc9d92bcf13d2ee (patch) | |
tree | 8e05a272b3fbe882cc5df673d6b03ee3b38e272b /Master | |
parent | 150981845a50d39a6af3c306ba61c88201c68460 (diff) |
pgf-pie (5may21)
git-svn-id: svn://tug.org/texlive/trunk@59075 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/COPYING | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/README | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/README.md | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/RELEASE_NOTES.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/before-after-number.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/before-after-number.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.svg (renamed from Master/texmf-dist/doc/latex/pgf-pie/cloud.svg) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/cloud.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/color.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/color.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/colorwheel.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/colorwheel.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/explode.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/explode.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.svg (renamed from Master/texmf-dist/doc/latex/pgf-pie/first-pie.svg) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/first-pie.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/hide-number.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/hide-number.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/legend.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/legend.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/polar.svg (renamed from Master/texmf-dist/doc/latex/pgf-pie/polar.svg) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/polar.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/polar.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/population.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/population.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/radius.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/radius.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/scalefont.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/scalefont.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/shadow.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/shadow.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/square.svg (renamed from Master/texmf-dist/doc/latex/pgf-pie/square.svg) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/square.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/square.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/sum.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/sum.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/text-inside.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/text-inside.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/demo/text.tex (renamed from Master/texmf-dist/doc/latex/pgf-pie/text.tex) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/description.html | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.pdf | bin | 84480 -> 181416 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.tex | 156 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgf-pie/pgf-pie.sty | 450 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex | 465 |
30 files changed, 554 insertions, 544 deletions
diff --git a/Master/texmf-dist/doc/latex/pgf-pie/COPYING b/Master/texmf-dist/doc/latex/pgf-pie/COPYING index 63e7458132e..8cdb9667946 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/COPYING +++ b/Master/texmf-dist/doc/latex/pgf-pie/COPYING @@ -7,5 +7,5 @@ alternatively under the terms of the General Public License (GPL) Version 2. The terms of each license can be found in the source repository: -Apache License: ./LICENSE-LPPL1.3c.txt -GPL2 License: ./LICENSE-GPL2.txt +LaTeX Project Public License: doc/latex/pgf-pie/LICENSE-LPPL1.3c.txt +General Public License 2: doc/latex/pgf-pie/LICENSE-GPL2.txt diff --git a/Master/texmf-dist/doc/latex/pgf-pie/README b/Master/texmf-dist/doc/latex/pgf-pie/README deleted file mode 100644 index 68492099160..00000000000 --- a/Master/texmf-dist/doc/latex/pgf-pie/README +++ /dev/null @@ -1,3 +0,0 @@ -Some LaTeX macros for pie chart by using PGF/Tikz package. -Home page of project: http://pgf-pie.googlecode.com/ -Please read pgf-pie-manual.pdf for more information. diff --git a/Master/texmf-dist/doc/latex/pgf-pie/README.md b/Master/texmf-dist/doc/latex/pgf-pie/README.md new file mode 100644 index 00000000000..a35f1b23c76 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgf-pie/README.md @@ -0,0 +1,15 @@ +# pgf-pie + +![CI](https://github.com/pgf-tikz/pgf-pie/workflows/CI/badge.svg) + +Some LaTeX macros for pie charts using the PGF/TikZ package. + +Please go to the official repository at https://github.com/pgf-tikz/pgf-pie or +the official mailing list at https://tug.org/mailman/listinfo/pgf-tikz to +submit bug reports, request new features, etc. + +Please read pgf-pie-manual.pdf for more information. + +## License + +pgf-pie is released under the terms of both the LPPL v1.3c and the GPL v2. diff --git a/Master/texmf-dist/doc/latex/pgf-pie/RELEASE_NOTES.md b/Master/texmf-dist/doc/latex/pgf-pie/RELEASE_NOTES.md new file mode 100644 index 00000000000..a70048c12f8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgf-pie/RELEASE_NOTES.md @@ -0,0 +1,4 @@ +# Bug fixes + +Loop counter variables have been renamed with the \pgfpie@ prefix to avoid +clashes with user macros. diff --git a/Master/texmf-dist/doc/latex/pgf-pie/before-after-number.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/before-after-number.tex index 0a50ebf9d9e..0a50ebf9d9e 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/before-after-number.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/before-after-number.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/cloud.svg b/Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.svg index 3fb608e5fb8..3fb608e5fb8 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/cloud.svg +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.svg diff --git a/Master/texmf-dist/doc/latex/pgf-pie/cloud.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.tex index fba25f896ce..fba25f896ce 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/cloud.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/cloud.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/color.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/color.tex index cb79b8c0efc..cb79b8c0efc 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/color.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/color.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/colorwheel.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/colorwheel.tex index 1543fbe7c8d..1543fbe7c8d 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/colorwheel.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/colorwheel.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/explode.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/explode.tex index 94c83fc70ac..94c83fc70ac 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/explode.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/explode.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/first-pie.svg b/Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.svg index 9feb8fe15c1..9feb8fe15c1 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/first-pie.svg +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.svg diff --git a/Master/texmf-dist/doc/latex/pgf-pie/first-pie.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.tex index e8c63761b40..e8c63761b40 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/first-pie.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/first-pie.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/hide-number.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/hide-number.tex index 53252173e08..53252173e08 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/hide-number.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/hide-number.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/legend.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/legend.tex index f6665f6c8ef..f6665f6c8ef 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/legend.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/legend.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/polar.svg b/Master/texmf-dist/doc/latex/pgf-pie/demo/polar.svg index a4442a04dfe..a4442a04dfe 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/polar.svg +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/polar.svg diff --git a/Master/texmf-dist/doc/latex/pgf-pie/polar.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/polar.tex index 4d868724938..4d868724938 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/polar.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/polar.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/population.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/population.tex index 9267acb3fc3..9267acb3fc3 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/population.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/population.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/radius.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/radius.tex index 944e2182192..944e2182192 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/radius.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/radius.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/scalefont.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/scalefont.tex index df61709c40a..df61709c40a 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/scalefont.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/scalefont.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/shadow.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/shadow.tex index 9ccfd9ffb58..9ccfd9ffb58 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/shadow.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/shadow.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/square.svg b/Master/texmf-dist/doc/latex/pgf-pie/demo/square.svg index 8e0a48f86a4..8e0a48f86a4 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/square.svg +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/square.svg diff --git a/Master/texmf-dist/doc/latex/pgf-pie/square.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/square.tex index dd37da64cf9..dd37da64cf9 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/square.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/square.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/sum.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/sum.tex index 13e2b7365c2..13e2b7365c2 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/sum.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/sum.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/text-inside.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/text-inside.tex index 07cf42eafd3..07cf42eafd3 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/text-inside.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/text-inside.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/text.tex b/Master/texmf-dist/doc/latex/pgf-pie/demo/text.tex index 95ef1085782..95ef1085782 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/text.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/demo/text.tex diff --git a/Master/texmf-dist/doc/latex/pgf-pie/description.html b/Master/texmf-dist/doc/latex/pgf-pie/description.html new file mode 100644 index 00000000000..820aa9bb3de --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgf-pie/description.html @@ -0,0 +1 @@ +<p>The package provides the means to draw pie (and variant) charts, using <a data-cke-saved-href="/pkg/pgf" href="/pkg/pgf">PGF/TikZ</a>.<br></p> diff --git a/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.pdf b/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.pdf Binary files differindex 961445766e1..f8485f2bf0b 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.pdf +++ b/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.pdf diff --git a/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.tex b/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.tex index f9235a2eb7f..c1e16c4e068 100644 --- a/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.tex +++ b/Master/texmf-dist/doc/latex/pgf-pie/pgf-pie-manual.tex @@ -2,30 +2,32 @@ % chart. Written by Xu Yuan <xuyuan.cn@gmail.com> This file is part of % pgf-pie you may get it at https://github.com/pgf-tikz/pgf-pie -\documentclass{article} -\usepackage[margin=12mm]{geometry} -\usepackage{hyperref} +\documentclass{ltxdoc} \usepackage{pgf-pie} \usetikzlibrary{shadows} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\usepackage{color} -\definecolor{listinggray}{gray}{0.92} -\lstset{ % -language=[LaTeX]TeX, -breaklines=true, -frame=single, -% frameround=tttt, -basicstyle=\footnotesize\ttfamily, -backgroundcolor=\color{listinggray}, -keywordstyle=\color{blue} +\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry} +\usepackage{calc} +\usepackage{graphicx} +\input{pgfmanual-en-macros.tex} + +\pgfqkeys{/codeexample}{% + scale/.store in=\pgfpieexamplescale, + scale=1, + every codeexample/.style={% + width=.4\textwidth+7pt, + pre={ + \setbox\codeexamplebox=\hbox\bgroup + }, + post={ + \egroup + \resizebox{\pgfpieexamplescale\textwidth}{!}{\box\codeexamplebox}% + }, + }, } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\hypersetup{ +\usepackage[ colorlinks=true, linkcolor=blue, anchorcolor=black, @@ -33,53 +35,23 @@ keywordstyle=\color{blue} filecolor=magenta, menucolor=red, urlcolor=blue -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand{\demo}[2][1]{ - \begin{center} - \begin{tabular}{cc} - \begin{minipage}{.49\linewidth} - \centering - \resizebox{#1\linewidth}{!}{ - \input{demo/#2} - } - \end{minipage} - & - \begin{minipage}{.45\linewidth} - \lstinputlisting{demo/#2} - \end{minipage} - \end{tabular} - \end{center} -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand{\example}[2][1]{ - \begin{center} - \resizebox{#1\linewidth}{!}{ - \input{demo/#2} - } - \end{center} - \lstinputlisting{demo/#2} -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +]{hyperref} + +\newcommand\pgfpiename{\texttt{pgf-pie}} \begin{document} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\title{Drawing Pie Chart by using \texttt{pgf-pie}} + +\title{Drawing Pie Chart by using \pgfpiename} \author{\href{mailto:xuyuan.cn@gmail.com}{Yuan Xu}} -\date{\today{}~(v0.3)} +\date{\today{}~(v0.5)} \maketitle -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{abstract} - \texttt{pgf-pie} is a LaTeX package for drawing pie chart (and + \pgfpiename\ is a LaTeX package for drawing pie chart (and variant charts). As stated by its name, it is based on a very - popular graphic package \texttt{PGF/TikZ}. This document presents - the usage of \texttt{pgf-pie} and collects some pie charts as - examples. \texttt{pgf-pie} can be downloaded from + popular graphic package \pgfname/\tikzname. This document presents + the usage of \pgfpiename\ and collects some pie charts as + examples. \pgfpiename\ can be downloaded from \href{https://github.com/pgf-tikz/pgf-pie}{https://github.com/pgf-tikz/pgf-pie}. \end{abstract} @@ -88,28 +60,28 @@ keywordstyle=\color{blue} \section{Usage} \subsection{First Pie} -\lstinline|\pie| is the only coomand that provided by -\texttt{pgf-pie}. The argument is a list of number and text -combination in the formate of \texttt{number/text}, i.e. \texttt{10/A, - 20/B, 30/C, 40/D}. The result is shown in figure \ref{fig:first-pie}. +|\pie| is the only coomand that provided by +\pgfpiename. The argument is a list of number and text +combination in the formate of |number/text|, i.e. |10/A, 20/B, 30/C, 40/D|. +The result is shown in figure \ref{fig:first-pie}. \begin{figure} \centering - \demo[0.6]{first-pie} + \codeexample[scale=0.25,from file={demo/first-pie.tex}] \caption{The first pie.} \label{fig:first-pie} \end{figure} \subsection{Position, Rotation, Size} -The center of chart can be set by \texttt{pos}, default is -\texttt{\{0,0\}}. The chart can be rotated by setting \texttt{rotate} -(in degrees). The size of chart can be set by \texttt{radius}, default +The center of chart can be set by |pos|, default is +|{0,0}|. The chart can be rotated by setting |rotate| +(in degrees). The size of chart can be set by |radius|, default is 3. -\demo{radius} +\codeexample[scale=0.4,from file={demo/radius.tex}] \subsection{Color} -The color can be specified by \texttt{color}, the default color wheel +The color can be specified by |color|, the default color wheel is shown in figure \ref{fig:color-wheel}. \begin{figure} \centering @@ -118,52 +90,52 @@ is shown in figure \ref{fig:color-wheel}. \label{fig:color-wheel} \end{figure} -\demo{color} +\codeexample[scale=0.4,from file={demo/color.tex}] \subsection{Explode} -\demo{explode} +\codeexample[scale=0.4,from file={demo/explode.tex}] \subsection{Angle of slices} -The value of \texttt{sum} indicats the sum of all data in the chart, +The value of |sum| indicats the sum of all data in the chart, it is 100 by default. It can be calculated automatically when -\texttt{auto} is set. Then the angle of slices are determined by -number value and \texttt{sum}. +|auto| is set. Then the angle of slices are determined by +number value and |sum|. -\demo{sum} +\codeexample[scale=0.4,from file={demo/sum.tex}] \subsection{Text} \subsubsection{Number} -Two parameters can be used to decorate number: \texttt{before number} -and \texttt{after number}. Both are empty by default, but if -\texttt{sum=100}, \texttt{after number} will be set to \% +Two parameters can be used to decorate number: |before number| +and |after number|. Both are empty by default, but if +|sum=100|, |after number| will be set to \% automatically if user doesn't set it. -\demo[0.6]{before-after-number} +\codeexample[scale=0.25,from file={demo/before-after-number.tex}] -The number also can be hide by \texttt{hide number}: +The number also can be hide by |hide number|: -\demo[0.6]{hide-number} +\codeexample[scale=0.25,from file={demo/hide-number.tex}] \paragraph{Scale font} The size of font in size pie can be scaled according to how big the part is automatically. -\demo[0.6]{scalefont} +\codeexample[scale=0.25,from file={demo/scalefont.tex}] \subsubsection{Label text} -The value of \texttt{text} can be \texttt{label}(default), -\texttt{pin}, \texttt{inside} or \texttt{legend}. +The value of |text| can be |label| (default), +|pin|, |inside| or |legend|. -\demo[0.6]{text} +\codeexample[scale=0.25,from file={demo/text.tex}] -\demo[0.5]{text-inside} +\codeexample[scale=0.25,from file={demo/text-inside.tex}] -\demo[0.6]{legend} +\codeexample[scale=0.25,from file={demo/legend.tex}] \subsection{More about style} \subsubsection{shadow} -\demo[0.6]{shadow} +\codeexample[scale=0.25,from file={demo/shadow.tex}] \section{Variant Charts} \subsection{Polar area diagram} @@ -171,17 +143,17 @@ The polar area diagram is similar to a usual pie chart, except sectors are equal angles and differ rather in how far each sector extends from the center of the circle. -\demo[0.6]{polar} +\codeexample[scale=0.25,from file={demo/polar.tex}] \subsection{Square} -\demo[0.6]{square} +\codeexample[scale=0.25,from file={demo/square.tex}] -Note: \texttt{explode} has no affects in sqaure chart. +Note: |explode| has no affects in sqaure chart. \subsection{Clouds} -\demo[0.6]{cloud} +\codeexample[scale=0.25,from file={demo/cloud.tex}] \section{Examples} @@ -189,7 +161,7 @@ Note: \texttt{explode} has no affects in sqaure chart. % \example{population} \section{Acknowledgements} -Many people contributed to \texttt{pgf-pie} by reporting problems, +Many people contributed to \pgfpiename\ by reporting problems, suggesting various improvements or submitting code. Here is a list of these people: \href{mailto:mohammed.alfaki@ii.uib.no}{Mohammed Alfaki}, diff --git a/Master/texmf-dist/tex/latex/pgf-pie/pgf-pie.sty b/Master/texmf-dist/tex/latex/pgf-pie/pgf-pie.sty index 0aaa3a0b54d..b717b076a1e 100644 --- a/Master/texmf-dist/tex/latex/pgf-pie/pgf-pie.sty +++ b/Master/texmf-dist/tex/latex/pgf-pie/pgf-pie.sty @@ -1,450 +1,6 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Start of pgf-pie.sty -% -% Some LaTeX macros for pie chart by using PGF/Tikz package. -% Home page of project: http://pgf-pie.googlecode.com/ -% Author: Xu Yuan <xuyuan.cn@gmail.com> -% - +% SPDX-License-Identifier: GPL-2.0-only OR LPPL-1.3c \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{pgf-pie}[2020/05/27 v0.3 Some LaTeX macros for pie +\ProvidesPackage{pgf-pie}[2021/05/03 v0.5 Some LaTeX macros for pie chart by using PGF/Tikz package.] - \RequirePackage{tikz} -\RequirePackage{ifthen} -\RequirePackage{scalefnt} - - -% args: -% #1: begin angle -% #2: end angle -% #3: number -% #4: label -% #5: explode -% #6: fill color -% #7: radius -% #8: center -\newcommand{\pgfpie@slice}[8]{ - \pgfmathparse{0.5*(#1)+0.5*(#2)} - \let\midangle\pgfmathresult - - \path (#8) -- ++(\midangle:#5) coordinate(O); - - \pgfmathparse{#7+#5} - \let\pgfpie@radius\pgfmathresult - - % slice - \draw[line join=round, fill=#6, \pgfpie@style] (O) -- ++(#1:#7) arc (#1:#2:#7) -- cycle; - - \pgfmathparse{min(((#2)-(#1)-10)/110*(-0.3),0)} - \let\temp\pgfmathresult - \pgfmathparse{(max(\temp,-0.5) + 0.8)*#7} - \let\innerpos\pgfmathresult - - \ifthenelse{\equal{\pgfpie@text}{inside}} - { - % label and number together - \path (O) -- ++(\midangle:\innerpos) node - {\scalefont{#3}\shortstack{#4\\\pgfpie@numbertext{#3}}}; - } - { - % label - \iflegend - \else - \path (O) -- ++ (\midangle:\pgfpie@radius) - node[inner sep=0, \pgfpie@text=\midangle:#4]{}; - \fi - - % number - \path (O) -- ++(\midangle:\innerpos) node - {\scalefont{#3}\pgfpie@numbertext{#3}}; - } -} - -\newcommand{\pgfpie@findColor}[1] -{ - \pgfmathparse{int(mod(#1,\value{pgfpie@colorLength}))} - \let\ci\pgfmathresult - \foreach \c [count=\j from 0] in \pgfpie@color { - \ifnum \j=\ci - \xdef\thecolor{\c} - \thecolor - \breakforeach - \fi - } -} - -\newcommand{\pgfpie@findExplode}[1] -{ - \pgfmathparse{int(mod(#1,\value{pgfpie@explodeLength}))} - \let\ei\pgfmathresult - \foreach \e [count=\j from 0] in \pgfpie@explode { - \ifnum \j=\ei - \xdef\theexplode{\e} - \breakforeach - \fi - } -} - -% #1: bottom left point -% #2: size -% #3: number -% #4: color -% #5: text -\newcommand{\pgfpie@square}[5] -{ - \ifthenelse{\equal{\pgfpie@text}{inside}} - { - \draw[fill=#4, \pgfpie@style] (#1) rectangle node - {\scalefont{#3}\shortstack{#5\\\pgfpie@numbertext{#3}}} ++(#2); - } - { - \draw[fill=#4, \pgfpie@style] (#1) rectangle node - {\scalefont{#3}\pgfpie@numbertext{#3}} ++(#2); - } -} - -% #1: pos -% #2: radius -% #3: number -% #4: color -% $5: style -% $6: label -\newcommand{\pgfpie@cloud}[6] -{ - \draw[fill=#4, #5] (#1) circle[radius=#2]; - \ifthenelse{\equal{\pgfpie@text}{inside}} - { - \node at (#1) {\scalefont{#3}\shortstack{#6\\\pgfpie@numbertext{#3}}}; - } - { - \node at (#1) {\scalefont{#3}\pgfpie@numbertext{#3}}; - } -} - -\newlength{\pgfpie@angleEnd} -\newcounter{pgfpie@explodeLength} -\newcounter{pgfpie@colorLength} -\newcounter{pgfpie@sliceLength} - -\def\setexplode#1\pgfeov{\def\pgfpie@explode{#1}} -\pgfkeyslet{/explode/.@cmd}{\setexplode} - -\def\setcolor#1\pgfeov{\def\pgfpie@color{#1}} -\pgfkeyslet{/color/.@cmd}{\setcolor} - -\def\setradius#1\pgfeov{\def\pgfpie@radius{#1}} -\pgfkeyslet{/radius/.@cmd}{\setradius} - -\def\setpos#1\pgfeov{\def\pgfpie@pos{#1}} -\pgfkeyslet{/pos/.@cmd}{\setpos} - -\def\setstyle#1\pgfeov{\def\pgfpie@style{#1}} -\pgfkeyslet{/style/.@cmd}{\setstyle} - -\def\setbeforenumber#1\pgfeov{\def\pgfpie@beforenumber{#1}} -\pgfkeyslet{/before number/.@cmd}{\setbeforenumber} - -\def\setafternumber#1\pgfeov{\def\pgfpie@afternumber{#1}} -\pgfkeyslet{/after number/.@cmd}{\setafternumber} - -\def\settext#1\pgfeov{\xdef\pgfpie@text{#1}} -\pgfkeyslet{/text/.@cmd}{\settext} - -\def\setsum#1\pgfeov{\xdef\pgfpie@sum{#1}} -\pgfkeyslet{/sum/.@cmd}{\setsum} - -\def\setrotate#1\pgfeov{\xdef\pgfpie@rotate{#1}} -\pgfkeyslet{/rotate/.@cmd}{\setrotate} - -\newif\ifpolar -\pgfkeys{/polar/.is if=polar} - -\newif\iflegend - -\newif\ifsquare -\pgfkeys{/square/.is if=square} - -\newif\ifcloud -\pgfkeys{/cloud/.is if=cloud} - -\newif\ifscalefont -\pgfkeys{/scale font/.is if=scalefont} -\let\scalefontorg\scalefont -\renewcommand{\scalefont}[1] -{ - \ifscalefont - \pgfmathparse{#1 / \pgfpie@sum * 3 + 0.9} - \scalefontorg{\pgfmathresult} - \fi -} - -\newif\ifhidenumber -\pgfkeys{/hide number/.is if=hidenumber} -\newcommand{\pgfpie@numbertext}[1] -{ - \ifhidenumber - \else - \pgfpie@beforenumber#1\pgfpie@afternumber - \fi -} - -\newcommand{\pie}[2][] -{ - % load default parameters - \pgfkeys{ - explode=0, - color={blue!60, cyan!60, yellow!60, orange!60, red!60, - blue!60!cyan!60, cyan!60!yellow!60, red!60!cyan!60, - red!60!blue!60, orange!60!cyan!60}, - radius=3, - pos={0,0}, - style={thick}, - before number=, - after number=, - text=label, - sum=100, - rotate=0, - polar=false, - square=false, - cloud=false, - scale font=false, - hide number=false - } - % load user's parameters - \pgfkeys{#1} - % add percentage automatically - \ifthenelse{\equal{\pgfpie@sum}{100}} - { - \pgfkeys{after number=\%} - \pgfkeys{#1} - }{} - - % legend or not - \ifthenelse{\equal{\pgfpie@text}{legend}} - {\legendtrue} - {\legendfalse} - - % handle sum - \ifthenelse{\equal{\pgfpie@sum}{auto}} - { - % sum all input - \xdef\pgfpie@sum{0} - \foreach \p/\t in {#2} - { - \pgfmathparse{\pgfpie@sum + \p} - \xdef\pgfpie@sum{\pgfmathresult} - } - } - {} - - % init counters - \setcounter{pgfpie@explodeLength}{0} - \foreach \e in \pgfpie@explode { \addtocounter{pgfpie@explodeLength}{1} } - - \setcounter{pgfpie@colorLength}{0} - \foreach \c in \pgfpie@color { \addtocounter{pgfpie@colorLength}{1} } - - \pgfmathsetlength{\pgfpie@angleEnd}{0} - - \setcounter{pgfpie@sliceLength}{0} - \foreach \p/\e in {#2} { \addtocounter{pgfpie@sliceLength}{1} } - - \ifsquare - %%%%%%%%%% SQUARE PIE BEGIN %%%%%%%%%%% - \pgfmathparse{\pgfpie@radius*2} - \xdef\verticalLength{\pgfmathresult} - \xdef\horizontalLength{\pgfmathresult} - \path (\pgfpie@pos) -- ++(-\pgfpie@radius, -\pgfpie@radius) coordinate (start); - \pgfmathparse{\verticalLength * \horizontalLength / \pgfpie@sum} - \let\squareUnit\pgfmathresult - - % drawing loop - \foreach \p/\t [count=\i from 0] in {#2} - { - \pgfpie@findColor{\i} - - \ifthenelse{\lengthtest{\verticalLength cm > \horizontalLength cm}} - { - \pgfmathparse{\p * \squareUnit / \horizontalLength} - \let\height\pgfmathresult - - \pgfpie@square{start}{\horizontalLength,\height} - {\p} - {\thecolor} - {\t} - %label - \iflegend - \else - \ifthenelse{\equal{\pgfpie@text}{inside}} - {} - { - \path (start) -- ++(\horizontalLength,\height*0.5) node[inner - sep=0, \pgfpie@text=0:\t]{}; - } - \fi - - \pgfmathparse{\verticalLength - \height} - \xdef\verticalLength{\pgfmathresult} - \path (start) -- ++(0, \height) coordinate (start); - } - { - \pgfmathparse{\p * \squareUnit / \verticalLength } - \let\width\pgfmathresult - - \pgfpie@square{start}{\width,\verticalLength} - {\p} - {\thecolor} - {\t} - %label - \iflegend - \else - \ifthenelse{\equal{\pgfpie@text}{inside}} - {} - { - \path (start) -- ++(\width*0.5,\verticalLength) node[inner - sep=0, \pgfpie@text=90:\t]{}; - } - \fi - - \pgfmathparse{\horizontalLength - \width} - \xdef\horizontalLength{\pgfmathresult} - \path (start) -- ++(\width, 0) coordinate (start); - } - } - - %%%%%%%%%% SQUARE PIE END %%%%%%%%%%% - \else - \ifcloud - %%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%% - % drawing loop - \foreach \p/\t [count=\i from 0] in {#2} - { - % find explode - \pgfpie@findExplode{\i} - \def\cloudGap{\theexplode + 0.1} - \pgfmathparse{sqrt(\p / \pgfpie@sum) * \pgfpie@radius} - \let\cloudR\pgfmathresult - \ifnum \i = 0 - % first cloud - \coordinate (O) at (\pgfpie@pos); - \xdef\cloudRone{\cloudR} - \xdef\cloudExtendDir{180+\pgfpie@rotate} - \else - \ifnum \i = 1 - % second cloud - \xdef\cloudRtwo{\cloudR} - \xdef\cloudExtendDir{45+\pgfpie@rotate} - \path (O) -- ++(\cloudExtendDir:\cloudRone+\cloudGap+\cloudRtwo) coordinate (O); - \else - % next cloud - \pgfmathparse{\cloudRone+\cloudGap+\cloudRtwo} - \let\la\pgfmathresult - \pgfmathparse{\cloudRone+\cloudGap+\cloudR} - \let\lb\pgfmathresult - \pgfmathparse{\cloudRtwo+\cloudGap+\cloudR} - \let\lc\pgfmathresult - \pgfmathparse{\la^2+\lc^2-\lb^2} - \let\tmp\pgfmathresult - \pgfmathparse{180 - acos(\tmp / 2 / \la / \lc)} - \let\cloudRot\pgfmathresult - \ifodd \i - \pgfmathparse{-\cloudRot} - \let\cloudRot\pgfmathresult - \fi - \pgfmathparse{\cloudExtendDir - \cloudRot} - \xdef\cloudExtendDir{\pgfmathresult} - \path (O) -- ++(\cloudExtendDir:\lc) coordinate (O); - \xdef\cloudRone{\cloudRtwo} - \xdef\cloudRtwo{\cloudR} - \fi - \fi - - % find color - \pgfpie@findColor{\i} - - \pgfpie@cloud{O}{\cloudR}{\p} - {\thecolor}{\pgfpie@style}{\t} - - % label - \iflegend - \else - \ifthenelse{\equal{\pgfpie@text}{inside}} - {} - { - \path (O) -- ++(\cloudExtendDir:\cloudR) - node[inner sep=0, \pgfpie@text=\cloudExtendDir:\t] {}; - } - \fi - } - %%%%%%%%%% CLOUD PIE BGEIN %%%%%%%%%%% - \else - %%%%%%%%%% CIRCLE PIE BGEIN %%%%%%%%%%% - \ifpolar - \xdef\maxValue{0} - \foreach \p/\e in {#2} { - \ifnum \maxValue < \p - \xdef\maxValue{\p} - \fi - } - \pgfmathparse{\pgfpie@sum / \value{pgfpie@sliceLength}} - \xdef\polarangle{\pgfmathresult} - \pgfmathparse{\pgfpie@radius / sqrt(\maxValue)} - \xdef\polarRadiusUnit{\pgfmathresult} - \else - \xdef\theradius{\pgfpie@radius} - \fi - - \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} - % drawing loop - \foreach \p/\t [count=\i from 0] in {#2} - { - \pgfmathsetlength{\pgfpie@angleEnd}{\pgfpie@angleBegin} - \ifpolar - % Polar area diagram - \pgfmathaddtolength{\pgfpie@angleEnd}{\polarangle} - \pgfmathparse{sqrt(\p) * \polarRadiusUnit} - \xdef\theradius{\pgfmathresult} - \else - % normal pie - \pgfmathaddtolength{\pgfpie@angleEnd}{\p} - \fi - - % find explode - \pgfpie@findExplode{\i} - - % find color - \pgfpie@findColor{\i} - \pgfpie@slice{\pgfpie@angleBegin/\pgfpie@sum*360+\pgfpie@rotate} - {\the\pgfpie@angleEnd/\pgfpie@sum*360+\pgfpie@rotate} - {\p} - {\t} - {\theexplode} - {\thecolor} - {\theradius} - {\pgfpie@pos} - \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} - } - %%%%%%%%%% CIRCLE PIE END %%%%%%%%%%% - \fi - \fi - - % legend - \iflegend - \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} - { - \pgfpie@findColor{\i} - \node[draw, fill=\thecolor, \pgfpie@style, below of=legendpos, label=0:\t] (legendpos) {}; - } - \end{scope} - \fi -} - -%%% End of pgf-pie.sty -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +\usetikzlibrary{pie} diff --git a/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex b/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex new file mode 100644 index 00000000000..dd949d9644d --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgf-pie/tikzlibrarypie.code.tex @@ -0,0 +1,465 @@ +% SPDX-License-Identifier: GPL-2.0-only OR LPPL-1.3c +\RequirePackage{scalefnt} + +% +% Utilities +% + +\def\pgfpie@ifx#1#2{% + \ifx#1#2% + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfpie@ifdim#1#2#3{% + \ifdim\dimexpr#1\relax#2\dimexpr#3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfpie@ifnum#1#2#3{% + \ifnum\numexpr#1\relax#2\numexpr#3\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfpie@ifodd#1{% + \ifodd\numexpr#1\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} + +\def\pgfpie@newif#1{% + \csname newif\expandafter\endcsname\csname ifpgfpie@#1\endcsname + \expandafter\def\csname pgfpie@if#1\expandafter\endcsname\expandafter{% + \csname ifpgfpie@#1\endcsname + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi}% +} + +% +% Constants for text comparison +% + +\def\pgfpie@text@inside{inside} +\def\pgfpie@text@legend{legend} +\def\pgfpie@sum@c{100} +\def\pgfpie@sum@auto{auto} + +% args: +% #1: begin angle +% #2: end angle +% #3: number +% #4: label +% #5: explode +% #6: fill color +% #7: radius +% #8: center +\def\pgfpie@slice#1#2#3#4#5#6#7#8{% + \pgfmathparse{0.5*(#1)+0.5*(#2)} + \let\pgfpie@midangle\pgfmathresult + + \path (#8) -- ++({\pgfpie@midangle}:{#5}) coordinate (pgfpie@O); + + \pgfmathparse{(#7)+(#5)} + \let\pgfpie@radius\pgfmathresult + + % 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)} + \pgfmathparse{(max(\pgfmathresult,-0.5) + 0.8)*(#7)} + \let\pgfpie@innerpos\pgfmathresult + + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{% + % label and number together + \path (pgfpie@O) -- ++({\pgfpie@midangle}:{\pgfpie@innerpos}) node[align=center] + {\pgfpie@scalefont{#3}\pgfpie@labeltext{#4}\\\pgfpie@numbertext{#3}}; + }{% + % label + \pgfpie@ifhidelabel{}{% + \pgfpie@iflegend{}{% + \path (pgfpie@O) -- ++ ({\pgfpie@midangle}:{\pgfpie@radius}) + node[inner sep=0, \pgfpie@text={\pgfpie@midangle:#4}]{}; + }% + }% + + % number + \path (pgfpie@O) -- ++({\pgfpie@midangle}:{\pgfpie@innerpos}) node + {\pgfpie@scalefont{#3}\pgfpie@numbertext{#3}}; + }% +} + +\def\pgfpie@findColor#1{% + \pgfmathparse{int(mod(#1,\the\pgfpie@colorLength))}% + \let\pgfpie@ci\pgfmathresult + \foreach \pgfpie@c [count=\pgfpie@j from 0] in \pgfpie@color {% + \pgfpie@ifnum{\pgfpie@j}{=}{\pgfpie@ci}{% + \xdef\pgfpie@thecolor{\pgfpie@c}% + \breakforeach + }{}% + } +} + +\def\pgfpie@findExplode#1{% + \pgfmathparse{int(mod(#1,\the\pgfpie@explodeLength))}% + \let\pgfpie@ei\pgfmathresult + \foreach \pgfpie@e [count=\pgfpie@j from 0] in \pgfpie@explode {% + \pgfpie@ifnum{\pgfpie@j}{=}{\pgfpie@ei}{% + \xdef\pgfpie@theexplode{\pgfpie@e}% + \breakforeach + }{}% + }% +} + +% #1: bottom left point +% #2: size +% #3: number +% #4: color +% #5: text +\def\pgfpie@square#1#2#3#4#5{% + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{% + \draw[fill={#4},\pgfpie@style] (#1) rectangle node[align=center] + {\pgfpie@scalefont{#3}\pgfpie@labeltext{#5}\\\pgfpie@numbertext{#3}} ++(#2); + }{% + \draw[fill={#4},\pgfpie@style] (#1) rectangle node + {\pgfpie@scalefont{#3}\pgfpie@numbertext{#3}} ++(#2); + }% +} + +% #1: pos +% #2: radius +% #3: number +% #4: color +% $5: style +% $6: label +\def\pgfpie@cloud#1#2#3#4#5#6{% + \draw[fill=#4, #5] (#1) circle[radius=#2]; + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{% + \node[align=center] at (#1) {\pgfpie@scalefont{#3}\pgfpie@labeltext{#6}\\\pgfpie@numbertext{#3}}; + }{% + \node at (#1) {\pgfpie@scalefont{#3}\pgfpie@numbertext{#3}}; + }% +} + +\newdimen\pgfpie@angleEnd +\newcount\pgfpie@explodeLength +\newcount\pgfpie@colorLength +\newcount\pgfpie@sliceLength + +\pgfqkeys{/pgfpie}{% + explode/.store in=\pgfpie@explode, + color/.store in=\pgfpie@color, + radius/.store in=\pgfpie@radius, + pos/.store in=\pgfpie@pos, + style/.store in=\pgfpie@style, + before number/.store in=\pgfpie@beforenumber, + after number/.store in=\pgfpie@afternumber, + text/.store in=\pgfpie@text, + sum/.store in=\pgfpie@sum, + rotate/.store in=\pgfpie@rotate, +} + +\pgfpie@newif{polar} +\pgfqkeys{/pgfpie}{polar/.is if=pgfpie@polar} + +\pgfpie@newif{legend} + +\pgfpie@newif{square} +\pgfqkeys{/pgfpie}{square/.is if=pgfpie@square} + +\pgfpie@newif{cloud} +\pgfqkeys{/pgfpie}{cloud/.is if=pgfpie@cloud} + +\pgfpie@newif{scalefont} +\pgfqkeys{/pgfpie}{scale font/.is if=pgfpie@scalefont} +\def\pgfpie@scalefont#1{% + \pgfpie@ifscalefont{% + \pgfmathparse{(#1) / (\pgfpie@sum) * 3 + 0.9}% + \scalefont{\pgfmathresult}% + }{}% +} + +\pgfpie@newif{hidenumber} +\pgfqkeys{/pgfpie}{hide number/.is if=pgfpie@hidenumber} +\def\pgfpie@numbertext#1{% + \pgfpie@ifhidenumber{}{% + \pgfpie@beforenumber#1\pgfpie@afternumber + }% +} + +\pgfpie@newif{hidelabel} +\pgfqkeys{/pgfpie}{hide label/.is if=pgfpie@hidelabel} +\def\pgfpie@labeltext#1{\pgfpie@ifhidelabel{}{#1}} + +\tikzaddtikzonlycommandshortcutlet{\pie}{\pgfpie@pie}% + +\def\pgfpie@pie{% + \pgfutil@ifnextchar[{\pgfpie@@pie}{\pgfpie@@pie[]}% +} + +\def\pgfpie@@pie[#1]#2{% + % load default parameters + \pgfqkeys{/pgfpie}{ + explode=0, + color={blue!60, cyan!60, yellow!60, orange!60, red!60, + blue!60!cyan!60, cyan!60!yellow!60, red!60!cyan!60, + red!60!blue!60, orange!60!cyan!60}, + radius=3, + pos={0,0}, + style={thick}, + before number=, + after number=, + text=label, + sum=100, + rotate=0, + polar=false, + square=false, + cloud=false, + scale font=false, + hide number=false, + hide label=false, + every pie/.try, + }% + % load user's parameters + \pgfqkeys{/pgfpie}{#1}% + % add percentage automatically + \pgfpie@ifx\pgfpie@sum\pgfpie@sum@c{% + \pgfqkeys{/pgfpie}{after number=\%}% + \pgfqkeys{/pgfpie}{#1}% + }{}% + + % legend or not + \pgfpie@ifx\pgfpie@text\pgfpie@text@legend{% + \pgfpie@legendtrue + }{% + \pgfpie@legendfalse + }% + + % handle sum + \pgfpie@ifx\pgfpie@sum\pgfpie@sum@auto{% + % sum all input + \xdef\pgfpie@sum{0}% + \foreach \pgfpie@p/\pgfpie@t in {#2} {% + \pgfmathparse{(\pgfpie@sum) + (\pgfpie@p)}% + \xdef\pgfpie@sum{\pgfmathresult}% + }% + }{}% + + % init counters + \global\pgfpie@explodeLength=0 + \foreach \pgfpie@e in \pgfpie@explode {% + \global\advance\pgfpie@explodeLength by 1 + }% + + \global\pgfpie@colorLength=0 + \foreach \pgfpie@c in \pgfpie@color {% + \global\advance\pgfpie@colorLength by 1 + }% + + \pgfmathsetlength{\pgfpie@angleEnd}{0}% + + \global\pgfpie@sliceLength=0 + \foreach \pgfpie@p/\pgfpie@e in {#2} {% + \global\advance\pgfpie@sliceLength by 1 + }% + + \pgfpie@ifsquare{% + \pgfpie@pie@square{#2}% + }{\pgfpie@ifcloud{\pgfpie@pie@cloud{#2}% + }{\pgfpie@pie@circle{#2}}} + + % legend + \pgfpie@ifhidelabel{}{% + \pgfpie@iflegend{% + \pgfpie@legend{#2}% + }{}}% +} + +\def\pgfpie@pie@square#1{% + \pgfmathparse{(\pgfpie@radius)*2} + \xdef\pgfpie@verticalLength{\pgfmathresult} + \xdef\pgfpie@horizontalLength{\pgfmathresult} + \path (\pgfpie@pos) -- ++({-\pgfpie@radius},{-\pgfpie@radius}) coordinate (pgfpie@start); + \pgfmathparse{(\pgfpie@verticalLength) * (\pgfpie@horizontalLength) / (\pgfpie@sum)} + \let\pgfpie@squareUnit\pgfmathresult + + % drawing loop + \foreach \pgfpie@p/\pgfpie@t [count=\pgfpie@i from 0] in {#1} + { + \pgfpie@findColor{\pgfpie@i} + + \pgfpie@ifdim{\pgfpie@verticalLength cm}{>}{\pgfpie@horizontalLength cm}{% + \pgfmathparse{(\pgfpie@p) * (\pgfpie@squareUnit) / (\pgfpie@horizontalLength)} + \let\pgfpie@height\pgfmathresult + + \pgfpie@square{pgfpie@start}{\pgfpie@horizontalLength,\pgfpie@height} + {\pgfpie@p} + {\pgfpie@thecolor} + {\pgfpie@t} + %label + \pgfpie@iflegend{}{% + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{}{% + \pgfpie@ifhidelabel{}{% + \path (pgfpie@start) -- ++({\pgfpie@horizontalLength},{\pgfpie@height*0.5}) + node[inner sep=0, \pgfpie@text={0:{\pgfpie@t}}]{}; + }% + }% + }% + + \pgfmathparse{\pgfpie@verticalLength - \pgfpie@height} + \xdef\pgfpie@verticalLength{\pgfmathresult} + \path (pgfpie@start) -- ++(0, \pgfpie@height) coordinate (pgfpie@start); + }{% + \pgfmathparse{(\pgfpie@p) * (\pgfpie@squareUnit) / (\pgfpie@verticalLength)}% + \let\pgfpie@width\pgfmathresult + + \pgfpie@square{pgfpie@start}{\pgfpie@width,\pgfpie@verticalLength} + {\pgfpie@p} + {\pgfpie@thecolor} + {\pgfpie@t} + %label + \pgfpie@iflegend{}{% + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{}{% + \pgfpie@ifhidelabel{}{% + \path (pgfpie@start) -- ++({\pgfpie@width*0.5},{\pgfpie@verticalLength}) + node[inner sep=0, \pgfpie@text={90:{\pgfpie@t}}]{}; + }% + }% + }% + + \pgfmathparse{(\pgfpie@horizontalLength) - (\pgfpie@width)}% + \xdef\pgfpie@horizontalLength{\pgfmathresult}% + \path (pgfpie@start) -- ++({\pgfpie@width},0) coordinate (pgfpie@start); + }% + }% +} + +\def\pgfpie@pie@cloud#1{% + % drawing loop + \foreach \pgfpie@p/\pgfpie@t [count=\pgfpie@i from 0] in {#1} + { + % find explode + \pgfpie@findExplode{\pgfpie@i} + \def\pgfpie@cloudGap{(\pgfpie@theexplode) + 0.1} + \pgfmathparse{sqrt((\pgfpie@p) / (\pgfpie@sum)) * (\pgfpie@radius)} + \let\pgfpie@cloudR\pgfmathresult + \pgfpie@ifnum{\pgfpie@i}{=}{0}{% + % first cloud + \coordinate (pgfpie@O) at (\pgfpie@pos); + \xdef\pgfpie@cloudRone{\pgfpie@cloudR} + \xdef\pgfpie@cloudExtendDir{180+(\pgfpie@rotate)} + }{\pgfpie@ifnum{\pgfpie@i}{=}{1}{% + % second cloud + \xdef\pgfpie@cloudRtwo{\pgfpie@cloudR} + \xdef\pgfpie@cloudExtendDir{45+(\pgfpie@rotate)} + \path (pgfpie@O) -- ++({\pgfpie@cloudExtendDir}:{(\pgfpie@cloudRone)+(\pgfpie@cloudGap)+(\pgfpie@cloudRtwo)}) coordinate (pgfpie@O); + }{% + % next cloud + \pgfmathparse{(\pgfpie@cloudRone)+(\pgfpie@cloudGap)+(\pgfpie@cloudRtwo)} + \let\pgfpie@la\pgfmathresult + \pgfmathparse{(\pgfpie@cloudRone)+(\pgfpie@cloudGap)+(\pgfpie@cloudR)} + \let\pgfpie@lb\pgfmathresult + \pgfmathparse{(\pgfpie@cloudRtwo)+(\pgfpie@cloudGap)+(\pgfpie@cloudR)} + \let\pgfpie@lc\pgfmathresult + \pgfmathparse{(\pgfpie@la)^2+(\pgfpie@lc)^2-(\pgfpie@lb)^2} + \let\pgfpie@tmp\pgfmathresult + \pgfmathparse{180 - acos((\pgfpie@tmp) / 2 / (\pgfpie@la) / (\pgfpie@lc))} + \let\pgfpie@cloudRot\pgfmathresult + \pgfpie@ifodd{\pgfpie@i}{% + \pgfmathparse{-(\pgfpie@cloudRot)} + \let\pgfpie@cloudRot\pgfmathresult + }{}% + \pgfmathparse{(\pgfpie@cloudExtendDir) - (\pgfpie@cloudRot)} + \xdef\pgfpie@cloudExtendDir{\pgfmathresult} + \path (pgfpie@O) -- ++({\pgfpie@cloudExtendDir}:{\pgfpie@lc}) coordinate (pgfpie@O); + \xdef\pgfpie@cloudRone{\pgfpie@cloudRtwo} + \xdef\pgfpie@cloudRtwo{\pgfpie@cloudR} + }}% + + % find color + \pgfpie@findColor{\pgfpie@i} + + \pgfpie@cloud{pgfpie@O}{\pgfpie@cloudR}{\pgfpie@p} + {\pgfpie@thecolor}{\pgfpie@style}{\pgfpie@t} + + % label + \pgfpie@iflegend{}{% + \pgfpie@ifx\pgfpie@text\pgfpie@text@inside{}{% + \pgfpie@ifhidelabel{}{% + \path (pgfpie@O) -- ++({\pgfpie@cloudExtendDir}:{\pgfpie@cloudR}) + node[inner sep=0, \pgfpie@text={\pgfpie@cloudExtendDir:{\pgfpie@t}}] {}; + }% + }% + }% + }% +} + +\def\pgfpie@pie@circle#1{% + \pgfpie@ifpolar{% + \xdef\pgfpie@maxValue{0} + \foreach \pgfpie@p/\pgfpie@e in {#1} { + \pgfmathparse{\pgfpie@p}% + \pgfpie@ifdim{\pgfpie@maxValue pt}{<}{\pgfmathresult pt}{% + \xdef\pgfpie@maxValue{\pgfpie@p} + }{}% + } + \pgfmathparse{(\pgfpie@sum) / \the\pgfpie@sliceLength} + \xdef\pgfpie@polarangle{\pgfmathresult} + \pgfmathparse{(\pgfpie@radius) / sqrt(\pgfpie@maxValue)} + \xdef\pgfpie@polarRadiusUnit{\pgfmathresult} + }{% + \xdef\pgfpie@theradius{\pgfpie@radius}% + } + + \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} + % drawing loop + \foreach \pgfpie@p/\pgfpie@t [count=\pgfpie@i from 0] in {#1} + { + \pgfmathsetlength{\pgfpie@angleEnd}{\pgfpie@angleBegin} + \pgfpie@ifpolar{% + % Polar area diagram + \pgfmathaddtolength{\pgfpie@angleEnd}{\pgfpie@polarangle} + \pgfmathparse{sqrt(\pgfpie@p) * (\pgfpie@polarRadiusUnit)} + \xdef\pgfpie@theradius{\pgfmathresult} + }{% + % normal pie + \pgfmathaddtolength{\pgfpie@angleEnd}{\pgfpie@p} + } + + % find explode + \pgfpie@findExplode{\pgfpie@i} + + % find color + \pgfpie@findColor{\pgfpie@i} + \pgfpie@slice{(\pgfpie@angleBegin)/(\pgfpie@sum)*360+(\pgfpie@rotate)} + {\the\pgfpie@angleEnd/(\pgfpie@sum)*360+(\pgfpie@rotate)} + {\pgfpie@p} + {\pgfpie@t} + {\pgfpie@theexplode} + {\pgfpie@thecolor} + {\pgfpie@theradius} + {\pgfpie@pos} + \xdef\pgfpie@angleBegin{\the\pgfpie@angleEnd} + } +} + +\def\pgfpie@legend#1{% + \coordinate[xshift=0.8cm, + yshift={(\the\pgfpie@sliceLength*0.5+1)*0.5cm}] (pgfpie@legendpos) at + (current bounding box.east); + + \scope[node distance=0.5cm] + \foreach \pgfpie@p/\pgfpie@t [count=\pgfpie@i from 0] in {#1} + { + \pgfpie@findColor{\pgfpie@i} + \node[draw, fill={\pgfpie@thecolor}, \pgfpie@style, below of={pgfpie@legendpos}, label={0:{\pgfpie@t}}] (pgfpie@legendpos) {}; + } + \endscope +} |