diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-13 20:41:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-13 20:41:53 +0000 |
commit | a2d8f2e5e9527675202437dc3b8bf0de90a3524a (patch) | |
tree | 6dacb6d7be32800e12fff7a9ba9d0fbc9f3cd323 | |
parent | 926a9f8c696e5129e8bc90b98b890595c36ffc54 (diff) |
wheelchart (13sep22)
git-svn-id: svn://tug.org/texlive/trunk@64373 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/wheelchart/README.md | 25 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf | bin | 0 -> 659237 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex | 1279 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty | 443 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/wheelchart.tlpsrc | 0 |
7 files changed, 1749 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/wheelchart/README.md b/Master/texmf-dist/doc/latex/wheelchart/README.md new file mode 100644 index 00000000000..4df731d7f63 --- /dev/null +++ b/Master/texmf-dist/doc/latex/wheelchart/README.md @@ -0,0 +1,25 @@ +# `wheelchart` + +## Draw wheelcharts with TikZ + +Version 1.0 (2022/09/11) + +This package is based on the package [TikZ](https://ctan.org/pkg/pgf) and can be used to draw wheelcharts with TikZ. It provides several options to customize the wheelcharts. + +%% README.md +%% Copyright 2022 Matthias Floré +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Matthias Floré. +% +% This work consists of the files wheelchart.pdf, wheelchart.sty, +% wheelchart.tex and README.md.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf b/Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf Binary files differnew file mode 100644 index 00000000000..2fd89c3fc86 --- /dev/null +++ b/Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf diff --git a/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex b/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex new file mode 100644 index 00000000000..23fc9a98e45 --- /dev/null +++ b/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex @@ -0,0 +1,1279 @@ +%% wheelchart.tex +%% Copyright 2022 Matthias Floré +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Matthias Floré. +% +% This work consists of the files wheelchart.pdf, wheelchart.sty, +% wheelchart.tex and README.md. +\documentclass[a4paper,english,dvipsnames]{ltxdoc} +\usepackage[english]{babel} +\usepackage{graphicx} +\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry} +\usepackage{parskip} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage{mathtools} +\usepackage{amssymb} +\usepackage{interval} +\allowdisplaybreaks +\usepackage{siunitx} +\usepackage{etoolbox} +\usepackage{listofitems} +\usepackage{wheelchart} +\usetikzlibrary{decorations.markings,patterns} +\input{pgfmanual-en-macros.tex} +\usepackage[page]{totalcount} +\usepackage{fancyhdr} +\pagestyle{fancy} +\renewcommand{\headrulewidth}{0pt} +\cfoot{\iftotalpages\begin{tikzpicture}[scale=0.15]\wheelchart[data={},gap,middle=\thepage,slices style={/utils/exec={\ifnum\thepage=\WCcount\def\WCcolor{Cyan}\else\def\WCcolor{Gray}\fi},\WCcolor},total count={\totalpages-1},value=1]{}\end{tikzpicture}\fi} +\fancyhead{} +\usepackage{etoc} +\def\WCtableofcontents{} +\etocsetstyle{section}{}{}{\xappto\WCtableofcontents{,\etocthename/\etocthenumber/\etocthepage}}{} +\etocsettocstyle{\hypersetup{hidelinks}}{} +\etocglobaldefs +\usepackage{imakeidx} +\makeindex[program=makeindex,columns=2,intoc=true] +\indexsetup{othercode={\thispagestyle{fancy}}} +%\PassOptionsToPackage{hyphens}{url} +\usepackage{xurl} +\usepackage[linktoc=all,pdfstartview=FitH,colorlinks=true,linkcolor=Mahogany,citecolor=ForestGreen,urlcolor=MidnightBlue,bookmarksnumbered=true]{hyperref} +\hypersetup{pdftitle={The wheelchart package},pdfauthor={Matthias Flor\'e},pdfsubject={Manual},pdfkeywords={wheelchart}} +\setcounter{tocdepth}{2} +\setcounter{secnumdepth}{2} +\title{The \texttt{wheelchart} package\\[12pt]\large Draw wheelcharts with \tikzname} +\author{Matthias Flor\'e} +\date{Version 1.0 (2022/09/11)}%\\[12pt] +\begin{document} +\maketitle +\thispagestyle{fancy} +\begin{abstract} +\noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw wheelcharts with \tikzname. It provides several options to customize the wheelcharts. Other tools for creating wheelcharts or pie charts can be found in \cite{MpMP}, \cite{JhcIparowcltopotPGFm}, \cite{Tumfdb}, \cite{RSVpaaMfp} and \cite{XdPCbupp}.% This is the manual for version . +\end{abstract} +\section*{\contentsname} +\tableofcontents +\patchcmd{\WCtableofcontents}{,}{}{}{} +\begin{codeexample}[] +\begin{tikzpicture} +\wheelchart[ + data={% +\pgfmathsetmacro{\WCcolornumber}{(\WCcount/\WCtotalcount)*100}% +\ifdefempty{\WCvarB}{\gdef\WChyperlink{section*.3}}{\gdef\WChyperlink{section.\WCcount}}% +\hyperlink{\WChyperlink}{% +\textbf{\textcolor{PineGreen!\WCcolornumber}{\Large\ifdefempty{\WCvarB}{}{\WCvarB{} }\WCvarA}}}\\% +\hyperlink{\WChyperlink}{\textcolor{Cyan}{page \WCvarC}}% +}, + gap, + lines, + lines style={Cyan,very thick}, + middle={\LARGE The\\[10pt]\huge\texttt{wheelchart}\\[10pt]\LARGE package}, + slices style={ + /utils/exec={\pgfmathsetmacro{\WCcolornumber}{(\WCcount/\WCtotalcount)*100}}, + PineGreen!\WCcolornumber, + draw=Cyan, + very thick + }, + value=1 +]{\WCtableofcontents} +\end{tikzpicture} +\end{codeexample} +\section{Usage} +The package |wheelchart| can be used by putting the following in the preamble. +\begin{codeexample}[code only] +\usepackage{wheelchart} +\end{codeexample} +The package |wheelchart| loads the package |tikz| and the \tikzname{} library |calc|. + +Many examples in this manual use colors which can be defined by giving |dvipsnames| as an option to |\documentclass|. +\section{The main macro} +\begin{command}{\wheelchart\opt{\oarg{options}}\marg{wheelchart data}} +This command can be placed inside a |tikzpicture| environment. It draws a wheelchart with \meta{wheelchart data}. The \meta{wheelchart data} is a comma separated list. Each item in this list corresponds to one slice of the wheelchart and consists of data separated by a |/|. The precise syntax of the \meta{wheelchart data} will be explained below. The \meta{options} can be given with the keys described in Section \ref{Keys}. +\begin{command}{\exampleforthismanual} +To simplify the creation of examples in this manual, we define the \meta{wheelchart data} below. +\begin{codeexample}[] +\gdef\exampleforthismanual{% +14/Apricot/Apricot/{A, B, C, E, K}/{north east lines}/0/0/Gray, +40/LimeGreen/Lime/{B, C}/grid/0/15/Black, +20/Melon/Melon/{A, C}//0.5/0/none, +16/OliveGreen/Olive/{A, B, E, K}/dots/0/0/none, +28/Peach/Peach/{A, B, C, E, K}/{fivepointed stars}/0/0/Lavender, +32/Plum/Plum/{A, B, C, E, K}/bricks/0/{-15}/none, +50/WildStrawberry/Strawberry/{B, C, E, K}//1/0/DarkOrchid% +} +\end{codeexample}%pattern crosshatch,checkerboard +\end{command} +The default wheelchart with these data is shown below. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\section{Additional macros} +\begin{command}{\WCcount} +This macro gives the current number of the slice in the \meta{wheelchart data}. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + inner data=\WCcount +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\begin{command}{\WCdataangle} +This macro stores the sum of the value of the key |data angle shift| (taking into account the key |counterclockwise|) and the macro |\WCmidangle| modulo $360$. +\end{command} +\begin{command}{\WCmidangle} +This macro gives the angle in degrees modulo $360$ of the middle of the current slice. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data angle shift=\WCvarG, + data style={ + rotate=\WCdataangle, + draw=Magenta, + fill=GreenYellow, + anchor=west, + text=Gray + } +]{\exampleforthismanual} +\wheelchart[ + data={}, + inner data={% + \textbackslash WCmidangle% + }, + inner data style={ + rotate=\WCmidangle, + font=\ttfamily + }, + slices style={fill=none} +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\begin{command}{\WCperc} +This macro displays |\WCpercentage| rounded up to the number of decimals determined by the key |perc precision| followed by a \unit{\percent} symbol. + +If the package |siunitx| is loaded then the following code is used. The package |siunitx| can be loaded before or after the package |wheelchart|. +\begin{codeexample}[code only] +\qty[round-mode=places, + round-precision=\pgfkeysvalueof{/wheelchart/perc precision}]{\WCpercentage}{\percent} +\end{codeexample} +If the package |siunitx| is not loaded then the following code is used. +\begin{codeexample}[code only] +\WCpercentagerounded\,\% +\end{codeexample} +\end{command} +\begin{command}{\WCpercentage} +This macro gives the percentage of the current slice where the total is computed with the values of the key |value|. Note that rounding errors can occur. +\begin{codeexample}[] +\begin{tikzpicture} +\wheelchart[ + data={\WCvarC\\\WCperc}, + slices style={ + /utils/exec=\pgfmathsetmacro{\WCcolornumber}{4*\WCpercentage}, + \WCvarB!\WCcolornumber + } +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\begin{command}{\WCpercentagerounded} +This macro displays |\WCpercentage| rounded up to the number of decimals determined by the key |perc precision|. +\end{command} +\begin{command}{\WCtotalcount} +This macro gives the total number of slices. +\end{command} +\begin{command}{\WCtotalnum} +This macro gives the sum of all values of the key |value|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={\WCvarC: \WCvarA}, + middle={% + \textbf{\huge Fruit}\\% + \WCtotalcount{} species\\% + \pgfmathprintnumber{\WCtotalnum} + pieces% + } +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\begin{command}{\WCvarA} +\end{command} +\begin{command}{\WCvarB} +\end{command} +\begin{command}{\WCvarC} +\end{command} +\begin{command}{\WCvarD} +\end{command} +\begin{command}{\WCvarE} +\end{command} +\begin{command}{\WCvarF} +\end{command} +\begin{command}{\WCvarG} +\end{command} +\begin{command}{\WCvarH} +\end{command} +\begin{command}{\WCvarI} +\end{command} +\begin{command}{\WCvarJ} +\end{command} +\begin{command}{\WCvarK} +\end{command} +\begin{command}{\WCvarL} +\end{command} +\begin{command}{\WCvarM} +\end{command} +\begin{command}{\WCvarN} +\end{command} +\begin{command}{\WCvarO} +\end{command} +\begin{command}{\WCvarP} +\end{command} +\begin{command}{\WCvarQ} +\end{command} +\begin{command}{\WCvarR} +\end{command} +\begin{command}{\WCvarS} +\end{command} +\begin{command}{\WCvarT} +\end{command} +\begin{command}{\WCvarU} +\end{command} +\begin{command}{\WCvarV} +\end{command} +\begin{command}{\WCvarW} +\end{command} +\begin{command}{\WCvarX} +\end{command} +\begin{command}{\WCvarY} +\end{command} +\begin{command}{\WCvarZ} +The \meta{wheelchart data} in the command |\wheelchart| is a comma separated list. Each item in this list corresponds to one slice of the wheelchart and consists of data separated by a |/|. These individual data are interpreted as |\WCvarA/\WCvarB/\WCvarC/...| and can be accessed within the \meta{options} of the command |\wheelchart| by the macros |\WCvarA| till |\WCvarZ| except within the keys |at|, |caption|, |caption left|, |caption left style|, |caption style|, |contour|, |counterclockwise|, |expand list|, |middle fill|, |name|, |start angle|, |start half|, |title|, |title left|, |title left style|, |title style|, |total angle| and |total count|. Thus up to 26 data can be given to each slice of the wheelchart. + +Initially, only |\WCvarA|, |\WCvarB| and |\WCvarC| are used for |value=\WCvarA|, |slices style=\WCvarB| and |data=\WCvarC|. +\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{patterns}}] +\begin{tikzpicture} +\wheelchart[ + data={}, + gap, + radius={0.5}{3}, + slices style={\WCvarB!70,draw=\WCvarH,ultra thick,pattern=\WCvarE,pattern color=\WCvarB!70}, + value=1, + wheel data=\WCvarC, + %wheel data style={shift={(\WCmidangle:0.5)}}, + %wheel data pos=0.5 +]{\exampleforthismanual} +\wheelchart[ + data={\textcolor{\WCvarB}{Vitamines}\\\WCvarD}, + gap, + radius={3.1}{4}, + slices arrow={1}{0.2}, + value=1 +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{command} +\section{Keys}\label{Keys} +The keys in this Section can be given as \meta{options} to the command |\wheelchart|. +\begin{key}{/wheelchart/anchor xsep=\marg{angle} (initially 5)} +\end{key} +\begin{key}{/wheelchart/anchor ysep=\marg{angle} (initially 5)} +These keys determine the default anchor of the key |data| in the case that |lines ext=0|. +\begin{table}[ht] +\centering +\begin{tabular}{ll} + & Anchor of the key |data|\\ +|\WCdataangle| & in the case that |lines ext=0|\\\hline +$0$ & west\\ +$90$ & south\\ +$180$ & east\\ +$270$ & north\\ +For other angles not in $\{0,90,180,270\}$: & \\ +$[0,\text{|anchor ysep|}]$ & west\\ +$\ointerval{\text{|anchor ysep|}}{90-\text{|anchor xsep|}}$ & south west\\ +$[90-\text{|anchor xsep|},90+\text{|anchor xsep|}]$ & south\\ +$\ointerval{90+\text{|anchor xsep|}}{180-\text{|anchor ysep|}}$ & south east\\ +$[180-\text{|anchor ysep|},180+\text{|anchor ysep|}]$ & east\\ +$\ointerval{180+\text{|anchor ysep|}}{270-\text{|anchor xsep|}}$ & north east\\ +$[270-\text{|anchor xsep|},270+\text{|anchor xsep|}]$ & north\\ +$\ointerval{270+\text{|anchor xsep|}}{360-\text{|anchor ysep|}}$ & north west\\ +$[360-\text{|anchor ysep|},360]$ & west\\ +\end{tabular} +\caption{Anchor of the key \texttt{data} in the case that \texttt{lines ext=0}.}\label{tableanchorofthekeydatainthecasethatlinesextequaltozero} +\end{table} +\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{patterns}}] +\begin{tikzpicture} +\wheelchart[ + inner data={$\WCvarA^{\circ}$}, + %inner data style={shift={(\WCmidangle:{-0.1})}}, + inner data sep=0.3, + lines, + radius={3}{4}, + slices style={pattern=\WCvarD,pattern color=\WCvarB!70}, +]{% + 10/Maroon/south/{north east lines}, + 70/TealBlue/{south west}/grid, + 10/Maroon/west/{north east lines}, + 10/Maroon/west/{north east lines}, + 70/TealBlue/{north west}/grid, + 10/Maroon/north/{north east lines}, + 10/Maroon/north/{north east lines}, + 70/TealBlue/{north east}/grid, + 10/Maroon/east/{north east lines}, + 10/Maroon/east/{north east lines}, + 70/TealBlue/{south east}/grid, + 10/Maroon/south/{north east lines}% +} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{patterns}}] +\begin{tikzpicture} +\wheelchart[ + anchor xsep=10, + anchor ysep=15, + inner data={$\WCvarA^{\circ}$}, + %inner data style={shift={(\WCmidangle:{-0.1})}}, + inner data sep=0.3, + lines, + radius={3}{4}, + slices style={pattern=\WCvarD,pattern color=\WCvarB!70}, +]{% + 20/Maroon/south/{north east lines}, + 40/TealBlue/{south west}/grid, + 30/Maroon/west/{north east lines}, + 30/Maroon/west/{north east lines}, + 40/TealBlue/{north west}/grid, + 20/Maroon/north/{north east lines}, + 20/Maroon/north/{north east lines}, + 40/TealBlue/{north east}/grid, + 30/Maroon/east/{north east lines}, + 30/Maroon/east/{north east lines}, + 40/TealBlue/{south east}/grid, + 20/Maroon/south/{north east lines}% +} +\end{tikzpicture} +\end{codeexample} +The anchor of the key |data| can also be specified manually by using the key |data style|. +\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{patterns}}] +\begin{tikzpicture} +\wheelchart[ + data style={anchor=\WCvarC}, + inner data={$\WCvarA^{\circ}$}, + %inner data style={shift={(\WCmidangle:{-0.1})}}, + inner data sep=0.3, + lines, + radius={3}{4}, + slices style={pattern=\WCvarD,pattern color=\WCvarB!70}, +]{% + 10/Maroon/{south west}/{north east lines}, + 70/TealBlue/west/grid, + 10/Maroon/west/{north east lines}, + 10/Maroon/{north west}/{north east lines}, + 70/TealBlue/north/grid, + 10/Maroon/north/{north east lines}, + 10/Maroon/{north east}/{north east lines}, + 70/TealBlue/east/grid, + 10/Maroon/{north east}/{north east lines}, + 10/Maroon/east/{north east lines}, + 70/TealBlue/south/grid, + 10/Maroon/south/{north east lines}% +} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/at=\marg{point} (initially (0,0))} +This key defines the center of the wheelchart. +\end{key} +\begin{key}{/wheelchart/caption=\marg{text}} +This key contains the \meta{text} which will be placed below the wheelchart. The \meta{text} is placed in a node. The $x$ coordinate of this node is the $x$ coordinate of the center of the wheelchart, which is defined by the key |at|. In general, this is \emph{not} the same as the $x$ coordinate of the center of the |local bounding box| around the wheelchart. The $y$ coordinate of this node is |0.5| below the south of the |local bounding box| around the wheelchart. The style of this node is given as follows. First, the options |anchor=north,align=center| are given. Thereafter, the style of the key |caption style| is added. +\end{key} +\begin{key}{/wheelchart/caption left=\marg{text}} +This key contains the \meta{text} which will be placed below left of the wheelchart. The \meta{text} is placed in a node. This node is placed |0.5| below the south west of the |local bounding box| around the wheelchart. The style of this node is given as follows. First, the options |anchor=north west,align=left| are given. Thereafter, the style of the key |caption left style| is added. +\end{key} +\begin{stylekey}{/wheelchart/caption left style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |caption left| is placed. +\end{stylekey} +\begin{stylekey}{/wheelchart/caption style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |caption| is placed. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + at={(5,2)}, + caption=Caption, + caption style={font=\scshape}, + caption left={Caption left}, + caption left style={font=\sffamily}, + middle={\texttt{name=WCname}}, + name=WCname, + start half, + title=Title, + title style={font=\bfseries}, + title left={Title left}, + title left style={font=\em} +]{% + 1/Goldenrod/{Text\\with\\multiple\\lines}, + 1/Mahogany/{Text which is longer than the short text}, + 1/JungleGreen/{Another text}, + 1/RoyalBlue/{Short text}% +} +\draw[dashed] (WCname.south west) rectangle (WCname.north east); +\foreach\pos in {north,east,south,west}{ + \node at (WCname.\pos) {\pos}; +} +\end{tikzpicture} +\end{codeexample} +\end{stylekey} +\begin{stylekey}{/wheelchart/contour=\marg{options} (initially \normalfont empty)} +If this key is set then a contour with the style determined by this key will be drawn around the wheelchart. +\end{stylekey} +\begin{key}{/wheelchart/counterclockwise=\opt{\meta{boolean}} (default true, initially false)} +If true, the wheelchart will be drawn counterclockwise instead of clockwise. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + counterclockwise, + middle=counterclockwise, + middle style={font=\ttfamily} +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/data=\marg{text} (initially \textbackslash WCvarC)} +This key contains the \meta{text} which will be placed at the outside of each slice of the wheelchart. This can be suppressed by using |data={}|. The \meta{text} is placed in a node. The style of this node is given as follows. First, the anchor is set following Table \ref{tableanchorofthekeydatainthecasethatlinesextequaltozero} and Table \ref{tableanchorofthekeydatainthecasethatlinesextstrictlylargerthanzero}. Then the option |align=left| is added. Thereafter, the style of the key |data style| is added. +\end{key} +\begin{key}{/wheelchart/data angle shift=\marg{angle} (initially 0)} +The contents of the key |data| is placed at the angle |\WCdataangle|, which is the sum of the value of the key |data angle shift| in degrees (taking into account the key |counterclockwise|) and the macro |\WCmidangle| modulo $360$. +\end{key} +\begin{key}{/wheelchart/data sep=\marg{value} (initially 0.2)} +If |lines=0|, this key defines the distance between the wheelchart and the contents of the key |data|. If $\text{|lines|}>0$, this key defines the distance between the end of the lines and the contents of the key |data|. +\end{key} +\begin{stylekey}{/wheelchart/data style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |data| is placed. +\end{stylekey} +\begin{key}{/wheelchart/expand list=\mchoice{false,once,true} (initially once)} +\begin{description} +\item[\texttt{false}] In this case, the \meta{wheelchart data} of the command |\wheelchart| will not be expanded. +\item[\texttt{once}] In this case, the \meta{wheelchart data} of the command |\wheelchart| will be expanded once. +\item[\texttt{true}] In this case, the \meta{wheelchart data} of the command |\wheelchart| will be fully expanded. +\end{description} +The following example illustrates the difference between the possible values of the key |expand list|. +\begin{codeexample}[width=10cm,preamble={\usepackage{listofitems}}] +\readlist*\WCcolors{ + Dandelion,CarnationPink, + SpringGreen,ProcessBlue +} +\begin{tikzpicture} +\def\WClistA{a,A} +\def\WClistB{b,B} +\def\WCdata{\WClistA,\WClistB} +\foreach\expandlist [count=\n] in + {false,once,true}{ +\wheelchart[ + at={({3.5*\n},0)}, + data=\WCvarA, + expand list=\expandlist, + radius={0}{1}, + slices style={\WCcolors[\WCcount]}, + title={expand list=\\\expandlist}, + title style={font=\ttfamily}, + value=1 +]{\WCdata} +} +\end{tikzpicture} +\end{codeexample} +The initial setting |expand list=once| works in most situations, even when commands such as |\ref|, |\cite| and |\textbf| are used such as in the example below. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + %expand list=false,%false also works + %expand list=true,%true doesn't work + middle={expand list=\\false % + {\normalfont or} once}, + middle style={font=\ttfamily} +]{% + 1/Emerald/{Section \ref{Keys}}, + 1/Sepia/{Reference \cite{TtTaPGFp}}, + 1/YellowOrange/{$e^{i\pi}=-1$}, + 1/Salmon/{\textbf{Text}}% +} +\end{tikzpicture} +\end{codeexample} +In the following example, the \meta{wheelchart data} from the previous example is stored in a macro. In this case, we have to use the initial setting |expand list=once|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\def\WClist{% + 1/Emerald/{Section \ref{Keys}}, + 1/Sepia/{Reference \cite{TtTaPGFp}}, + 1/YellowOrange/{$e^{i\pi}=-1$}, + 1/Salmon/{\textbf{Text}}% +} +\wheelchart[ + %expand list=false, + %expand list=true, + %false and true do not work + middle={expand list=\\once}, + middle style={font=\ttfamily} +]{\WClist} +\end{tikzpicture} +\end{codeexample} +In the example below, we have to use |expand list=true|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\def\WCcolorsA{Yellow,Red} +\def\WCcolorsB{Green,Blue} +\wheelchart[ + data={}, + expand list=true,%false and once + %do not work + middle={expand list=true}, + middle style={font=\large\ttfamily}, + slices style={\WCvarA}, + value=1 +]{\WCcolorsA,\WCcolorsB} +\end{tikzpicture} +\end{codeexample} +In the example below, we have to use |expand list=true| and the command |\expandonce| from the package |etoolbox|. +\begin{codeexample}[width=10cm,preamble={\usepackage{etoolbox}}] +\begin{tikzpicture} +\def\WCsliceA{1/Brown/{\emph{A}: $\mu$}} +\def\WCsliceAfinal{\expandonce\WCsliceA} +\def\WCsliceB{2/Tan/{\textbf{B}: $\pi$}} +\def\WCsliceBfinal{\expandonce\WCsliceB} +\wheelchart[ + expand list=true,%false and once + %do not work + middle={expand list=true}, + middle style={font=\large\ttfamily}, +]{\WCsliceAfinal,\WCsliceBfinal} +%\WCsliceA and \WCsliceB do not work +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/explode=\marg{value} (default 0.2, initially 0)} +This key will shift the slices of the wheelchart with \meta{value} with respect to the center of the wheelchart. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + explode=\WCvarF, + pie +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/gap=\marg{value} (default 0.05, initially 0)} +The \meta{value} of this key defines half the distance between two slices of the wheelchart. + +The following example illustrates the behaviour of the key |gap| when a slice has $360$ degrees. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\foreach\gap [count=\m] in {0,1}{ +\foreach\pie [count=\n] in {false,true}{ +\wheelchart[ + at={({5*\m},{-5*\n})}, + data={}, + gap=\gap, + middle={gap=\gap\\pie=\pie}, + middle style={font=\ttfamily}, + pie=\pie, + radius={1.5}{2}, + slices style=Bittersweet, + total count=1, + value=1 +]{} +} +} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/gap polar=\marg{value} (default 1, initially 0)} +The \meta{value} of this key defines half the polar gap in degrees between two slices of the wheelchart. + +Note the difference between the keys |explode|, |gap| and |gap polar|. This is illustrated in the examples below. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + explode=1, + middle={\Large\texttt{explode}}, + radius={1}{2}, + slices style={ + draw=Red, + fill=none, + ultra thick + }, + total count=6, + value=1 +]{} +\draw (0,0) circle[radius=2]; +\draw (0,0) circle[radius=3]; +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + gap=0.5, + middle={\Large\texttt{gap}}, + slices style={ + draw=Red, + fill=none, + ultra thick + }, + total count=6, + value=1 +]{} +\draw (0,0) circle[radius=2]; +\draw (0,0) circle[radius=3]; +\foreach\a in {0,60,120}{ +\foreach\x in {-0.5,0.5}{ +\draw[rotate=\a] (\x,{sqrt(3^2-0.5^2})-- + (\x,{-sqrt(3^2-0.5^2}); +} +} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + gap polar=10, + middle={\Large\texttt{gap polar}}, + slices style={ + draw=Red, + fill=none, + ultra thick + }, + total count=6, + value=1 +]{} +\draw (0,0) circle[radius=2]; +\draw (0,0) circle[radius=3]; +\foreach\a in {30,90,150}{ +\foreach\t in {-10,10}{ +\draw ({\t+\a}:3)--({\t+\a+180}:3); +} +} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/inner data=\marg{text}} +This key contains the \meta{text} which will be placed at the inside of each slice of the wheelchart. The \meta{text} is placed in a node. The style of this node is given as follows. First, the option |align=left| is given. Thereafter, the style of the key |inner data style| is added. +\end{key} +\begin{key}{/wheelchart/inner data sep=\marg{value} (initially 0.2)} +This key defines the distance between the wheelchart and the contents of the key |inner data|. +\end{key} +\begin{stylekey}{/wheelchart/inner data style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |inner data| is placed. +\end{stylekey} +\begin{key}{/wheelchart/inner radius=\marg{value} (initially 2)} +The \meta{value} of this key defines the inner radius of the wheelchart. +\end{key} +\begin{key}{/wheelchart/legend=\marg{code}} +If this key is set then the \meta{code} given to this key will be executed at the end of the command |\wheelchart|. +\end{key} +\begin{key}{/wheelchart/legend entry=\marg{code}} +If this key is set then the \meta{code} given to this key will be executed for each slice of the wheelchart. +\begin{codeexample}[width=10cm,preamble={\usepackage{etoolbox}}] +\begin{tikzpicture} +\def\WClegend{} +\def\WClegendrow#1#2#3#4#5{\tikz\fill[#1] (0,0) rectangle (0.3,0.3); & #2 & $#3$ & #4 & #5\\} +\wheelchart[ + data={}, + legend entry={ + \gappto\WClegend{\WClegendrow} + \xappto\WClegend{{\WCvarB}{\WCvarC}{\WCvarA}{\WCperc}{\WCvarD}} + }, + legend={ + \node[anchor=west] at (3.5,0) {% + \begin{tabular}{l@{ }lrrl}% + & Fruit & Value & Percentage & Vitamines\\\hline% + \\[-10pt]% + \WClegend\hline% + & \textbf{Total} & $\pgfmathprintnumber{\WCtotalnum}$ & & \\% + \end{tabular}% + }; + } +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/lines=\marg{value} (default 1, initially 0)} +This key will draw lines of length \meta{value} between the wheelchart and the contents of the key |data|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\def\WCtest#1#2{% + \ifdim \WCpercentage pt>10 pt% + #1% + \else% + #2% + \fi% +} +\wheelchart[ + data={\WCtest{}{\WCperc}}, + lines={ + 1-max(sign(\WCpercentage-10),0) + }, + lines style={dotted,thick}, + pie, + wheel data={\WCtest{\WCperc}{}} +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/lines ext=\marg{value} (default 0.5, initially 0)} +If the \meta{value} of this key is $>0$ then the lines between the wheelchart and the contents of the key |data| will be extended horizontally with a length defined by \meta{value}. +\end{key} +\begin{key}{/wheelchart/lines ext bottom dir=\mchoice{left,right} (initially right)} +This key applies when |\WCdataangle|${}\in[270-\text{|lines ext dirsep|},270+\text{|lines ext dirsep|}]$. In this case, this key defines the direction in which the lines between the wheelchart and the contents of the key |data| will be extended horizontally and in this case, this key also determines the anchor of the key |data|. +\begin{description} +\item[\texttt{left}] In this case, the lines between the wheelchart and the contents of the key |data| will be extended horizontally to the left and the anchor of the key |data| is the value of the key |lines ext left anchor|. +\item[\texttt{right}] In this case, the lines between the wheelchart and the contents of the key |data| will be extended horizontally to the right and the anchor of the key |data| is the value of the key |lines ext right anchor|. +\end{description} +\end{key} +\begin{key}{/wheelchart/lines ext dirsep=\marg{angle} (initially 0)} +This key determines half the angle in degrees of the segment to which the keys |lines ext bottom dir| and |lines ext top dir| apply. +\end{key} +\begin{key}{/wheelchart/lines ext fixed=\opt{\meta{boolean}} (default true, initially false)} +If true, all lines between the wheelchart and the contents of the key |data| will be extended horizontally till the same $x$ coordinate at the left and till the same $x$ coordinate at the right. +\end{key} +\begin{key}{/wheelchart/lines ext left anchor=\marg{anchor} (initially mid east)} +This key defines the anchor of the key |data| when the lines between the wheelchart and the contents of the key |data| are extended horizontally to the left. +\end{key} +\begin{key}{/wheelchart/lines ext right anchor=\marg{anchor} (initially mid west)} +This key defines the anchor of the key |data| when the lines between the wheelchart and the contents of the key |data| are extended horizontally to the right. +\end{key} +\begin{key}{/wheelchart/lines ext top dir=\mchoice{left,right} (initially right)} +This key applies when |\WCdataangle|${}\in[90-\text{|lines ext dirsep|},90+\text{|lines ext dirsep|}]$. In this case, this key defines the direction in which the lines between the wheelchart and the contents of the key |data| will be extended horizontally and in this case, this key also determines the anchor of the key |data|. +\begin{description} +\item[\texttt{left}] In this case, the lines between the wheelchart and the contents of the key |data| will be extended horizontally to the left and the anchor of the key |data| is the value of the key |lines ext left anchor|. +\item[\texttt{right}] In this case, the lines between the wheelchart and the contents of the key |data| will be extended horizontally to the right and the anchor of the key |data| is the value of the key |lines ext right anchor|. +\end{description} +\begin{table}[ht] +\centering +\begin{tabular}{ll} + & Anchor of the key |data|\\ +|\WCdataangle| & in the case that $\text{|lines ext|}>0$\\\hline +$\rinterval{0}{90-\text{|lines ext dirsep|}}$ & value of the key |lines ext right anchor|\\ +$[90-\text{|lines ext dirsep|},90+\text{|lines ext dirsep|}]$ & value of the key |lines ext left anchor|\\ + & if |lines ext top dir=left|\\ + & value of the key |lines ext right anchor|\\ + & if |lines ext top dir=right|\\ +$\ointerval{90+\text{|lines ext dirsep|}}{270-\text{|lines ext dirsep|}}$ & value of the key |lines ext left anchor|\\ +$[270-\text{|lines ext dirsep|},270+\text{|lines ext dirsep|}]$ & value of the key |lines ext left anchor|\\ + & if |lines ext bottom dir=left|\\ + & value of the key |lines ext right anchor|\\ + & if |lines ext bottom dir=right|\\ +$\ointerval{270+\text{|lines ext dirsep|}}{360}$ & value of the key |lines ext right anchor|\\ +\end{tabular} +\caption{Anchor of the key \texttt{data} in the case that $\text{\ttfamily lines ext}>0$.}\label{tableanchorofthekeydatainthecasethatlinesextstrictlylargerthanzero} +\end{table} +The number of columns in the legend in the example below can be specified with |\WClegendcolumns|. +\begin{codeexample}[width=10cm,preamble={\usepackage{etoolbox} +\usetikzlibrary{decorations.markings}}] +\begin{tikzpicture} +\def\WClegendcolumns{2}%specify the number of columns in the legend +\def\WClegendrow#1#2#3{\tikz\fill[#1] (0,0) circle[radius=0.15]; & #2 & $#3$} +\wheelchart[ + data={\WCperc}, + data style={outer xsep=4pt}, + legend entry={ + \csgdef{WClegend\WCcount}{} + \csgappto{WClegend\WCcount}{\WClegendrow} + \csxappto{WClegend\WCcount}{{\WCvarB}{\WCvarC}{\WCvarA}} + }, + legend={ + \def\WClegend{} + \pgfmathsetmacro{\WClegendrows}{int(ceil(\WCtotalcount/\WClegendcolumns))} + \foreach\n in {1,...,\WClegendrows}{ + \foreach\k in {1,...,\WClegendcolumns}{ + \pgfmathparse{int(\n+(\k-1)*\WClegendrows)} + \ifnum\pgfmathresult>\WCtotalcount + \gappto\WClegend{ & & } + \else + \gappto\WClegend{\csname WClegend} + \xappto\WClegend{\pgfmathresult} + \gappto\WClegend{\endcsname} + \fi + \ifnum\k=\WClegendcolumns + \gappto\WClegend{\\} + \else + \gappto\WClegend{ & } + \fi + } + } + \node[anchor=north,draw,rounded corners,thick] at (0,-4.5) {% + \begin{tabular}{*{\WClegendcolumns}{l@{ }lr}}% + \WClegend% + \end{tabular}% + }; + }, + lines=0.5, + lines ext=1, + lines ext bottom dir=left, + lines ext dirsep=1, + lines ext fixed, + lines ext top dir=right, + lines sep=0, + lines style={ + \WCvarB, + postaction=decorate, + decoration={ + markings, + mark=at position 1 with { + \fill[\WCvarB] (0,0) circle[radius=0.15]; + } + } + }, + start angle=331.2 +]{\exampleforthismanual} +\wheelchart[ + data={}, + radius={1.5}{2}, + slices style=\WCvarB!70, + start angle=331.2 +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data style={ + inner sep=0pt, + shift={(0,0.1)} + }, + lines, + lines ext=1.2, + lines ext bottom dir=right, + lines ext dirsep=1, + %lines ext fixed, + lines ext left anchor={base west}, + lines ext right anchor={base east}, + lines ext top dir=left, + lines sep=-0.5, + %lines style=\WCvarB, + start angle=331.2 +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{decorations.markings}}] +\begin{tikzpicture} +\wheelchart[ + data={\WCvarC: \WCvarA}, + data angle shift=\WCvarG, + data style={draw=\WCvarB,fill=\WCvarB!20}, + lines=1.5, + lines ext=1, + lines sep=-1, + lines style={ + Black, + postaction=decorate, + decoration={ + markings, + mark=at position 0 with { + \fill[Black] (0,0) circle[radius=0.15]; + } + } + }, + pie, + start angle=331.2 +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/lines sep=\marg{value} (initially 0.2)} +This key defines the distance between the wheelchart and the start of the lines. +\end{key} +\begin{stylekey}{/wheelchart/lines style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the lines drawn by the key |lines|. +\end{stylekey} +\begin{key}{/wheelchart/middle=\marg{text}} +This key contains the \meta{text} which will be placed at the center of the wheelchart. The \meta{text} is placed in a node. The style of this node is given as follows. First, the option |align=center| is given. Thereafter, the style of the key |middle style| is added. +\end{key} +\begin{stylekey}{/wheelchart/middle fill=\marg{options} (initially \normalfont empty)} +If this key is set then the middle of the wheelchart will be filled with this style. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + counterclockwise, + data={}, + middle fill={ + Green, + draw=Red, + ultra thick + }, + radius={0.8*\WCcount} + {0.4+0.8*\WCcount}, + slices style={ + draw=Blue, + fill=none, + ultra thick + }, + start angle=0, + total angle=300, + total count=4, + value=1 +]{} +\end{tikzpicture} +\end{codeexample} +\end{stylekey} +\begin{stylekey}{/wheelchart/middle style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |middle| is placed. +\end{stylekey} +\begin{key}{/wheelchart/name=\marg{name} (initially wheelchart@name)} +This key defines the \meta{name} of the |local bounding box| around the wheelchart. +\end{key} +\begin{key}{/wheelchart/outer radius=\marg{value} (initially 3)} +The \meta{value} of this key defines the outer radius of the wheelchart. +\end{key} +\begin{key}{/wheelchart/perc precision=\marg{number} (initially 0)} +This key defines the number of decimals up to which the percentage in the macros |\WCperc| and |\WCpercentagerounded| are rounded. +\end{key} +\begin{key}{/wheelchart/pie=\opt{\meta{boolean}} (default true, initially false)} +If true, the inner radius of the wheelchart is set to |0|. +\end{key} +\begin{key}{/wheelchart/radius=\marg{inner radius}\marg{outer radius}} +This key defines the inner and outer radius of the wheelchart. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + contour={Green,ultra thick}, + data={}, + radius={0.5}{\WCcount}, + slices style=\WCvarA, + start angle=180, + total angle=180, + value=2, + wheel lines={\WCvarA!50,ultra thick} +]{Yellow,Orange,Red,Blue} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}] +\begin{tikzpicture} +\def\n{73} +\wheelchart[ + data={}, + middle={{\Huge\qty{\n}{\percent}}}, + radius={2.5-\WCvarC}{2.5+\WCvarC} +]{% + \n/MidnightBlue/0.5, + {100-\n}/BurntOrange/0.3% +} +\draw[Gray] (0,0) circle[radius=1.9]; +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/slices=\marg{path}} +If this key is set then the shape of the slices of the wheelchart is defined by \meta{path}. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + radius={2}{2}, + slices={(90:1) arc[start angle=-30, + end angle=-90,radius=1] + arc[start angle=-210, + end angle=90,radius=1]--cycle;}, + slices style={ + /utils/exec={ + \pgfmathsetmacro + {\WCcolornumber} + {(\WCcount/ + \WCtotalcount)*100} + }, + ForestGreen!\WCcolornumber, + draw=RedViolet, + ultra thick + }, + total count=6, + value=1, + wheel data=\WCcount +]{} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + radius={2.7}{3.1}, + slices={(0,-0.3)--(0.3,0)--(0,0.3) + --cycle;}, + value=1 +]{\exampleforthismanual} +\wheelchart[ + data={}, + value=1 +]{\exampleforthismanual} +\wheelchart[ + data={}, + radius={2}{2}, + slices={(0,0) circle[radius=0.4];}, + slices style=White, + value=1 +]{\exampleforthismanual} +\wheelchart[ + data={}, + radius={2}{2}, + slices={(0,0) circle[radius=0.3];}, + value=1, + wheel data=\WCcount +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/slices arc=\marg{value 1}\marg{value 2}} +This key sets both |slices end arc| and |slices start arc|. The effect of \meta{value 1} and \meta{value 2} is shown in the table below. + +%\begin{codeexample}[width=10cm] +\def\exampleslicesarc#1#2{% +\begin{tikzpicture}[baseline={(0,0)}] +\draw[Red,ultra thick] (-1,0)--(1,0); +\pgfmathsetmacro{\angle}{atan(0.5*((1/(#1))-(#1)))} +\draw (-1,0)--({-(1-(#2))},0) arc[start angle={sign(#1)*180-\angle},end angle={\angle},radius={0.5*(1-(#2))*abs((1/(#1))+(#1))}]--(1,0); +\end{tikzpicture}% +} +\begin{tabular}{l|ccc} + & $\text{\meta{value 2}}=-0.5$ & $\text{\meta{value 2}}=0$ & $\text{\meta{value 2}}=0.5$\\\hline +$\text{\meta{value 1}}=2$ & \exampleslicesarc{2}{-0.5} & \exampleslicesarc{2}{0} & \exampleslicesarc{2}{0.5}\\ +$\text{\meta{value 1}}=1$ & \exampleslicesarc{1}{-0.5} & \exampleslicesarc{1}{0} & \exampleslicesarc{1}{0.5}\\ +$\text{\meta{value 1}}=-1$ & \exampleslicesarc{-1}{-0.5} & \exampleslicesarc{-1}{0} & \exampleslicesarc{-1}{0.5}\\ +$\text{\meta{value 1}}=-2$ & \exampleslicesarc{-2}{-0.5} & \exampleslicesarc{-2}{0} & \exampleslicesarc{-2}{0.5}\\ +\end{tabular} +%\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + slices arc={1}{0} +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + radius={1}{4.5}, + slices arc={1}{0.66}, + slices style=\WCvarA, + start half, + value=1, + wheel data={% + \textbf{Number \WCcount}\\% + \WCvarB% + }, + wheel data pos=0.5, + wheel data style=White +]{% + Yellow/{Some text A}, + Orange/{Some text B}, + Red/{Some text C}, + Green/{Some text D}, + Blue/{Some text E}% +} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/slices arrow=\marg{value 1}\marg{value 2}} +This key is similar to the key |slices arc|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + gap=0.3, + slices arrow={1}{-1} +]{\exampleforthismanual} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/slices end arc=\marg{value 1}\marg{value 2}} +This key is similar to the key |slices arc| but only sets the end of the slice. +\end{key} +\begin{key}{/wheelchart/slices end arrow=\marg{value 1}\marg{value 2}} +This key is similar to the key |slices arrow| but only sets the end of the slice. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\wheelchart[ + data={}, + explode=1, + middle={\Large Recycle}, + slices end arrow={1}{-0.5}, + slices style=Green, + total count=3, + value=1 +]{} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/slices start arc=\marg{value 1}\marg{value 2}} +This key is similar to the key |slices arc| but only sets the start of the slice. +\end{key} +\begin{key}{/wheelchart/slices start arrow=\marg{value 1}\marg{value 2}} +This key is similar to the key |slices arrow| but only sets the start of the slice. +\end{key} +\begin{stylekey}{/wheelchart/slices style=\marg{options} (initially \textbackslash WCvarB)} +This key defines the style of the slices of the wheelchart. +\end{stylekey} +\begin{key}{/wheelchart/start angle=\marg{angle} (initially 90)} +This key defines the \meta{angle} in degrees at which the first slice of the wheelchart starts. +\end{key} +\begin{key}{/wheelchart/start half=\marg{angle} (default 90)} +If this key is set then the middle of the first slice of the wheelchart is positioned at \meta{angle} in degrees. +\end{key} +\begin{key}{/wheelchart/title=\marg{text}} +This key contains the \meta{text} which will be placed above the wheelchart. The \meta{text} is placed in a node. The $x$ coordinate of this node is the $x$ coordinate of the center of the wheelchart, which is defined by the key |at|. In general, this is \emph{not} the same as the $x$ coordinate of the center of the |local bounding box| around the wheelchart. The $y$ coordinate of this node is |0.5| above the north of the |local bounding box| around the wheelchart. The style of this node is given as follows. First, the options |anchor=south,align=center| are given. Thereafter, the style of the key |title style| is added. +\end{key} +\begin{key}{/wheelchart/title left=\marg{text}} +This key contains the \meta{text} which will be placed above left of the wheelchart. The \meta{text} is placed in a node. This node is placed |0.5| above the north west of the |local bounding box| around the wheelchart. The style of this node is given as follows. First, the options |anchor=south west,align=left| are given. Thereafter, the style of the key |title left style| is added. +\end{key} +\begin{stylekey}{/wheelchart/title left style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |title left| is placed. +\end{stylekey} +\begin{stylekey}{/wheelchart/title style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |title| is placed. +\end{stylekey} +\begin{key}{/wheelchart/total angle=\marg{angle} (initially 360)} +This key defines the total \meta{angle} in degrees of the wheelchart. +\end{key} +\begin{key}{/wheelchart/total count=\marg{number}} +If this key is set then the number of slices of the wheelchart is determined by \meta{number}. +\begin{codeexample}[width=10cm,preamble={\usepackage{listofitems}}] +\readlist*\WCcolors{ + Rhodamine,RedOrange,OrangeRed +} +\setsepchar{ } +\readlist\WCdata{An example with the + package \texttt{listofitems} where + some keys are given using a list} +\begin{tikzpicture} +\wheelchart[ + data={\WCdata[\WCcount]}, + slices style={ + /utils/exec={ + \pgfmathsetmacro + {\WCcolornumber} + {int(Mod({\WCcount-1}, + \WCcolorslen)+1)} + }, + \WCcolors[\WCcolornumber] + }, + total count={\WCdatalen}, + value=1 +]{} +\end{tikzpicture} +\end{codeexample} +\begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}] +\begin{tikzpicture} +\def\n{57} +\wheelchart[ + data={}, + gap=0.015, + middle={% + {\Huge\qty{\n}{\percent}}\\% + An ode to the\\% + ``Grothendieck prime''% + }, + slices style={ + /utils/exec={ + \ifnum\WCcount>\n + \def\WCcolor{Gray} + \else + \def\WCcolor{Cyan} + \fi + }, + \WCcolor + }, + total count=100, + value=1 +]{} +\end{tikzpicture} +\end{codeexample} +\end{key} +\begin{key}{/wheelchart/value=\marg{value} (initially \textbackslash WCvarA)} +This key defines the \meta{value} which corresponds to the size of each slice of the wheelchart. +\end{key} +\begin{key}{/wheelchart/wheel data=\marg{text}} +This key contains the \meta{text} which will be placed on top of each slice of the wheelchart. The \meta{text} is placed in a node. The style of this node is given as follows. First, the option |align=left| is given. Thereafter, the style of the key |wheel data style| is added. +\end{key} +\begin{key}{/wheelchart/wheel data pos=\marg{value} (initially 0.66)} +The radius of the polar coordinate at which the contents of the key |wheel data| is placed is given by the convex combination $\text{|wheel data pos|}\cdot\text{|outer radius|}+(1-\text{|wheel data pos|})\cdot\text{|inner radius|}$. +\end{key} +\begin{stylekey}{/wheelchart/wheel data style=\marg{options} (initially \normalfont empty)} +This key accepts a list of keys which will be applied to the node where the contents of the key |wheel data| is placed. +\end{stylekey} +\begin{stylekey}{/wheelchart/wheel lines=\marg{options} (initially \normalfont empty)} +If this key is set then lines with the style determined by this key will be drawn inside the slices of the wheelchart. The number of these lines depends on the value of the key |value|. + +Below is the example from \cite[Subsection 7.6]{TtTaPGFp} recreated with the package |wheelchart|. +\begin{codeexample}[width=10cm] +\begin{tikzpicture} +\colorlet{good}{green!75!black} +\colorlet{bad}{red} +\colorlet{neutral}{black!60} +\colorlet{none}{white} +\wheelchart[ + anchor xsep=15, + contour=gray, + data={``\WCvarC'': \WCvarA{} (\WCperc)}, + middle={Ratings given by\\\pgfmathprintnumber{\WCtotalnum}~participants}, + radius={1.8}{2.2}, + start half=270, + wheel lines={black!15,thick} +]{% + 10/neutral/ok, + 9/good!60!white/good, + 3/good/{very good}, + 20/none/none, + 0/bad/{very bad}, + 8/bad!60!white/bad% +} +\end{tikzpicture} +\end{codeexample} +\end{stylekey} +\begin{thebibliography}{9} +\bibitem{JhcIparowcltopotPGFm} +Jake, +\emph{How can I produce a `ring (or wheel) chart' like that on page 88 of the {\upshape\pgfname} manual?}, +\url{https://tex.stackexchange.com/questions/17898/how-can-i-produce-a-ring-or-wheel-chart-like-that-on-page-88-of-the-pgf-manu/18105#18105}, +2011. +\bibitem{MpMP} +Jens-Uwe Morawski, +\emph{{\upshape\texttt{piechart}\textsf{MP}}}, +Manual for Preliminary Version, +\url{https://ctan.org/pkg/piechartmp}, +2002. +\bibitem{RSVpaaMfp} +Dominique Rodriguez, Michael Sharpe, Herbert Vo{\ss}, +\emph{{\upshape\texttt{pstricks-add} \textsf{additionals Macros for} \texttt{pstricks}}}, +Manual for version 3.92, +\url{https://ctan.org/pkg/pstricks-add}, +2021. +\bibitem{Tumfdb} +Nicola L.C.~Talbot, +\emph{User Manual for datatool bundle version 2.32}, +\url{https://ctan.org/pkg/datatool}, +2019. +\bibitem{TtTaPGFp} +Till Tantau, +\emph{The \tikzname{} and {\upshape\pgfname} Packages}, +Manual for version 3.1.9a, +\url{https://ctan.org/pkg/pgf}, +2021. +\bibitem{XdPCbupp} +Yuan Xu, +\emph{Drawing Pie Chart by using {\upshape\texttt{pgf-pie}}}, +Manual for version 0.6, +\url{https://ctan.org/pkg/pgf-pie}, +2021. +\end{thebibliography} +\printindex +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty b/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty new file mode 100644 index 00000000000..c7f9fbc8bb0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty @@ -0,0 +1,443 @@ +%% wheelchart.sty +%% Copyright 2022 Matthias Floré +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3c +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Matthias Floré. +% +% This work consists of the files wheelchart.pdf, wheelchart.sty, +% wheelchart.tex and README.md. +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{wheelchart}[2022/09/11 v1.0 Draw wheelcharts with TikZ] +\RequirePackage{tikz} +\usetikzlibrary{calc} +\def\wheelchart@slicesstart{} +\def\wheelchart@slicesend{} +\newif\ifwheelchart@contour +\newif\ifwheelchart@counterclockwise +\newif\ifwheelchart@definnercontour +\newif\ifwheelchart@draw +\newif\ifwheelchart@linesextfixed +\newif\ifwheelchart@middlefill +\newif\ifwheelchart@pie +\newif\ifwheelchart@slicesarcadaptangle +\newif\ifwheelchart@wheellines +\newcommand{\wheelchart@slicesarcdefmacros}[2]{ +\pgfmathsetmacro{\wheelchart@slicesarcA}{#1} +\pgfmathsetmacro{\wheelchart@slicesarcB}{#2} +\pgfmathsetmacro{\wheelchart@slicesarcradius}{(1-(\wheelchart@slicesarcB))*\n1*abs((1/(\wheelchart@slicesarcA))+(\wheelchart@slicesarcA))/2} +\wheelchart@slicesarcadaptanglefalse +\ifdim \wheelchart@slicesarcA pt<\z@ +\pgfmathsetmacro{\wheelchart@slicesarccoord}{max(\wheelchart@slicesarcB,0)} +\wheelchart@slicesarcadaptangletrue +\ifdim \wheelchart@slicesarcB pt<\z@ +\else +\pgfmathsetmacro{\wheelchart@halflengthsliceinnerstartplussliceouterstart}{veclen(\x3/\pgf@xx,\y3/\pgf@yy)} +\pgfmathsetmacro{\wheelchart@slicesarcradiusbound}{sqrt((\wheelchart@halflengthsliceinnerstartplussliceouterstart^2-((\wheelchart@gap)^2)+((\wheelchart@gap-\wheelchart@slicesarcA*(1-(\wheelchart@slicesarcB))*\n1-\wheelchart@slicesarcradius)^2))} +\pgfmathsetmacro{\wheelchart@slicesarcradiusboundminusslicesarcradius}{\wheelchart@slicesarcradiusbound-\wheelchart@slicesarcradius} +\pgfmathsetmacro{\wheelchart@slicesarcradiusboundplusslicesarcradius}{\wheelchart@slicesarcradiusbound+\wheelchart@slicesarcradius} +\ifdim \wheelchart@slicesarcradiusboundminusslicesarcradius pt>\wheelchart@innerradius pt +\ifdim \wheelchart@slicesarcradiusboundplusslicesarcradius pt<\wheelchart@outerradius pt +\wheelchart@slicesarcadaptanglefalse +\fi +\fi +\fi +\else +\pgfmathsetmacro{\wheelchart@slicesarccoord}{\wheelchart@slicesarcB} +\fi +\pgfmathsetmacro{\wheelchart@slicesarccoordtimesnone}{\wheelchart@slicesarccoord*\n1} +\ifwheelchart@slicesarcadaptangle +\pgfmathsetmacro{\wheelchart@slicesarcangle}{-acos((2*(\wheelchart@slicesarccoord-1))/((1-(\wheelchart@slicesarcB))*((1/(\wheelchart@slicesarcA))+(\wheelchart@slicesarcA))))} +\else +\pgfmathsetmacro{\wheelchart@slicesarcangle}{atan(((1/(\wheelchart@slicesarcA))-(\wheelchart@slicesarcA))/2)} +\fi +} +\newcommand{\wheelchart@slicesarrowdefmacros}[2]{ +\pgfmathsetmacro{\wheelchart@slicesarrowA}{#1} +\pgfmathsetmacro{\wheelchart@slicesarrowB}{#2} +\pgfmathsetmacro{\wheelchart@slicesarrowlength}{\n1} +\ifdim \wheelchart@slicesarrowA pt<\z@ +\pgfmathsetmacro{\wheelchart@slicesarrowcoord}{max(\wheelchart@slicesarrowB,0)} +\else +\pgfmathsetmacro{\wheelchart@slicesarrowcoord}{\wheelchart@slicesarrowB} +\fi +\pgfmathsetmacro{\wheelchart@slicesarrowtip}{(1-\wheelchart@slicesarrowcoord)*\wheelchart@slicesarrowA} +} +\pgfkeys{ +/wheelchart/.is family, +/wheelchart, +anchor xsep/.initial=5, +anchor ysep/.initial=5, +at/.initial={(0,0)}, +caption/.store in=\wheelchart@caption, +caption style/.style={caption style@options/.style={#1}}, +caption style@options/.style={}, +caption left/.store in=\wheelchart@captionleft, +caption left style/.style={caption left style@options/.style={#1}}, +caption left style@options/.style={}, +contour@boolean/.is if=wheelchart@contour, +contour/.style={contour@boolean=true,contour@options/.style={#1}}, +contour@options/.style={}, +counterclockwise/.is if=wheelchart@counterclockwise, +data/.initial={\WCvarC}, +data angle shift/.initial=0, +data sep/.initial=0.2, +data style/.style={data style@options/.style={#1}}, +data style@options/.style={}, +expand list/.is choice, +expand list/false/.code={\def\wheelchart@expandlistvalue{false}\def\wheelchart@foreachdeflist##1{\def\wheelchart@foreachlist{##1}}}, +expand list/once/.code={\def\wheelchart@expandlistvalue{true}\def\wheelchart@foreachdeflist##1{\def\wheelchart@foreachlist{\unexpanded\expandafter{##1}}}}, +expand list/true/.code={\def\wheelchart@expandlistvalue{true}\def\wheelchart@foreachdeflist##1{\def\wheelchart@foreachlist{##1}}}, +expand list=once, +explode/.initial=0, +explode/.default=0.2, +gap/.initial=0, +gap/.default=0.05, +gap polar/.initial=0, +gap polar/.default=1, +inner data/.store in=\wheelchart@innerdata, +inner data sep/.initial=0.2, +inner data style/.style={inner data style@options/.style={#1}}, +inner data style@options/.style={}, +inner radius/.initial=2, +legend/.store in=\wheelchart@legend, +legend entry/.store in=\wheelchart@legendentry, +lines/.initial=0, +lines/.default=1, +lines ext/.initial=0, +lines ext/.default=0.5, +lines ext bottom dir/.is choice, +lines ext bottom dir/left/.code={\pgfmathsetmacro{\wheelchart@linesextbottomdir}{-1}}, +lines ext bottom dir/right/.code={\pgfmathsetmacro{\wheelchart@linesextbottomdir}{1}}, +lines ext bottom dir=right, +lines ext dirsep/.initial=0, +lines ext fixed/.is if=wheelchart@linesextfixed, +lines ext left anchor/.initial={mid east}, +lines ext right anchor/.initial={mid west}, +lines ext top dir/.is choice, +lines ext top dir/left/.code={\pgfmathsetmacro{\wheelchart@linesexttopdir}{-1}}, +lines ext top dir/right/.code={\pgfmathsetmacro{\wheelchart@linesexttopdir}{1}}, +lines ext top dir=right, +lines sep/.initial=0.2, +lines style/.style={lines style@options/.style={#1}}, +lines style@options/.style={}, +middle/.store in=\wheelchart@middle, +middle fill@boolean/.is if=wheelchart@middlefill, +middle fill/.style={middle fill@boolean=true,middle fill@options/.style={#1}}, +middle fill@options/.style={}, +middle style/.style={middle style@options/.style={#1}}, +middle style@options/.style={}, +name/.code={\xdef\wheelchart@name{#1}}, +name=wheelchart@name, +outer radius/.initial=3, +perc precision/.initial=0, +pie/.is if=wheelchart@pie, +radius/.code 2 args={\pgfkeys{/wheelchart,inner radius={#1},outer radius={#2}}}, +slices/.store in=\wheelchart@slices, +slices arc/.code 2 args={\pgfkeys{/wheelchart,slices start arc={-(#1)}{#2},slices end arc={#1}{#2}}}, +slices arrow/.code 2 args={\pgfkeys{/wheelchart,slices start arrow={-(#1)}{#2},slices end arrow={#1}{#2}}}, +slices end arc/.code 2 args={\def\wheelchart@slicesend{{[shift={(wheelchart@sliceouterend)},rotate={90-atan2(\p2)},/utils/exec={\wheelchart@slicesarcdefmacros{#1}{#2}}]--({-\wheelchart@slicesarccoordtimesnone},0) arc[start angle={\wheelchart@counterorclockwise*\wheelchart@slicesarcangle},end angle={\wheelchart@counterorclockwise*(sign(#1)*180-\wheelchart@slicesarcangle)},radius={\wheelchart@slicesarcradius}]}}}, +slices end arrow/.code 2 args={\def\wheelchart@slicesend{{[shift={(wheelchart@sliceouterend)},rotate={90-atan2(\p2)},/utils/exec={\wheelchart@slicesarrowdefmacros{#1}{#2}}]--({-\wheelchart@slicesarrowcoord*\wheelchart@slicesarrowlength},0)--({-\wheelchart@slicesarrowlength},{\wheelchart@counterorclockwise*\wheelchart@slicesarrowtip*\wheelchart@slicesarrowlength})--({(\wheelchart@slicesarrowcoord-2)*\wheelchart@slicesarrowlength},0)}}}, +slices start arc/.code 2 args={\def\wheelchart@slicesstart{{[shift={(wheelchart@sliceinnerstart)},rotate={90-atan2(\p1)},/utils/exec={\wheelchart@slicesarcdefmacros{#1}{#2}}]({\wheelchart@slicesarccoordtimesnone},0) arc[start angle={-\wheelchart@counterorclockwise*(sign(#1)*180-\wheelchart@slicesarcangle)},end angle={-\wheelchart@counterorclockwise*\wheelchart@slicesarcangle},radius={\wheelchart@slicesarcradius}]}--}}, +slices start arrow/.code 2 args={\def\wheelchart@slicesstart{{[shift={(wheelchart@sliceinnerstart)},rotate={90-atan2(\p1)},/utils/exec={\wheelchart@slicesarrowdefmacros{#1}{#2}}]({\wheelchart@slicesarrowcoord*\wheelchart@slicesarrowlength},0)--({\wheelchart@slicesarrowlength},{-\wheelchart@counterorclockwise*\wheelchart@slicesarrowtip*\wheelchart@slicesarrowlength})--({(2-\wheelchart@slicesarrowcoord)*\wheelchart@slicesarrowlength},0)}--}}, +slices style/.style={slices style@options/.style={#1}}, +slices style@options/.style={}, +slices style={\WCvarB}, +start angle/.initial=90, +start half/.store in=\wheelchart@starthalf, +start half/.default=90, +title/.store in=\wheelchart@title, +title style/.style={title style@options/.style={#1}}, +title style@options/.style={}, +title left/.store in=\wheelchart@titleleft, +title left style/.style={title left style@options/.style={#1}}, +title left style@options/.style={}, +total angle/.initial=360, +total count/.code={\pgfmathsetmacro{\wheelchart@totalcount}{int(#1)}}, +value/.initial={\WCvarA}, +wheel data/.store in=\wheelchart@wheeldata, +wheel data pos/.initial=0.66, +wheel data style/.style={wheel data style@options/.style={#1}}, +wheel data style@options/.style={}, +wheel lines@boolean/.is if=wheelchart@wheellines, +wheel lines/.style={wheel lines@boolean=true,wheel lines@options/.style={#1}}, +wheel lines@options/.style={}, +} +\newcommand{\wheelchart@foreachinitial}[2]{\ifcsname wheelchart@totalcount\endcsname\ifnum\wheelchart@totalcount>1\gdef\wheelchart@foreachlist{}\foreach\wheelchart@n in {2,...,\wheelchart@totalcount}{\xdef\wheelchart@foreachlist{\wheelchart@foreachlist,}}\else\ifnum\wheelchart@totalcount=1\gdef\wheelchart@foreachlist{{}}\else\gdef\wheelchart@foreachlist{}\fi\fi\else\wheelchart@foreachdeflist{#1}\fi\foreach\WCvarA/\WCvarB/\WCvarC/\WCvarD/\WCvarE/\WCvarF/\WCvarG/\WCvarH/\WCvarI/\WCvarJ/\WCvarK/\WCvarL/\WCvarM/\WCvarN/\WCvarO/\WCvarP/\WCvarQ/\WCvarR/\WCvarS/\WCvarT/\WCvarU/\WCvarV/\WCvarW/\WCvarX/\WCvarY/\WCvarZ [count=\WCcount,expand list=\wheelchart@expandlistvalue] in \wheelchart@foreachlist{#2}} +\newcommand{\wheelchart@foreach}[2]{\pgfmathsetmacro{\wheelchart@angle}{\wheelchart@startangle}\wheelchart@foreachinitial{#1}{\pgfmathsetmacro{\wheelchart@outerradius}{\pgfkeysvalueof{/wheelchart/outer radius}} +\ifwheelchart@pie +\pgfmathsetmacro{\wheelchart@innerradius}{0} +\else +\pgfmathsetmacro{\wheelchart@innerradius}{\pgfkeysvalueof{/wheelchart/inner radius}} +\fi +\pgfmathsetmacro{\wheelchart@gap}{\pgfkeysvalueof{/wheelchart/gap}} +\pgfmathsetmacro{\wheelchart@gappolar}{\pgfkeysvalueof{/wheelchart/gap polar}} +\pgfmathsetmacro{\wheelchart@value}{\pgfkeysvalueof{/wheelchart/value}} +\pgfmathsetmacro{\wheelchart@newangle}{\wheelchart@angle+(\wheelchart@counterorclockwise*\wheelchart@value*(\wheelchart@totalangle/\WCtotalnum))} +\pgfmathsetmacro{\wheelchart@abshalfangleminusnewangle}{abs((\wheelchart@angle-\wheelchart@newangle)/2)} +\wheelchart@drawfalse +\pgfmathsetmacro{\wheelchart@abshalfangleminusnewangleminusgappolar}{\wheelchart@abshalfangleminusnewangle-\wheelchart@gappolar} +\ifdim \wheelchart@abshalfangleminusnewangleminusgappolar pt=180 pt +\pgfmathsetmacro{\wheelchart@outergap}{asin(\wheelchart@gap/\wheelchart@outerradius)} +\ifdim \wheelchart@gap pt<\wheelchart@innerradius pt +\pgfmathsetmacro{\wheelchart@innergap}{asin(\wheelchart@gap/\wheelchart@innerradius)} +\else +\pgfmathsetmacro{\wheelchart@innergap}{90} +\pgfmathsetmacro{\wheelchart@innerradius}{\wheelchart@gap} +\fi +\ifdim \wheelchart@innerradius pt<\wheelchart@outerradius pt +\wheelchart@drawtrue +\fi +\else +\ifdim \wheelchart@abshalfangleminusnewangleminusgappolar pt>\z@ +\pgfmathsetmacro{\wheelchart@outerradiustimessinabshalfangleminusnewangleminusgappolar}{\wheelchart@outerradius*sin(\wheelchart@abshalfangleminusnewangleminusgappolar)} +\ifdim \wheelchart@outerradiustimessinabshalfangleminusnewangleminusgappolar pt<\wheelchart@gap pt +\else +\pgfmathsetmacro{\wheelchart@outergap}{asin(\wheelchart@gap/\wheelchart@outerradius)+\wheelchart@gappolar} +\pgfmathsetmacro{\wheelchart@innerradiustimessinabshalfangleminusnewangleminusgappolar}{\wheelchart@innerradius*sin(\wheelchart@abshalfangleminusnewangleminusgappolar)} +\ifdim \wheelchart@innerradiustimessinabshalfangleminusnewangleminusgappolar pt>\wheelchart@gap pt +\pgfmathsetmacro{\wheelchart@innergap}{asin(\wheelchart@gap/\wheelchart@innerradius)+\wheelchart@gappolar} +\else +\pgfmathsetmacro{\wheelchart@innergap}{\wheelchart@abshalfangleminusnewangle} +\ifdim \wheelchart@innerradiustimessinabshalfangleminusnewangleminusgappolar pt<\wheelchart@gap pt +\pgfmathsetmacro{\wheelchart@innerradius}{\wheelchart@gap/sin(\wheelchart@abshalfangleminusnewangleminusgappolar)} +\fi +\fi +\ifdim \wheelchart@innerradius pt<\wheelchart@outerradius pt +\wheelchart@drawtrue +\fi +\fi +\fi +\fi +\pgfmathsetmacro{\wheelchart@explode}{\pgfkeysvalueof{/wheelchart/explode}} +\pgfmathsetmacro{\WCmidangle}{Mod((\wheelchart@angle+\wheelchart@newangle)/2,360)} +\pgfmathsetmacro{\wheelchart@dataangleshift}{\pgfkeysvalueof{/wheelchart/data angle shift}} +\pgfmathsetmacro{\WCdataangle}{Mod(\wheelchart@counterorclockwise*\wheelchart@dataangleshift+\WCmidangle,360)} +\pgfmathsetmacro{\WCpercentage}{\wheelchart@value/(\WCtotalnum/100)} +\pgfmathprintnumberto[precision=\pgfkeysvalueof{/wheelchart/perc precision}]{\WCpercentage}{\WCpercentagerounded} +\begin{scope}[shift={(\WCmidangle:\wheelchart@explode)}] +#2 +\end{scope} +\global\let\wheelchart@angle=\wheelchart@newangle}} +\AtBeginDocument{\@ifpackageloaded{siunitx}{\newcommand{\WCperc}{\qty[round-mode=places,round-precision=\pgfkeysvalueof{/wheelchart/perc precision}]{\WCpercentage}{\percent}}}{\newcommand{\WCperc}{\WCpercentagerounded\,\%}}} +\newcommand{\wheelchart@ifnotext}[3]{%%https://tex.stackexchange.com/questions/42280/expand-away-empty-macros-within-ifthenelse%https://tex.stackexchange.com/questions/44919/proper-way-to-detect-empty-blank-text +\begingroup% +\begin{pgfinterruptpicture}%%https://tex.stackexchange.com/questions/459853/savebox-within-tikzpicture-results-in-an-empty-savebox +\sbox0{#1}% +\ifdim\wd0=\z@% +\gdef\wheelchart@node{0}% +\else% +\gdef\wheelchart@node{1}% +\fi% +\end{pgfinterruptpicture}% +\endgroup% +\ifnum\wheelchart@node=0% +{#2}%%if #1 is empty +\else% +{#3}%%if #1 is not empty +\fi% +} +\newcommand{\wheelchart}[2][]{{ +\pgfkeys{/wheelchart,#1} +\begin{scope}[shift/.expanded={\pgfkeysvalueof{/wheelchart/at}},local bounding box/.expanded=\wheelchart@name] +\ifwheelchart@counterclockwise +\pgfmathsetmacro{\wheelchart@counterorclockwise}{1} +\else +\pgfmathsetmacro{\wheelchart@counterorclockwise}{-1} +\fi +\pgfmathsetmacro{\wheelchart@totalangle}{\pgfkeysvalueof{/wheelchart/total angle}} +\pgfmathsetmacro{\WCtotalnum}{0} +\wheelchart@foreachinitial{#2}{ +\pgfmathsetmacro{\wheelchart@value}{\pgfkeysvalueof{/wheelchart/value}} +\pgfmathparse{\wheelchart@value+\WCtotalnum} +\global\let\WCtotalnum=\pgfmathresult +\ifnum\WCcount=1 +\xdef\wheelchart@firstvalue{\wheelchart@value} +\fi +\xdef\WCtotalcount{\WCcount} +} +\ifcsname wheelchart@starthalf\endcsname +\pgfmathsetmacro{\wheelchart@startangle}{Mod(\wheelchart@starthalf-(\wheelchart@counterorclockwise*\wheelchart@firstvalue*0.5*(\wheelchart@totalangle/\WCtotalnum)),360)} +\else +\pgfmathsetmacro{\wheelchart@startangle}{Mod(\pgfkeysvalueof{/wheelchart/start angle},360)} +\fi +\wheelchart@definnercontourfalse +\ifwheelchart@contour +\wheelchart@definnercontourtrue +\xdef\wheelchart@outercontour{} +\wheelchart@foreach{#2}{ +\xdef\wheelchart@outercontour{(\wheelchart@newangle:\wheelchart@outerradius) arc[start angle=\wheelchart@newangle,end angle=\wheelchart@angle,radius=\wheelchart@outerradius]--\wheelchart@outercontour} +} +\else +\ifwheelchart@middlefill +\wheelchart@definnercontourtrue +\fi +\fi +\ifwheelchart@definnercontour +\xdef\wheelchart@innercontour{} +\wheelchart@foreach{#2}{ +\xdef\wheelchart@innercontour{\wheelchart@innercontour(\wheelchart@angle:\wheelchart@innerradius) arc[start angle=\wheelchart@angle,end angle=\wheelchart@newangle,radius=\wheelchart@innerradius]--} +} +\fi +\ifwheelchart@middlefill +\fill[/wheelchart/middle fill@options] +\ifdim \wheelchart@totalangle pt=360 pt +\else +(0,0)-- +\fi +\wheelchart@innercontour cycle; +\fi +\wheelchart@foreach{#2}{ +\ifcsname wheelchart@slices\endcsname +\begin{scope}[shift={(\WCmidangle:{(\wheelchart@innerradius+\wheelchart@outerradius)/2})},rotate=\WCmidangle] +\fill[/wheelchart/slices style@options] \wheelchart@slices +\end{scope} +\else +\ifwheelchart@draw +\pgfmathsetmacro{\wheelchart@sliceinnerstartangle}{\wheelchart@angle+(\wheelchart@counterorclockwise*(\wheelchart@innergap))} +\pgfmathsetmacro{\wheelchart@sliceinnerendangle}{\wheelchart@newangle-(\wheelchart@counterorclockwise*(\wheelchart@innergap))} +\pgfmathsetmacro{\wheelchart@sliceouterstartangle}{\wheelchart@angle+(\wheelchart@counterorclockwise*(\wheelchart@outergap))} +\pgfmathsetmacro{\wheelchart@sliceouterendangle}{\wheelchart@newangle-(\wheelchart@counterorclockwise*(\wheelchart@outergap))} +\coordinate (wheelchart@sliceinnerstart) at (\wheelchart@sliceinnerstartangle:\wheelchart@innerradius); +\coordinate (wheelchart@sliceinnerend) at (\wheelchart@sliceinnerendangle:\wheelchart@innerradius); +\coordinate (wheelchart@sliceouterstart) at (\wheelchart@sliceouterstartangle:\wheelchart@outerradius); +\coordinate (wheelchart@sliceouterend) at (\wheelchart@sliceouterendangle:\wheelchart@outerradius); +\fill[/wheelchart/slices style@options] let \p1=($(wheelchart@sliceouterstart)-(wheelchart@sliceinnerstart)$),\p2=($(wheelchart@sliceouterend)-(wheelchart@sliceinnerend)$),\p3=($(wheelchart@sliceinnerstart)!0.5!(wheelchart@sliceouterstart)$),\n1={veclen(\x1/\pgf@xx,\y1/\pgf@yy)/2} in \wheelchart@slicesstart(wheelchart@sliceouterstart) arc[start angle=\wheelchart@sliceouterstartangle,end angle=\wheelchart@sliceouterendangle,radius=\wheelchart@outerradius]\wheelchart@slicesend--(wheelchart@sliceinnerend) arc[start angle=\wheelchart@sliceinnerendangle,end angle=\wheelchart@sliceinnerstartangle,radius=\wheelchart@innerradius]--cycle; +\fi +\fi +} +\ifwheelchart@wheellines +\ifdim \wheelchart@totalangle pt=360 pt +\def\wheelchart@start{1} +\else +\def\wheelchart@start{0} +\fi +\wheelchart@foreach{#2}{ +\foreach\wheelchart@n in {\wheelchart@start,...,\wheelchart@value}{ +\pgfmathsetmacro{\wheelchart@anglewheellines}{\wheelchart@angle+(\wheelchart@counterorclockwise*\wheelchart@n*(\wheelchart@totalangle/\WCtotalnum))} +\draw[/wheelchart/wheel lines@options] (\wheelchart@anglewheellines:\wheelchart@innerradius)--(\wheelchart@anglewheellines:\wheelchart@outerradius); +} +\gdef\wheelchart@start{1} +} +\fi +\ifwheelchart@contour +\ifdim \wheelchart@totalangle pt=360 pt +\draw[/wheelchart/contour@options] \wheelchart@innercontour cycle; +\draw[/wheelchart/contour@options] \wheelchart@outercontour cycle; +\else +\draw[/wheelchart/contour@options] \wheelchart@innercontour\wheelchart@outercontour cycle; +\fi +\fi +\wheelchart@foreach{#2}{ +\pgfmathsetmacro{\wheelchart@datasep}{\pgfkeysvalueof{/wheelchart/data sep}} +\pgfmathsetmacro{\wheelchart@lines}{\pgfkeysvalueof{/wheelchart/lines}} +\pgfmathsetmacro{\wheelchart@linesext}{\pgfkeysvalueof{/wheelchart/lines ext}} +\pgfmathsetmacro{\wheelchart@linessep}{\pgfkeysvalueof{/wheelchart/lines sep}} +\ifdim \wheelchart@linesext pt>\z@ +\pgfmathsetmacro{\wheelchart@linesextdirsep}{\pgfkeysvalueof{/wheelchart/lines ext dirsep}} +\pgfmathparse{ +(\WCdataangle<90-\wheelchart@linesextdirsep?"1": +(\WCdataangle<=90+\wheelchart@linesextdirsep?"\wheelchart@linesexttopdir": +(\WCdataangle<270-\wheelchart@linesextdirsep?"-1": +(\WCdataangle<=270+\wheelchart@linesextdirsep?"\wheelchart@linesextbottomdir": +"1" +)))) +} +\edef\wheelchart@linesextdir{\pgfmathresult} +\draw[/wheelchart/lines style@options] let \p1=(\WCdataangle:{\wheelchart@outerradius+\wheelchart@linessep+\wheelchart@lines}) in (\WCdataangle:{\wheelchart@outerradius+\wheelchart@linessep})--(\p1) +\ifwheelchart@linesextfixed +--({\wheelchart@linesextdir*(\wheelchart@outerradius+\wheelchart@linessep+\wheelchart@lines+\wheelchart@linesext)},\y1) +\else +--++({\wheelchart@linesextdir*\wheelchart@linesext},0) +\fi +coordinate (wheelchart@datacoord); +\pgfmathparse{ +(\wheelchart@linesextdir==1?"\pgfkeysvalueof{/wheelchart/lines ext right anchor}": +(\wheelchart@linesextdir==-1?"\pgfkeysvalueof{/wheelchart/lines ext left anchor}": +)) +} +\edef\wheelchart@dataanchor{\pgfmathresult} +\else +\pgfmathsetmacro{\wheelchart@anchorxsep}{\pgfkeysvalueof{/wheelchart/anchor xsep}} +\pgfmathsetmacro{\wheelchart@anchorysep}{\pgfkeysvalueof{/wheelchart/anchor ysep}} +\pgfmathparse{ +(\WCdataangle==0?"west": +(\WCdataangle==90?"south": +(\WCdataangle==180?"east": +(\WCdataangle==270?"north": +(\WCdataangle<=\wheelchart@anchorysep?"west": +(\WCdataangle<90-\wheelchart@anchorxsep?"south west": +(\WCdataangle<=90+\wheelchart@anchorxsep?"south": +(\WCdataangle<180-\wheelchart@anchorysep?"south east": +(\WCdataangle<=180+\wheelchart@anchorysep?"east": +(\WCdataangle<270-\wheelchart@anchorxsep?"north east": +(\WCdataangle<=270+\wheelchart@anchorxsep?"north": +(\WCdataangle<360-\wheelchart@anchorysep?"north west": +"west" +)))))))))))) +} +\edef\wheelchart@dataanchor{\pgfmathresult} +\ifdim \wheelchart@lines pt>\z@ +\draw[/wheelchart/lines style@options] (\WCdataangle:{\wheelchart@outerradius+\wheelchart@linessep})--++(\WCdataangle:\wheelchart@lines) coordinate[shift={(\WCdataangle:\wheelchart@datasep)}] (wheelchart@datacoord); +\else +\coordinate (wheelchart@datacoord) at (\WCdataangle:{\wheelchart@outerradius+\wheelchart@datasep}); +\fi +\fi +\wheelchart@ifnotext{\pgfkeysvalueof{/wheelchart/data}}{}{\node[anchor=\wheelchart@dataanchor,align=left,/wheelchart/data style@options] at (wheelchart@datacoord) {\pgfkeysvalueof{/wheelchart/data}};} +\ifcsname wheelchart@innerdata\endcsname +\wheelchart@ifnotext{\wheelchart@innerdata}{}{% +\pgfmathsetmacro{\wheelchart@innerdatasep}{\pgfkeysvalueof{/wheelchart/inner data sep}}% +\node[align=left,/wheelchart/inner data style@options] at (\WCdataangle:{\wheelchart@innerradius-(\wheelchart@innerdatasep)}) {\wheelchart@innerdata};% +} +\fi +\ifcsname wheelchart@wheeldata\endcsname +\wheelchart@ifnotext{\wheelchart@wheeldata}{}{% +\pgfmathsetmacro{\wheelchart@wheeldatapos}{\pgfkeysvalueof{/wheelchart/wheel data pos}}% +\node[align=left,/wheelchart/wheel data style@options] at (\WCdataangle:{\wheelchart@wheeldatapos*\wheelchart@outerradius+(1-\wheelchart@wheeldatapos)*\wheelchart@innerradius}) {\wheelchart@wheeldata};% +} +\fi +\ifcsname wheelchart@legendentry\endcsname +\wheelchart@legendentry +\fi +} +\ifcsname wheelchart@middle\endcsname +\wheelchart@ifnotext{\wheelchart@middle}{}{% +\node[align=center,/wheelchart/middle style@options] at (0,0) {\wheelchart@middle};% +} +\fi +\ifcsname wheelchart@legend\endcsname +\wheelchart@legend +\fi +\end{scope} +\ifcsname wheelchart@captionleft\endcsname +\wheelchart@ifnotext{\wheelchart@captionleft}{}{% +\node[anchor=north west,align=left,/wheelchart/caption left style@options] at ($(\wheelchart@name.south west)-(0,0.5)$) {\wheelchart@captionleft};% +} +\fi +\ifcsname wheelchart@caption\endcsname +\wheelchart@ifnotext{\wheelchart@caption}{}{% +\coordinate[shift/.expanded={\pgfkeysvalueof{/wheelchart/at}}] (wheelchart@center) at (0,0);% +\node[anchor=north,align=center,/wheelchart/caption style@options] at ($(\wheelchart@name.south-|wheelchart@center)-(0,0.5)$) {\wheelchart@caption};% +} +\fi +\ifcsname wheelchart@titleleft\endcsname +\wheelchart@ifnotext{\wheelchart@titleleft}{}{% +\node[anchor=south west,align=left,/wheelchart/title left style@options] at ($(\wheelchart@name.north west)+(0,0.5)$) {\wheelchart@titleleft};% +} +\fi +\ifcsname wheelchart@title\endcsname +\wheelchart@ifnotext{\wheelchart@title}{}{% +\coordinate[shift/.expanded={\pgfkeysvalueof{/wheelchart/at}}] (wheelchart@center) at (0,0);% +\node[anchor=south,align=center,/wheelchart/title style@options] at ($(\wheelchart@name.north-|wheelchart@center)+(0,0.5)$) {\wheelchart@title};% +} +\fi +}} +\endinput
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 32f4984c67d..b24e5aace44 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -865,7 +865,7 @@ my @TLP_working = qw( voss-mathcol vpe vruler vtable vwcol wadalab wallcalendar wallpaper warning warpcol - was wasy wasy-type1 wasysym webguide webquiz + was wasy wasy-type1 wasysym webguide webquiz wheelchart widetable widows-and-orphans williams willowtreebook windycity withargs witharrows wnri wnri-latex wordcount wordlike worldflags worksheet diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index 7f4fd93bfd0..181d861e646 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -231,6 +231,7 @@ depend tzplot depend utfsym depend venndiagram depend visualpstricks +depend wheelchart depend worldflags depend xistercian depend xpicture diff --git a/Master/tlpkg/tlpsrc/wheelchart.tlpsrc b/Master/tlpkg/tlpsrc/wheelchart.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/wheelchart.tlpsrc |