texlive[70518] branches/branch2023.final/Master/texmf-dist:

commits+karl at tug.org commits+karl at tug.org
Sat Mar 9 00:22:43 CET 2024


Revision: 70518
          https://tug.org/svn/texlive?view=revision&revision=70518
Author:   karl
Date:     2024-03-09 00:22:43 +0100 (Sat, 09 Mar 2024)
Log Message:
-----------
wheelchart (branch) (9mar24)

Modified Paths:
--------------
    branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/README.md
    branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf
    branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex
    branches/branch2023.final/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/README.md
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/README.md	2024-03-08 23:22:34 UTC (rev 70517)
+++ branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/README.md	2024-03-08 23:22:43 UTC (rev 70518)
@@ -1,13 +1,13 @@
 # `wheelchart`
 
-## Draw wheelcharts with Ti*k*Z
+## Diagrams with circular or other shapes using Ti*k*Z and LaTeX3
 
-Version 2.0 (2023/12/03)
+Version 3.0 (2024/03/08)
 
 This package is based on the package [Ti*k*Z](https://ctan.org/pkg/pgf) and can be used to draw various kinds of diagrams such as a bar chart, doughnut chart, infographic, pie chart, ring chart, square chart, sunburst chart, waffle chart and wheel chart with Ti*k*Z. It provides several options to customize the diagrams. It is also possible to specify a plot for the shape of the chart. Furthermore a legend can be added and the table of contents can be displayed as one of these diagrams.
 
 %% README.md
-%% Copyright 2023 Matthias Floré
+%% Copyright 2022-2024 Matthias Floré
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.pdf
===================================================================
(Binary files differ)

Modified: branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex
===================================================================
--- branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex	2024-03-08 23:22:34 UTC (rev 70517)
+++ branches/branch2023.final/Master/texmf-dist/doc/latex/wheelchart/wheelchart.tex	2024-03-08 23:22:43 UTC (rev 70518)
@@ -1,5 +1,5 @@
 %% wheelchart.tex
-%% Copyright 2023 Matthias Floré
+%% Copyright 2022-2024 Matthias Floré
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c
@@ -40,14 +40,14 @@
 \usepackage{tikzlings}
 \input{pgfmanual-en-macros.tex}
 %The environments commandmeta and commandmetameta and the macros \extractcommandmeta and \extractcommandmetameta below are modified from pgfmanual-en-macros.tex
-\newenvironment{commandmeta}[2]{
-  \begin{pgfmanualentry}
-    \extractcommandmeta#1#2\@@
-    \pgfmanualbody
+\newenvironment{commandmeta}[2]{%
+  \begin{pgfmanualentry}%
+    \extractcommandmeta#1#2\@@%
+    \pgfmanualbody%
+}%
+{%
+  \end{pgfmanualentry}%
 }
-{
-  \end{pgfmanualentry}
-}
 \def\extractcommandmeta#1#2\@@{%
   \removeats{#1}%
   \pgfmanualentryheadline{%
@@ -54,22 +54,22 @@
     \pgfmanualpdflabel{\textbackslash\strippedat\meta{#2}}{}%
     \declare{\expandafter\texttt\expandafter{\string#1\meta{#2}}}%
   }%
-  \index{\strippedat\meta{#2} @\protect\myprintocmmand{\strippedat\meta{#2}}}
+  \index{\strippedat\meta{#2} @\protect\myprintocmmand{\strippedat\meta{#2}}}%
 }
-\newenvironment{commandmetameta}[2]{
-  \begin{pgfmanualentry}
-    \extractcommandmetameta#1\@@#2\@@
-    \pgfmanualbody
+\newenvironment{commandmetameta}[2]{%
+  \begin{pgfmanualentry}%
+    \extractcommandmetameta#1\@@#2\@@%
+    \pgfmanualbody%
+}%
+{%
+  \end{pgfmanualentry}%
 }
-{
-  \end{pgfmanualentry}
-}
 \def\extractcommandmetameta#1\@@#2\@@{%
   \pgfmanualentryheadline{%
     \pgfmanualpdflabel{\textbackslash\meta{#1}\meta{#2}}{}%
     \declare{\expandafter\texttt\expandafter{\textbackslash\meta{#1}\meta{#2}}}%
   }%
-  \index{\meta{#1}\meta{#2} @\protect\myprintocmmand{\meta{#1}\meta{#2}}}
+  \index{\meta{#1}\meta{#2} @\protect\myprintocmmand{\meta{#1}\meta{#2}}}%
 }
 \usepackage{codehigh}
 \usepackage{fancyhdr}
@@ -80,25 +80,25 @@
 \fancyhead[L,R]{}
 \fancyhead[C]{\iftotalpages\ifnum\thepage<\getpagerefnumber{Usage}\else \begin{tikzpicture}
 \def\WCtotal{16.6}%21-<left=2.25cm>-<right=2.25cm>+2<gap polar=0.05>
-\def\WCarrow{0.8}
+\def\WCarrow{0.73}
 \pgfkeys{
-    /wheelchart,
-    data=,
-    gap polar=0.05
+  /wheelchart,
+  data=,
+  gap polar=0.05
 }
 \wheelchart[
-    etoc use name=wheelchart table of contents,
-    slices end arrow={\WCcount==\WCtotalcount?0:\WCarrow}{0},
-    slices start arrow={\WCcount==1?0:-\WCarrow}{0},
-    slices style={MidnightBlue!\fpeval{\thepage<\WCetocthepage||\thepage>=\WCetocthepage+\WCetocthenumberofpages?20:50}},
-    value=\WCetocthenumberofpages,
-    xbar={\WCtotal}{0.4}
+  etoc use name=wheelchart table of contents,
+  slices end arrow={\WCcount==\WCtotalcount?0:\WCarrow}{0},
+  slices start arrow={\WCcount==1?0:-\WCarrow}{0},
+  slices style={MidnightBlue!\fpeval{\thepage<\WCetocthepage||\thepage>=\WCetocthepage+\WCetocthenumberofpages?20:50}},
+  value=\WCetocthenumberofpages,
+  xbar={\WCtotal}{0.4}
 ]{}
 \wheelchart[
-    at={({(\thepage -\getpagerefnumber{Usage})*\WCtotal/(\getpagerefnumber{Thesourcecode}-\getpagerefnumber{Usage})},0)},
-    slices end arrow={\thepage==\getpagerefnumber{Thesourcecode}-1?0:\WCarrow}{0},
-    slices start arrow={\thepage==\getpagerefnumber{Usage}?0:-\WCarrow}{0},
-    xbar={\WCtotal/(\getpagerefnumber{Thesourcecode}-\getpagerefnumber{Usage})}{0.4}
+  at={({(\thepage -\getpagerefnumber{Usage})*\WCtotal/(\getpagerefnumber{Thesourcecode}-\getpagerefnumber{Usage})},0)},
+  slices end arrow={\thepage==\getpagerefnumber{Thesourcecode}-1?0:\WCarrow}{0},
+  slices start arrow={\thepage==\getpagerefnumber{Usage}?0:-\WCarrow}{0},
+  xbar={\WCtotal/(\getpagerefnumber{Thesourcecode}-\getpagerefnumber{Usage})}{0.4}
 ]{1/PineGreen/}
 \end{tikzpicture}\fi\fi}
 \fancyfoot[C]{\ifdefined\fancyfootdefaultbox\begin{tikzpicture}[scale=0.15]
@@ -105,21 +105,21 @@
 \useasboundingbox (-3,-3) rectangle (3,3);
 \node[inner sep=0pt] {\usebox{\fancyfootdefaultbox}};%reusing the box compiles faster
 %\wheelchart[
-%    gap,
-%    middle=\thepage,
-%    slices style=Gray,
-%    slices style{\thepage}=Cyan,
-%    %slices style={
-%    %    /utils/exec={\pgfmathsetmacro{\WCcolor}{\thepage==\WCcount?"Cyan":"Gray"}},
-%    %    \WCcolor
-%    %},
-%    total count=\getpagerefnumber{Thesourcecode}-1%\totalpages
+%  gap,
+%  middle=\thepage,
+%  slices style=Gray,
+%  slices style{\thepage}=Cyan,
+%  %slices style={
+%  %  /utils/exec={\pgfmathsetmacro{\WCcolor}{\thepage==\WCcount?"Cyan":"Gray"}},
+%  %  \WCcolor
+%  %},
+%  total count=\getpagerefnumber{Thesourcecode}-1%\totalpages
 %]{}
 \wheelchart[
-    gap,
-    middle=\thepage,
-    start angle={90-(\thepage-1)*(360/(\getpagerefnumber{Thesourcecode}-1))},%\totalpages
-    total angle={360/(\getpagerefnumber{Thesourcecode}-1)},%\totalpages
+  gap,
+  middle=\thepage,
+  start angle={90-(\thepage-1)*(360/(\getpagerefnumber{Thesourcecode}-1))},%\totalpages
+  total angle={360/(\getpagerefnumber{Thesourcecode}-1)},%\totalpages
 ]{1/Cyan/}
 \end{tikzpicture}\fi}
 \usepackage{etoc}
@@ -132,12 +132,12 @@
 %\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}}
+\hypersetup{pdftitle={The wheelchart package},pdfauthor={Matthias Floré},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 2.0 (2023/12/03)}%\\[12pt]
+\title{The \texttt{wheelchart} package\\[12pt]\large Diagrams with circular or other shapes using \tikzname{} and \LaTeX3}
+\author{Matthias Floré}
+\date{Version 3.0 (2024/03/08)}%\\[12pt]
 \begin{document}
 \iftotalpages%
 \newsavebox{\fancyfootdefaultbox}%
@@ -145,9 +145,9 @@
 \begin{tikzpicture}[scale=0.15]
 \useasboundingbox (-3,-3) rectangle (3,3);
 \wheelchart[
-    gap,
-    slices style=Gray,
-    total count=\getpagerefnumber{Thesourcecode}-1%\totalpages
+  gap,
+  slices style=Gray,
+  total count=\getpagerefnumber{Thesourcecode}-1%\totalpages
 ]{}
 \end{tikzpicture}%note the % to avoid extra space
 \end{lrbox}%
@@ -155,7 +155,7 @@
 \maketitle
 \thispagestyle{fancy}
 \begin{abstract}
-\noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw various kinds of diagrams such as a bar chart, doughnut chart, infographic, pie chart, ring chart, square chart, sunburst chart, waffle chart and wheel chart with \tikzname. It provides several options to customize the diagrams. It is also possible to specify a plot for the shape of the chart. Furthermore a legend can be added and the table of contents can be displayed as one of these diagrams. Other tools for creating wheelcharts or pie charts can be found in \cite{MpMP}, \cite{JhcIparowcltopotPGFm}, \cite{Tumfdb}, \cite{XdPCbupp} and \cite{RSVpaaMfp}.% This is the manual for version .
+\noindent This package is based on the package |tikz| (see \cite{TtTaPGFp}) and can be used to draw various kinds of diagrams such as a bar chart, doughnut chart, infographic, pie chart, ring chart, square chart, sunburst chart, waffle chart and wheel chart with \tikzname. It provides several options to customize the diagrams. It is also possible to specify a plot for the shape of the chart. Furthermore a legend can be added and the table of contents can be displayed as one of these diagrams. Other tools for creating wheel charts or pie charts can be found in \cite{MpMP}, \cite{JhcIparowcltopotPGFm}, \cite{Tumfdb}, \cite{XdPCbupp} and \cite{RSVpaaMfp}.% This is the manual for version .
 \end{abstract}
 \section*{\contentsname}
 \iftotalpages
@@ -168,59 +168,59 @@
 \usepackage[linktoc=all]{hyperref}}]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    for loop start={\colorlet{WCcolor}{MidnightBlue!\fpeval{(\WCcount/\WCtotalcount)*100}}},
-    gap,
-    start angle=0,
-    value=\WCetocthenumberofpages
+  /wheelchart,
+  for loop start={\colorlet{WCcolor}{MidnightBlue!\fpeval{(\WCcount/\WCtotalcount)*100}}},
+  gap,
+  start angle=0,
+  value=\WCetocthenumberofpages
 }
 \wheelchart[
-    after slices={
-        \pgfdeclareradialshading{WCshading}{\pgfpoint{0cm}{0cm}}{
-            color(0bp)=(WCcolor);
-            color(16.66666bp)=(WCcolor);%2/3 * 25bp
-            color(20.83333bp)=(WCcolor!10);%2.5/3 * 25bp
-            color(25bp)=(WCcolor);
-            color(50bp)=(WCcolor)
-        }
-        \shade[even odd rule,shading=WCshading] (0,0) circle[radius=3] circle[radius=2];
-    },
-    data=,
-    etoc count total pages=\getpagerefnumber{Thesourcecode}-1,%\totalpages
-    etoc level=section,
-    etoc name=wheelchart table of contents,
-    slices style={
-        fill=none,
-        clip
+  after slices={
+    \pgfdeclareradialshading{WCshading}{\pgfpoint{0cm}{0cm}}{
+      color(0bp)=(WCcolor);
+      color(16.66666bp)=(WCcolor);%2/3 * 25bp
+      color(20.83333bp)=(WCcolor!10);%2.5/3 * 25bp
+      color(25bp)=(WCcolor);
+      color(50bp)=(WCcolor)
     }
+    \shade[even odd rule,shading=WCshading] (0,0) circle[radius=3] circle[radius=2];
+  },
+  data=,
+  etoc count total pages=\getpagerefnumber{Thesourcecode}-1,%\totalpages
+  etoc level=section,
+  etoc name=wheelchart table of contents,
+  slices style={
+    fill=none,
+    clip
+  }
 ]{}
 \hypersetup{linkcolor=.}
 \wheelchart[
-    anchor ysep{7,8}=30,
-    data={%
-        \textcolor{WCcolor}{%
-        \textbf{\Large\ifdefempty{\WCetocthenumber}{}{\WCetocthelinkednumber{} }\WCetocthelinkedname}}\\%
-        \textcolor{PineGreen}{page \WCetocthelinkedpage}%
+  anchor ysep{7,8}=30,
+  data={%
+    \textcolor{WCcolor}{%
+    \textbf{\Large\ifdefempty{\WCetocthenumber}{}{\WCetocthelinkednumber{} }\WCetocthelinkedname}}\\%
+    \textcolor{PineGreen}{page \WCetocthelinkedpage}%
+  },
+  etoc use name=wheelchart table of contents,
+  lines,
+  lines style=PineGreen,
+  middle={\LARGE The\\[10pt]\huge\texttt{wheelchart}\\[10pt]\LARGE package},
+  slice{\getrefnumber{Keys}}={
+    arc={
+      draw=PineGreen,
+      ->
     },
-    etoc use name=wheelchart table of contents,
-    lines,
-    lines style=PineGreen,
-    middle={\LARGE The\\[10pt]\huge\texttt{wheelchart}\\[10pt]\LARGE package},
-    slice{\getrefnumber{Keys}}={
-        arc={
-            draw=PineGreen,
-            ->
-        },
-        arc around text,
-        arc data=~Options for customization~,
-        arc data style={text color=PineGreen},
-        lines sep=0.5
-    },
-    slices style={
-        fill=none,
-        draw=PineGreen,
-        ultra thick
-    }
+    arc around text,
+    arc data=~Options for customization~,
+    arc data style={text color=PineGreen},
+    lines sep=0.5
+  },
+  slices style={
+    fill=none,
+    draw=PineGreen,
+    ultra thick
+  }
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -259,6 +259,73 @@
 \end{command}
 \newpage%such that this section has its own block in the header
 \section{Additional macros}
+\begin{command}{\WCangle\opt{\oarg{number}}\marg{angle pos}\marg{angle shift}\marg{pos}\marg{sep}}
+This command gives the angle in degrees of the point which is constructed as follows.
+\begin{enumerate}
+\item Consider the inner start angle and the inner end angle of slice \meta{number}. This \meta{number} is computed modulo the total number of slices. Form the convex combination of these two angles with parameter \meta{angle pos}. Then add \meta{angle shift}. Then consider the point with this angle and as radius the inner radius.
+\item Consider the similar point constructed with the outer start angle, the outer end angle and the outer radius of slice \meta{number}. Then construct the straight line between those two points.
+\item Consider the radius given by the command |\WCradius| with arguments \meta{number}, \meta{pos} and \meta{sep}.
+\item Consider the intersection of the previous line and the arc with the previous radius. The command |\WCangle| gives the angle in degrees of this point.
+\end{enumerate}
+The default value for \meta{number} is |\WCcount|.
+
+The command |\WCangle| can be used in the \meta{options} of the command |\wheelchart|. It can also be used after the command |\wheelchart|. In that case, the computed angles will correspond to the last |\wheelchart|.
+
+The command |\WCangle| should not be used with a plot.
+\begin{codeexample}[preamble={\usepackage{siunitx}}]
+\begin{tikzpicture}
+\sisetup{round-mode=places,round-precision=2}
+\wheelchart[
+  counterclockwise,
+  data=slice \WCcount\\
+    inner start angle: \ang{\WCangle{0}{0}{0}{0}}\\
+    inner end angle: \ang{\WCangle{1}{0}{0}{0}}\\
+    outer start angle: \ang{\WCangle{0}{0}{1}{0}}\\
+    outer end angle: \ang{\WCangle{1}{0}{1}{0}}\\
+    inner radius: \WCradius{0}{0}\\
+    outer radius: \WCradius{1}{0},
+  gap=0.2,
+  inner radius{list}={2.2,2,1.8},
+  legend entry={
+    \fill[Dandelion] (\WCcoordinate[\WCcount +1]{inner start}) circle[radius=4pt];
+    \fill[RubineRed] (\WCcoordinate{inner end}) circle[radius=4pt];
+    \fill[YellowGreen] (\WCcoordinate[\WCcount +1]{outer start}) circle[radius=4pt];
+    \fill[RoyalPurple] (\WCcoordinate{outer end}) circle[radius=4pt];
+    \draw[->,dashed] (\WCpoint[\WCcount -1]{0.6}{0}{0.5}{0})--(\WCpoint{0.4}{0}{0.5}{0});
+    \draw[dashed] (\WCcoordinate{inner end})
+      --(\WCpoint{1}{0}{1}{\WClistsep}) coordinate (A);
+    \draw[dashed] (\WCcoordinate[\WCcount +1]{inner start})
+      --(\WCpoint[\WCcount +1]{0}{0}{1}{1}) coordinate (B);
+    \draw[<->] (A)--(B) node[\WClistpos,midway] {gap};
+  },
+  outer radius{list}={2.8,3,3.2},
+  slices style{list}={Gray!25,Gray!50,Gray!75},
+  start angle=0,
+  total count=3,
+  WClistpos={above left,below left,right},
+  WClistsep={1.2,1.2,0.6}
+]{}
+\node[align=left] (N) at (-1.5,-6.5) {%
+  The outer end angle of slice 2 is \ang{\WCangle[2]{1}{0}{1}{0}}.\\
+  The outer radius of slice 3 is \WCradius[3]{1}{0}.%
+};
+\draw[->] (\WCcoordinate[2]{outer end})--(N) node[left,pos=0.7,align=left]
+  {These can be referenced\\after the command \textbackslash wheelchart};
+\draw[->] (\WCpoint[3]{0.2}{0}{1}{0})--(N);
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+\begin{command}{\WCcoordinate\opt{\oarg{number}}\marg{name}}
+\begin{itemize}
+\item If the key |discrete| is false then this command gives the coordinate positioned at \meta{name} of slice \meta{number}. The \meta{name} can be |inner end|, |inner start|, |outer end| or |outer start|.
+\item If the key |discrete| is true then this command gives the coordinate positioned at point \meta{name} of slice \meta{number}. The \meta{name} can be an integer from 1 till the number of points of slice \meta{number}.
+\end{itemize}
+The \meta{number} is computed modulo the total number of slices.
+
+The default value for \meta{number} is |\WCcount|.
+
+The command |\WCcoordinate| can be used in the \meta{options} of the command |\wheelchart|. It can also be used after the command |\wheelchart|. In that case, the coordinate will correspond to the last |\wheelchart|.
+\end{command}
 \begin{command}{\WCcount}
 This macro gives the current number of the slice in the \meta{wheelchart data}.
 \end{command}
@@ -266,7 +333,7 @@
 If the key |discrete| is true then this macro gives the current number of the \tikzname{} pic from the key |discrete pic|.
 \end{command}
 \begin{command}{\WCdataangle}
-This macro is similar to |\WCmidangle| but also takes into account the keys |data angle pos|, |data angle shift| and |data sep| (with respect to the key |counterclockwise|).
+This macro is similar to |\WCmidangle| but also takes into account the keys |data angle pos|, |data angle shift|, |data pos| and |data sep| (with respect to the key |counterclockwise|).
 \end{command}
 \begin{command}{\WCetocthelinkedname}
 \end{command}
@@ -291,24 +358,22 @@
 \end{commandmeta}
 \begin{command}{\WCmidangle}
 This macro gives the angle in degrees modulo $360$ of the middle of the current slice.
-\begin{codeexample}[width=10cm]
+\begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \wheelchart[
-    data angle shift=\WCvarG,
-    data style={
-        rotate=\WCdataangle,
-        draw=Magenta,
-        fill=GreenYellow,
-        anchor=west,
-        text=Gray
-    },
-    inner data={%
-        \textbackslash WCmidangle%
-    },
-    inner data style={
-        rotate=\WCmidangle,
-        font=\ttfamily
-    }
+  data angle shift=\WCvarG,
+  data style={
+    rotate=\WCdataangle,
+    draw=Magenta,
+    fill=GreenYellow,
+    anchor=west,
+    text=Gray
+  },
+  inner data=\ang{\WCmidangle},
+  inner data style={
+    rotate=\WCmidangle,
+    font=\ttfamily
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -316,14 +381,18 @@
 \begin{command}{\WCperc}
 This macro displays |\WCpercentagerounded| 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|.
+If the package |siunitx| is loaded then the following code is used outside the key |arc data|. The package |siunitx| can be loaded before or after the package |wheelchart|.
 \begin{codeexample}[code only]
 \qty{\WCpercentagerounded}{\percent}
 \end{codeexample}
-If the package |siunitx| is not loaded then the following code is used.
+If the package |siunitx| is not loaded then the following code is used outside the key |arc data|.
 \begin{codeexample}[code only]
 \WCpercentagerounded\,\%
 \end{codeexample}
+Inside the key |arc data|, 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.
@@ -330,10 +399,10 @@
 \begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \wheelchart[
-    data=\WCvarC\\\WCperc,
-    slices style={
-        \WCvarB!\fpeval{4*\WCpercentage}
-    }
+  data=\WCvarC\\\WCperc,
+  slices style={
+    \WCvarB!\fpeval{4*\WCpercentage}
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -341,6 +410,28 @@
 \begin{command}{\WCpercentagerounded}
 This macro displays |\WCpercentage| rounded up to the number of decimals determined by the key |perc precision|.
 \end{command}
+\begin{command}{\WCpoint\opt{\oarg{number}}\marg{angle pos}\marg{angle shift}\marg{pos}\marg{sep}}
+This command gives the point where the angle is determined by |\WCangle| and the radius by |\WCradius| computed with the given arguments.
+
+The \meta{number} is computed modulo the total number of slices.
+
+The default value for \meta{number} is |\WCcount|.
+
+The command |\WCpoint| can be used in the \meta{options} of the command |\wheelchart|. It can also be used after the command |\wheelchart|. In that case, the point will correspond to the last |\wheelchart|.
+
+The command |\WCpoint| should not be used with a plot.
+\end{command}
+\begin{command}{\WCradius\opt{\oarg{number}}\marg{pos}\marg{sep}}
+This command gives the convex combination with parameter \meta{pos} of the inner radius of slice \meta{number} minus \meta{sep} and the outer radius of slice \meta{number} plus \meta{sep}.
+
+The \meta{number} is computed modulo the total number of slices.
+
+The default value for \meta{number} is |\WCcount|.
+
+The command |\WCradius| can be used in the \meta{options} of the command |\wheelchart|. It can also be used after the command |\wheelchart|. In that case, the computed radius will correspond to the last |\wheelchart|.
+
+The command |\WCradius| should not be used with a plot.
+\end{command}
 \begin{command}{\WCtotalcount}
 This macro gives the total number of slices.
 \end{command}
@@ -349,12 +440,12 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=\WCvarC: \WCvarA,
-    middle={%
-        \textbf{\huge Fruit}\\%
-        \WCtotalcount{} species\\%
-        \WCtotalnum{} pieces%
-    }
+  data=\WCvarC: \WCvarA,
+  middle={%
+    \textbf{\huge Fruit}\\%
+    \WCtotalcount{} species\\%
+    \WCtotalnum{} pieces%
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -366,9 +457,9 @@
 \begin{command}{\WCvarC}
 \end{command}
 \begin{commandmetameta}{prefix}{name}
-The \meta{wheelchart data} in the command |\wheelchart| is a list in which the items are separated by the value of the key |separator rows|. Each item in this list corresponds to one slice of the wheelchart and consists of data separated by the value of the key |separator columns|. The number of such data needs to be the same for each slice. With the initial settings, these individual data are interpreted as the macros |\WCvarA|, |\WCvarB|, |\WCvarC|, \dots, |\WCvarZ|, |\WCvarAA| and so on and can be accessed within the \meta{options} of the command |\wheelchart| if applicable.
+The \meta{wheelchart data} in the command |\wheelchart| is a list in which the items are separated by the value of the key |separator rows|. Each item in this list corresponds to one slice of the wheelchart and consists of data separated by the value of the key |separator columns|. With the initial settings, these individual data are interpreted as the macros |\WCvarA|, |\WCvarB|, |\WCvarC|, \dots, |\WCvarZ|, |\WCvarAA| and so on and can be accessed within the \meta{options} of the command |\wheelchart| if applicable.
 
-The name of these macros can be specified with \meta{prefix} and \meta{name} which are determined by respectively the keys |header prefix| and |header|.
+The names of these macros can be specified with \meta{prefix} and \meta{name} which are determined by respectively the keys |header prefix| and |header|.
 
 Initially, only |\WCvarA|, |\WCvarB| and |\WCvarC| are used for |value=\WCvarA|, |slices style=\WCvarB| and |data=\WCvarC|.
 
@@ -376,25 +467,25 @@
 \begin{codeexample}[width=10cm,preamble={\usetikzlibrary{patterns}}]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    gap,
-    header={value,color,text,vitamins,pattern,explode,data angle shift,border},
-    header prefix=my,
-    value=1
+  /wheelchart,
+  gap,
+  header={value,color,text,vitamins,pattern,explode,data angle shift,border},
+  header prefix=my,
+  value=1
 }
 \wheelchart[
-    data=,
-    radius={0.5}{3},
-    slices style={\mycolor!70,draw=\myborder,ultra thick,pattern=\mypattern,pattern color=\mycolor!70},
-    wheel data=\mytext,
-    %wheel data style={shift={(\WCmidangle:0.5)}},
-    %wheel data pos=0.5
+  data=,
+  radius={0.5}{3},
+  slices style={\mycolor!70,draw=\myborder,ultra thick,pattern=\mypattern,pattern color=\mycolor!70},
+  wheel data=\mytext,
+  %wheel data style={shift={(\WCmidangle:0.5)}},
+  %wheel data pos=0.5
 ]{\exampleforthismanual}
 \wheelchart[
-    data={\textcolor{\mycolor}{Vitamins}\\\myvitamins},
-    radius={3.1}{4},
-    slices arrow={1}{0.2},
-    slices style=\mycolor
+  data=\textcolor{\mycolor}{Vitamins}\\\myvitamins,
+  radius={3.1}{4},
+  slices arrow={1}{0.2},
+  slices style=\mycolor
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -406,20 +497,20 @@
 
 Furthermore, it is possible to add |{list}| after the \meta{key name}. Then a list can be given to the key. This list is processed analogously as how the key |WClist|\meta{name} works. Then the result is given to the key.
 
-We give some examples for the options \meta{range} and |{list}| below.
+Below are some examples for the options \meta{range} and |{list}|.
 \begin{itemize}
 \item The following wheelchart can be obtained with the 3 possibilities below.
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data{list}={
-        An,example,where,some,of,the,
-        keys,are,given,using,a,list
-    },
-    slices style{list}={
-        Thistle,Orchid,Fuchsia
-    },
-    total count=12
+  data{list}={
+    An,example,where,some,of,the,
+    keys,are,given,using,a,list
+  },
+  slices style{list}={
+    Thistle,Orchid,Fuchsia
+  },
+  total count=12
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -432,8 +523,8 @@
 data={\WCdata[\WCcount]},
 
 slices style={
-    /utils/exec={\pgfmathsetmacro{\WCcolornumber}{int(Mod({\WCcount-1},\WCcolorslen)+1)}},
-    \WCcolors[\WCcolornumber]
+  /utils/exec={\pgfmathsetmacro{\WCcolornumber}{int(Mod({\WCcount-1},\WCcolorslen)+1)}},
+  \WCcolors[\WCcolornumber]
 },
 
 total count=\WCdatalen,
@@ -447,8 +538,8 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    explode=\WCvarF,
-    pie
+  explode=\WCvarF,
+  pie
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -492,34 +583,34 @@
 \begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \wheelchart[
-    anchor xsep=10,
-    anchor ysep=15,
-    data=\WCvarA,
-    data angle pos=\WClistdap,
-    inner data=\ang{\WClistvalue},
-    inner data angle pos=\WClistdap,
-    inner data sep=0.3,
-    lines=0.5,
-    lines angle pos=\WClistdap,
-    slices style{list}={
-        Maroon,SeaGreen,Maroon
-    },
-    value=\WClistvalue,
-    WClistdap={0.9,0.5,0.1},
-    WClistvalue={10,65,15,15,65,10}
+  anchor xsep=10,
+  anchor ysep=15,
+  data=\WCvarA,
+  data angle pos=\WClistdap,
+  inner data=\ang{\WClistvalue},
+  inner data angle pos=\WClistdap,
+  inner data sep=0.3,
+  lines=0.5,
+  lines angle pos=\WClistdap,
+  slices style{list}={
+    Maroon,SeaGreen,Maroon
+  },
+  value=\WClistvalue,
+  WClistdap={0.9,0.5,0.1},
+  WClistvalue={10,65,15,15,65,10}
 ]{%
-    south,
-    south west,
-    west,
-    west,
-    north west,
-    north,
-    north,
-    north east,
-    east,
-    east,
-    south east,
-    south%
+  south,
+  south west,
+  west,
+  west,
+  north west,
+  north,
+  north,
+  north east,
+  east,
+  east,
+  south east,
+  south%
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -526,15 +617,20 @@
 The anchor of the key |data| can also be specified manually by using |data style={anchor=|\meta{anchor}|}|.
 \end{key}
 \begin{stylekey}{/wheelchart/arc=\marg{options} (initially \normalfont empty)}
-If this key is set then an arc with the style determined by this key will be drawn following the plot for a slice of the wheelchart.
+If this key is set then an arc with the style determined by this key will be drawn following the arc or plot for a slice of the wheelchart.
 \end{stylekey}
+\begin{key}{/wheelchart/arc around line=\marg{number} (initially 1)}
+The contents of the key |arc data| can consist of multiple lines separated by |\\|. If the key |arc around text| is true then the corresponding line is determined by \meta{number}.
+\end{key}
 \begin{key}{/wheelchart/arc around text=\opt{\meta{boolean}} (default true, initially false)}
-If true then the arc with the style determined by the key |arc| will be split in two parts such that the gap between these two parts leaves space for the contents of the key |arc data|. The space between the arc and the contents of the key |arc data| can be increased with for example |~| in |arc data=~text~|.
+If true then the arc with the style determined by the key |arc| will be split in two parts such that the gap between these two parts leaves space for the contents of line \meta{number} of the key |arc data| where \meta{number} is determined by the key |arc around line|. The space between the arc and the contents of the key |arc data| can be increased with for example |~| in |arc data=~text~|.
 \end{key}
 \begin{key}{/wheelchart/arc data=\marg{text} (initially \normalfont empty)}
-This key contains the \meta{text} which will be placed following the plot for a slice of the wheelchart using the decoration |text along path|. This requires the \tikzname{} library |decorations.text|. The style of this decoration is given as follows. First, the option |raise=-0.5ex| is given. Then |text align| is determined by the key |arc data align|. Thereafter, the style of the key |arc data style| is added.
+This key contains the \meta{text} which will be placed following the arc or plot for a slice of the wheelchart using the decoration |text along path|. This requires the \tikzname{} library |decorations.text|. The style of this decoration is given as follows. First, the option |raise=-0.5ex| is given. Then |text align| is determined by the key |arc data align|. Thereafter, the style of the key |arc data style| is added.
 
-Note that for example |\WCpercentage| follows the arc but |\WCperc| does not. Braces are required around some macros and for example |arc data={{{{\WCperc}}}}| requires 4 pairs of braces.
+The \meta{text} can consist of multiple lines separated by |\\|.
+
+Braces or multiple pairs of braces are required around some macros.
 \end{key}
 \begin{key}{/wheelchart/arc data align=\mchoice{center,left,right} (initially center)}
 This key determines the alignment of the contents of the key |arc data|.
@@ -545,8 +641,35 @@
 These keys determine the position of the contents of the key |arc data| similar as the corresponding keys for the key |data|.
 \end{key}
 \begin{key}{/wheelchart/arc data dir=\marg{value} (initially 1)}
-This key determines the direction of the contents of the key |arc data|. If the \meta{value} is positive then the direction is the same as the direction of the slice. If the \meta{value} is negative then the direction is reversed. The values |1| and |-1| are recommended. When the contents of the key |arc data| is placed, the corresponding domain for the plot is estimated. A warning is given when the contents of the key |arc data| did (possibly) not fit. In this case, the absolute value of the key |arc data dir| should be increased.
+This key determines the direction of the contents of the key |arc data|. If the \meta{value} is positive then the direction is the same as the direction of the slice. If the \meta{value} is negative then the direction is reversed. The values |1| and |-1| are recommended.
+
+When the contents of the key |arc data| is placed, the corresponding domain for the arc or plot is estimated. A warning is given when the contents of the key |arc data| did (possibly) not fit. In this case, the absolute value of the key |arc data dir| should be increased.
+
+If an error |Dimension too large| occurs then the absolute value of the key |arc data dir| should be increased or decreased depending on the situation.
 \end{key}
+\begin{key}{/wheelchart/arc data expand=\marg{expansion type} (initially n)}
+The contents of the key |arc data| can consist of multiple lines separated by |\\|. This splitting is done with |\seq_set_split:Nnn| or a variant thereof depending on the \meta{expansion type} which determines the last letter in the signature. For most use cases, this \meta{expansion type} is |n|, |e| or |f|.
+
+In the example below, it is necessary to use |arc data expand=e| and to place |\noexpand| before |\bfseries|.
+\catcode`|=12%
+\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{decorations.text}}]
+\begin{tikzpicture}
+\wheelchart[
+  arc data=|\noexpand\bfseries|\WCvarC\\
+    \WCvarD,
+  arc data expand=e,
+  arc data pos=0.5,
+  data=,
+  start angle=135,
+  total angle=90
+]{1/VioletRed/bold text/two\\lines}
+\end{tikzpicture}
+\end{codeexample}
+\catcode`|=13%
+\end{key}
+\begin{key}{/wheelchart/arc data line sep factor=\marg{factor} (initially 1)}
+The contents of the key |arc data| can consist of multiple lines separated by |\\|. The \meta{factor} determines the spacing between these lines.
+\end{key}
 \begin{key}{/wheelchart/arc data pos=\marg{value} (initially 1)}
 \end{key}
 \begin{key}{/wheelchart/arc data sep=\marg{value} (initially 1ex/1cm)}
@@ -569,20 +692,23 @@
 \begin{codeexample}[width=10cm,preamble={\usetikzlibrary{decorations.text}}]
 \begin{tikzpicture}
 \wheelchart[
-    arc=\WCvarB,
-    arc around text,
-    arc data=~\WCvarC~,
-    arc data dir={\WCmidangle<180?1:-1},
-    arc data pos=1.2,
-    arc data style={text color=\WCvarB},
-    arc first half=dashed,
-    arc pos=1.2,
-    arc second half=->,
-    data=,
-    value=width("\WCvarC")
+  arc=\WCvarB,
+  arc around line=2,
+  arc around text,
+  arc data=slice \WCcount\\
+    {~}\WCvarC{~}\\
+    \WCperc,
+  arc data dir={\WCmidangle<180?1:-1},
+  arc data expand=f,
+  arc data pos=1.3,
+  arc data style={text color=\WCvarB},
+  arc first half=dashed,
+  arc pos=1.3,
+  arc second half=->,
+  data={}
 ]{\exampleforthismanual}
 \useasboundingbox (0,0)
-    circle[radius=4];
+  circle[radius=4.3];
 \end{tikzpicture}
 \end{codeexample}
 \end{key}
@@ -612,33 +738,33 @@
 \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}
+  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%
+  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};
+  \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. This key does \emph{not} apply if a plot is used.
+If this key is set then a contour with the style determined by this key will be drawn around the wheelchart. This requires a fixed inner and outer radius for all slices. This key does \emph{not} apply if a plot is used.
 \end{stylekey}
 \begin{key}{/wheelchart/counterclockwise=\opt{\meta{boolean}} (default true, initially false)}
 If true, the wheelchart will be drawn counterclockwise instead of clockwise.
@@ -653,7 +779,9 @@
 \begin{key}{/wheelchart/data pos=\marg{value} (initially 1)}
 \end{key}
 \begin{key}{/wheelchart/data sep=\marg{value} (initially 0.2)}
-The position of the contents of the key |data| is determined as follows.
+If no plot is used then the position of the contents of the key |data| is determined as described for the commands |\WCangle| and |\WCradius|.
+
+If a plot is used then the position of the contents of the key |data| is determined as follows.
 \begin{enumerate}
 \item The inner plot is evaluated in the point with as angle the convex combination with as parameter the key |data angle pos| of the inner start angle and the inner end angle, added with the key |data angle shift| in degrees (taking into account the key |counterclockwise|) and as radius the inner radius minus the key |data sep|.
 \item The outer plot is evaluated in the similar point but using the outer start angle, the outer end angle and the outer radius plus the key |data sep|.
@@ -663,32 +791,32 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \wheelchart[
-    data angle pos{2}=0.3,
-    data angle pos{6}=0.8,
-    data angle shift{3}=-0.1,
-    data angle shift{5}=0.1,
-    data pos=\WClistB,
-    data sep=0,
-    lines{1,2,4,6,7}=0.5,
-    lines{3,5}=1,
-    lines angle pos{1}=0.8,
-    lines angle shift{7}=-0.2,
-    lines ext=\WClistA,
-    lines ext dir{1,...,3}=left,
-    lines ext dir{4,...,7}=right,
-    lines ext fixed,
-    lines ext fixed left=-1,
-    lines ext fixed right=7,
-    lines pos=\WClistB,
-    lines sep=0.2*\WClistA,
-    xbar={6}{1.5},
-    WClistA={1,0},
-    WClistB={0,1},
-    wheel data=\WCperc,
-    wheel data pos=0.5,
-    wheel data pos{1}=1,
-    wheel data pos{4}=0,
-    wheel data sep=0.2
+  data angle pos{2}=0.3,
+  data angle pos{6}=0.8,
+  data angle shift{3}=-0.1,
+  data angle shift{5}=0.1,
+  data pos=\WClistB,
+  data sep=0,
+  lines{1,2,4,6,7}=0.5,
+  lines{3,5}=1,
+  lines angle pos{1}=0.8,
+  lines angle shift{7}=-0.2,
+  lines ext=\WClistA,
+  lines ext dir{1,...,3}=left,
+  lines ext dir{4,...,7}=right,
+  lines ext fixed,
+  lines ext fixed left=-1,
+  lines ext fixed right=7,
+  lines pos=\WClistB,
+  lines sep=0.2*\WClistA,
+  xbar={6}{1.5},
+  WClistA={1,0},
+  WClistB={0,1},
+  wheel data=\WCperc,
+  wheel data pos=0.5,
+  wheel data pos{1}=1,
+  wheel data pos{4}=0,
+  wheel data sep=0.2
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -711,30 +839,31 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    data=,
-    discrete,
-    discrete pic={\fill (0,0) circle[radius=3pt];},
-    discrete space at borders=false,
-    middle style={font=\ttfamily},
-    start angle=180,
-    total angle=180,
-    value=\WCvarA/2
+  /wheelchart,
+  discrete,
+  discrete pic={\fill (0,0) circle[radius=3pt];},
+  discrete space at borders=false,
+  middle style={font=\ttfamily},
+  start angle=180,
+  total angle=180,
+  value=\WCvarA/2
 }
 \foreach\angle in {0,...,27}{
-    \draw ({180*(\angle/27)}:2)--({180*(\angle/27)}:3);
+  \draw ({180*(\angle/27)}:2)--({180*(\angle/27)}:3);
 }
 \wheelchart[
-    discrete partitioning=angle,
-    middle={discrete\\partitioning=angle}
+  discrete partitioning=angle,
+  middle={discrete\\partitioning=angle}
 ]{\exampleforthismanual}
+\draw[->] (\WCcoordinate[6]{16})--++(5:2) node[right] {point 16 of slice 6};
 \foreach\radius in {0,...,3}{
-    \draw ({9+\radius/3},0) arc[start angle=0,end angle=180,radius={2+\radius/3}];
+  \draw ({2+\radius/3},-5) arc[start angle=0,end angle=180,radius={2+\radius/3}];
 }
 \wheelchart[
-    at={(7,0)},
-    middle={discrete\\partitioning=radius}
+  at={(0,-5)},
+  middle={discrete\\partitioning=radius}
 ]{\exampleforthismanual}
+\draw[->] (\WCcoordinate[7]{21})--++(5:2) node[right] {point 21 of slice 7};
 \end{tikzpicture}
 \end{codeexample}
 \end{key}
@@ -743,17 +872,17 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[yscale=-1]
 \wheelchart[
-    data=,
-    discrete,
-    discrete pic={
-        \fill[draw=black] (-0.3,-0.3)
-            rectangle +(0.6,0.6);
-        \node[black] at (0,0)
-            {\WCcountdiscrete};
-    },
-    discrete space at borders,
-    value=\WCvarA/2,
-    ybar={8}{8}
+  data=,
+  discrete,
+  discrete pic={
+    \fill[draw=black] (-0.3,-0.3)
+      rectangle +(0.6,0.6);
+    \node[black] at (0,0)
+      {\WCcountdiscrete};
+  },
+  discrete space at borders,
+  value=\WCvarA/2,
+  ybar={8}{8}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -767,26 +896,26 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    data=,
-    discrete,
-    discrete pic={\shade[ball color=\WCvarB] (0,0) circle[radius=4pt];},
-    discrete space at borders=false,
-    middle style={font=\ttfamily},
-    start angle=180,
-    total angle=180,
-    value=\WCvarA/2
+  /wheelchart,
+  data=,
+  discrete,
+  discrete pic={\shade[ball color=\WCvarB] (0,0) circle[radius=4pt];},
+  discrete space at borders=false,
+  middle style={font=\ttfamily},
+  start angle=180,
+  total angle=180,
+  value=\WCvarA/2
 }
 \wheelchart[
-    legend columns=4,
-    legend row={\tikz\shade[ball color=\WCvarB] (0,0) circle[radius=4pt]; & \WCvarC & \WCperc},
-    legend={\node[anchor=north] at (3.5,-1) {\begin{tabular}{*{4}{l@{ }lr}}\WClegend\end{tabular}};},
-    middle={discrete sort=angle}
+  legend columns=4,
+  legend row={\tikz\shade[ball color=\WCvarB] (0,0) circle[radius=4pt]; & \WCvarC & \WCperc},
+  legend={\node[anchor=north] at (3.5,-1) {\begin{tabular}{*{4}{l@{ }lr}}\WClegend\end{tabular}};},
+  middle={discrete sort=angle}
 ]{\exampleforthismanual}
 \wheelchart[
-    at={(7,0)},
-    discrete sort=radius,
-    middle={discrete sort=radius}
+  at={(7,0)},
+  discrete sort=radius,
+  middle={discrete sort=radius}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -798,23 +927,23 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    discrete,
-    discrete pic={\fill (0,0) circle[radius=4pt];},
-    middle style={font=\ttfamily},
-    start angle=180,
-    total angle=180
+  /wheelchart,
+  discrete,
+  discrete pic={\fill (0,0) circle[radius=4pt];},
+  middle style={font=\ttfamily},
+  start angle=180,
+  total angle=180
 }
 \draw[Red,ultra thick] (-3,0.15)--+(6,0);
 \wheelchart[
-    discrete space at borders,
-    middle={discrete space at borders=true}
+  discrete space at borders,
+  middle={discrete space at borders=true}
 ]{2/Cyan/,20/Gray/,2/Cyan/}
 \draw[Green,ultra thick] (4,0)--+(6,0);
 \wheelchart[
-    at={(7,0)},
-    discrete space at borders=false,
-    middle={discrete space\\at borders=false}
+  at={(7,0)},
+  discrete space at borders=false,
+  middle={discrete space\\at borders=false}
 ]{2/Cyan/,20/Gray/,2/Cyan/}
 \end{tikzpicture}
 \end{codeexample}
@@ -822,21 +951,21 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    discrete,
-    discrete pic={\fill (0,0) circle[radius=\WClistradius pt];},
-    middle style={font=\ttfamily}
+  /wheelchart,
+  discrete,
+  discrete pic={\fill (0,0) circle[radius=\WClistradius pt];},
+  middle style={font=\ttfamily}
 }
 \wheelchart[
-    discrete space at borders,
-    middle={discrete space\\at borders=true},
-    WClistradius=4
+  discrete space at borders,
+  middle={discrete space\\at borders=true},
+  WClistradius=4
 ]{2/Red/,40/Gray/,2/Green/}
 \wheelchart[
-    at={(7,0)},
-    discrete space at borders=false,
-    middle={discrete space\\at borders=false},
-    WClistradius={8,4,4}
+  at={(7,0)},
+  discrete space at borders=false,
+  middle={discrete space\\at borders=false},
+  WClistradius={8,4,4}
 ]{2/Red/,40/Gray/,2/Green/}
 \end{tikzpicture}
 \end{codeexample}
@@ -872,20 +1001,20 @@
 \def\WClistB{b,B}
 \def\WCdata{\WClistA,\WClistB}
 \foreach\expandlist [count=\n] in
-    {false,once,true}{
-\wheelchart[
+  {false,once,true}{
+  \wheelchart[
     at={({3.5*\n},0)},
     data=\WCvarA,
     expand list=\expandlist,
     radius={0}{1},
     slices style{list}={
-        Dandelion,CarnationPink,
-        SpringGreen,ProcessBlue
+      Dandelion,CarnationPink,
+      SpringGreen,ProcessBlue
     },
     title={expand list=\\\expandlist},
     title style={font=\ttfamily},
     value=1
-]{\WCdata}
+  ]{\WCdata}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -893,16 +1022,16 @@
 \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=\large\ttfamily}
+  %expand list=false,%false also works
+  %expand list=true,%true doesn't work
+  middle={expand list=\\false %
+    {\normalfont or} once},
+  middle style={font=\large\ttfamily}
 ]{%
-    1/Emerald/Section \ref{Keys},
-    1/Sepia/Reference \cite{TtTaPGFp},
-    1/YellowOrange/{$e^{i\pi}=-1$},
-    1/Salmon/\textbf{Text}%
+  1/Emerald/Section \ref{Keys},
+  1/Sepia/Reference \cite{TtTaPGFp},
+  1/YellowOrange/{$e^{i\pi}=-1$},
+  1/Salmon/\textbf{Text}%
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -910,17 +1039,17 @@
 \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}%
+  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=\large\ttfamily}
+  %expand list=false,
+  %expand list=true,
+  %false and true do not work
+  middle={expand list=once},
+  middle style={font=\large\ttfamily}
 ]{\WClist}
 \end{tikzpicture}
 \end{codeexample}
@@ -930,13 +1059,13 @@
 \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
+  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}
@@ -948,10 +1077,10 @@
 \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}
+  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}
@@ -966,7 +1095,7 @@
 \texttt{expand list items}%
 \foreach\expandlistitems in
     {false,once,true}{%
-\wheelchart[
+  \wheelchart[
     expand list=false,
     expand list items=\expandlistitems,
     legend={; \texttt{\expandlistitems}:
@@ -973,7 +1102,7 @@
         \WCvarA},
     legend only,
     value=1
-]{\WCdata}%
+  ]{\WCdata}%
 }
 \end{codeexample}
 \end{key}
@@ -994,21 +1123,21 @@
 \begin{codeexample}[preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \foreach\gapmaxangle [count=\n] in {90,120,155}{
-\begin{scope}[shift={({5*\n},0)}]
-\wheelchart[
-    gap=1,
-    gap max angle=\gapmaxangle,
-    radius={0}{2},
-    total angle=315
-]{1/CornflowerBlue!50/}
-\fill (0,0) circle[radius=2pt];
-\draw (0,0) circle[radius=2];
-\draw (135:2)--(0:0)--(90:2);
-\draw (0:0)--({135+\gapmaxangle}:{1/sin(\gapmaxangle)}) arc[start angle={135+\gapmaxangle},
-    end angle={450-\gapmaxangle},radius={1/sin(\gapmaxangle)}]--cycle;
-\node at (45:0.6) {\ang{\gapmaxangle}};
-\node at (180:0.6) {\ang{\gapmaxangle}};
-\end{scope}
+  \begin{scope}[shift={({5*\n},0)}]
+    \wheelchart[
+      gap=1,
+      gap max angle=\gapmaxangle,
+      radius={0}{2},
+      total angle=315
+    ]{1/CornflowerBlue!50/}
+    \fill (0,0) circle[radius=2pt];
+    \draw (0,0) circle[radius=2];
+    \draw (135:2)--(0:0)--(90:2);
+    \draw (0:0)--({135+\gapmaxangle}:{1/sin(\gapmaxangle)}) arc[start angle={135+\gapmaxangle},
+      end angle={450-\gapmaxangle},radius={1/sin(\gapmaxangle)}]--cycle;
+    \node at (45:0.6) {\ang{\gapmaxangle}};
+    \node at (180:0.6) {\ang{\gapmaxangle}};
+  \end{scope}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1020,15 +1149,15 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    explode=1,
-    middle={\Large\texttt{explode}},
-    radius={1}{2},
-    slices style={
-        draw=Red,
-        fill=none,
-        ultra thick
-    },
-    total count=6
+  explode=1,
+  middle={\Large\texttt{explode}},
+  radius={1}{2},
+  slices style={
+    draw=Red,
+    fill=none,
+    ultra thick
+  },
+  total count=6
 ]{}
 \draw (0,0) circle[radius=2];
 \draw (0,0) circle[radius=3];
@@ -1037,44 +1166,49 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    gap=0.5,
-    middle={\Large\texttt{gap}},
-    slices style={
-        draw=Red,
-        fill=none,
-        ultra thick
-    },
-    total count=6
+  gap=0.5,
+  legend entry={
+    \draw (\WCcoordinate{outer end})
+      --(\WCcoordinate[\WCcount -2]
+        {outer start});
+    \draw[<->] (\WCpoint{1}{0}{0.5}{0})
+      --(\WCpoint[\WCcount +1]
+        {0}{0}{0.5}{0});
+  },
+  middle={\Large\texttt{gap}},
+  slices style={
+    draw=Red,
+    fill=none,
+    ultra thick
+  },
+  total count=6
 ]{}
 \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[
-    gap polar=10,
-    middle={\Large\texttt{gap polar}},
-    slices style={
-        draw=Red,
-        fill=none,
-        ultra thick
-    },
-    total count=6
+  gap polar=10,
+  legend entry{1,2,3}={
+    \draw (\WCcoordinate{outer start})
+      --(\WCcoordinate[\WCcount +3]
+        {outer start});
+    \draw (\WCcoordinate{outer end})
+      --(\WCcoordinate[\WCcount +3]
+        {outer end});
+  },
+  middle={\Large\texttt{gap polar}},
+  slices style={
+    draw=Red,
+    fill=none,
+    ultra thick
+  },
+  total count=6
 ]{}
 \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}
@@ -1084,12 +1218,12 @@
 \begin{tikzpicture}
 \def\n{73}
 \wheelchart[
-    data=,
-    gap radius=\WCvarC,
-    middle={\Huge\qty{\n}{\percent}}
+  data=,
+  gap radius=\WCvarC,
+  middle={\Huge\qty{\n}{\percent}}
 ]{%
-    \n/NavyBlue/0,
-    {100-\n}/BurntOrange/0.2%
+  \n/NavyBlue/0,
+  {100-\n}/BurntOrange/0.2%
 }
 \draw[Gray] (0,0) circle[radius=1.9];
 \end{tikzpicture}
@@ -1140,38 +1274,38 @@
 In this case it is \emph{not} necessary to place the command |\wheelchart| in a |tikzpicture| environment.
 \begin{codeexample}[width=10cm,preamble={\usepackage{tikzlings}}]
 \wheelchart[
-    header={animal,accessory},
-    legend columns=3,
-    legend only,
-    legend row={\tikz[scale=0.3]{
-        \csname \WCanimal\endcsname[
-            signpost=\WCcount,
-            \WCaccessory
-        ]} & \WCanimal},
-    legend={%
-        \begin{tabular}{*{3}{cl}}
-        \multicolumn{6}{c}{%
-            \WCtotalcount{} animals%
-            from the package%
-            \texttt{tikzlings}}\\\hline
-        \WClegend\hline
-        \end{tabular}%
-    },
-    separator columns={{ }},
-    separator rows=;,
-    value=1
+  header={animal,accessory},
+  legend columns=3,
+  legend only,
+  legend row={\tikz[scale=0.3]{
+    \csname \WCanimal\endcsname[
+      signpost=\WCcount,
+      \WCaccessory
+    ]} & \WCanimal},
+  legend={%
+    \begin{tabular}{*{3}{cl}}
+    \multicolumn{6}{c}{%
+      \WCtotalcount{} animals%
+      from the package%
+      \texttt{tikzlings}}\\\hline
+    \WClegend\hline
+    \end{tabular}%
+  },
+  separator columns={{ }},
+  separator rows=;,
+  value=1
 ]{%
-    bear basket;
-    bee book;
-    bug chef;
-    cat crown;
-    elephant football;
-    koala handbag;
-    owl hat;
-    panda icecream;
-    penguin milkshake;
-    snowman santa;
-    squirrel shovel%
+  bear basket;
+  bee book;
+  bug chef;
+  cat crown;
+  elephant football;
+  koala handbag;
+  owl hat;
+  panda icecream;
+  penguin milkshake;
+  snowman santa;
+  squirrel shovel%
 }
 \end{codeexample}
 \end{key}
@@ -1189,38 +1323,38 @@
 \UseTblrLibrary{counter,siunitx}}]
 \begin{tikzpicture}
 \wheelchart[
-    after slices={
-        \pgfdeclareradialshading{WCshading}{\pgfpoint{0cm}{0cm}}{
-            color(0bp)=(\WCvarB);
-            color(16.66666bp)=(\WCvarB);%2/3 * 25bp
-            color(20.83333bp)=(\WCvarB!10);%2.5/3 * 25bp
-            color(25bp)=(\WCvarB);
-            color(50bp)=(\WCvarB)
-        }
-        \shade[even odd rule,shading=WCshading] (0,0) circle[radius=3] circle[radius=2];
-    },
-    data=,
-    legend row={\tikz\fill[\WCvarB] (0,0) rectangle (0.3,0.3);%
-         & \WCvarC & \WCvarA & \WCpercentagerounded & \WCvarD},
-    legend={
-        \node[anchor=west] at (3.5,0) {%
-            \begin{tblr}[expand=\WClegend]{
-                colspec={llS[table-format=3.0]S[table-format=2.0{\,\unit{\percent}}]l},
-                column{1}={rightsep=0pt,appto={\ }},
-                column{2}={leftsep=0pt},
-                cell{2-Y}{4}={appto={\,\unit{\percent}}},
-                row{1}={guard}
-            }
-             & Fruit & Value & Percentage & Vitamins\\\hline
-            \WClegend\hline
-             & \textbf{Total} & \WCtotalnum & & \\
-            \end{tblr}%
-        };
-    },
-    slices style={
-        fill=none,
-        clip
+  after slices={
+    \pgfdeclareradialshading{WCshading}{\pgfpoint{0cm}{0cm}}{
+      color(0bp)=(\WCvarB);
+      color(16.66666bp)=(\WCvarB);%2/3 * 25bp
+      color(20.83333bp)=(\WCvarB!10);%2.5/3 * 25bp
+      color(25bp)=(\WCvarB);
+      color(50bp)=(\WCvarB)
     }
+    \shade[even odd rule,shading=WCshading] (0,0) circle[radius=3] circle[radius=2];
+  },
+  data=,
+  legend row={\tikz\fill[\WCvarB] (0,0) rectangle (0.3,0.3);%
+     & \WCvarC & \WCvarA & \WCpercentagerounded & \WCvarD},
+  legend={
+    \node[anchor=west] at (3.5,0) {%
+      \begin{tblr}[expand=\WClegend]{
+        colspec={llS[table-format=3.0]S[table-format=2.0{\,\unit{\percent}}]l},
+        column{1}={rightsep=0pt,appto={\ }},
+        column{2}={leftsep=0pt},
+        cell{2-Y}{4}={appto={\,\unit{\percent}}},
+        row{1}=guard
+      }
+       & Fruit & Value & Percentage & Vitamins\\\hline
+      \WClegend\hline
+       & \textbf{Total} & \WCtotalnum & & \\
+      \end{tblr}%
+    };
+  },
+  slices style={
+    fill=none,
+    clip
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1230,22 +1364,22 @@
 \begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \def\WCtest#1#2{%
-    \pgfmathparse{
-        \WCpercentage>10?"#1":"#2"
-    }%
-    \pgfmathresult%
+  \pgfmathparse{
+    \WCpercentage>10?"#1":"#2"
+  }%
+  \pgfmathresult%
 }
 \wheelchart[
-    data=\WCtest{}{\WCperc},
-    lines={\WCpercentage>10?0:0.5},
-    lines style={dotted,thick},
-    pie,
-    slices style={
-        bottom color=\WCvarB,
-        top color=\WCvarB!80!black,
-        shading angle=\WCmidangle-90
-    },
-    wheel data=\WCtest{\WCperc}{}
+  data=\WCtest{}{\WCperc},
+  lines={\WCpercentage>10?0:0.5},
+  lines style={dotted,thick},
+  pie,
+  slices style={
+    bottom color=\WCvarB,
+    top color=\WCvarB!80!black,
+    shading angle=\WCmidangle-90
+  },
+  wheel data=\WCtest{\WCperc}{}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1281,40 +1415,40 @@
 \begin{tikzpicture}[font=\ttfamily]
 \def\WClinesextdirsep{10}
 \wheelchart[
-    data{1,6}=lines ext top dir,
-    data{2}=right,
-    data{3,4}=lines ext bottom dir,
-    data{5}=left,
-    data angle pos=\WClistdap,
-    data sep=0,
-    inner data angle pos{1,4}=0.1,
-    inner data angle pos{3,6}=0.9,
-    inner data pos=1,
-    inner data sep=0.4,
-    inner data style={anchor=\WClistia},
-    lines=0.6,
-    lines{1,3}=0.2,
-    lines angle pos=\WClistdap,
-    lines ext,
-    lines ext dirsep=\WClinesextdirsep,
-    lines sep{list}={0.7,0.2,0.7},
-    lines style=->,
-    slice{1,3,4,6}={
-        arc=<->,
-        inner data=lines ext dirsep,
-        value=\WClinesextdirsep
-    },
-    slices style={
-        draw,
-        pattern=\WClistpattern
-    },
-    total count=6,
-    value{2,5}=180-2*\WClinesextdirsep,
-    WClistdap={0.9,0.2,0.1},
-    WClistia={west,east},
-    WClistpattern={
-        crosshatch,dots,crosshatch
-    }
+  data{1,6}=lines ext top dir,
+  data{2}=right,
+  data{3,4}=lines ext bottom dir,
+  data{5}=left,
+  data angle pos=\WClistdap,
+  data sep=0,
+  inner data angle pos{1,4}=0.1,
+  inner data angle pos{3,6}=0.9,
+  inner data pos=1,
+  inner data sep=0.4,
+  inner data style={anchor=\WClistia},
+  lines=0.6,
+  lines{1,3}=0.2,
+  lines angle pos=\WClistdap,
+  lines ext,
+  lines ext dirsep=\WClinesextdirsep,
+  lines sep{list}={0.7,0.2,0.7},
+  lines style=->,
+  slice{1,3,4,6}={
+    arc=<->,
+    inner data=lines ext dirsep,
+    value=\WClinesextdirsep
+  },
+  slices style={
+    draw,
+    pattern=\WClistpattern
+  },
+  total count=6,
+  value{2,5}=180-2*\WClinesextdirsep,
+  WClistdap={0.9,0.2,0.1},
+  WClistia={west,east},
+  WClistpattern={
+    crosshatch,dots,crosshatch
+  }
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -1358,40 +1492,40 @@
 \usetikzlibrary{decorations.markings}}]
 \begin{tikzpicture}
 \wheelchart[
-    data=\WCperc,
-    data angle pos{4}=0.2,
-%    data style={outer xsep=4pt},
-    legend columns=2,
-    legend row={\tikz\fill[\WCvarB] (0,0) circle[radius=0.15]; & \WCvarC & $\WCvarA$},
-    legend={
-        \node[anchor=north,draw,rounded corners,thick] at (0,-4.5) {%
-            \begin{tabular}{*{2}{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
+  data=\WCperc,
+  data angle pos{4}=0.2,
+%  data style={outer xsep=4pt},
+  legend columns=2,
+  legend row={\tikz\fill[\WCvarB] (0,0) circle[radius=0.15]; & \WCvarC & $\WCvarA$},
+  legend={
+    \node[anchor=north,draw,rounded corners,thick] at (0,-4.5) {%
+      \begin{tabular}{*{2}{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
+  data=,
+  radius={1.5}{2},
+  slices style=\WCvarB!70,
+  start angle=331.2
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1398,23 +1532,23 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data sep=0,
-    data style={
-        inner sep=0pt,
-        shift={(0,0.1)}
-    },
-    lines=0.5,
-    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 pos=0.5,
-    lines sep=0,
-    %lines style=\WCvarB,
-    start angle=331.2
+  data sep=0,
+  data style={
+    inner sep=0pt,
+    shift={(0,0.1)}
+  },
+  lines=0.5,
+  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 pos=0.5,
+  lines sep=0,
+  %lines style=\WCvarB,
+  start angle=331.2
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1421,23 +1555,23 @@
 \begin{codeexample}[width=10cm,preamble={\usetikzlibrary{decorations.markings}}]
 \begin{tikzpicture}
 \wheelchart[
-    data=\WCvarC: \WCvarA,
-    data angle shift=\WCvarG,
-    data sep=0,
-    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
+  data=\WCvarC: \WCvarA,
+  data angle shift=\WCvarG,
+  data sep=0,
+  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}
@@ -1446,29 +1580,7 @@
 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. This key does \emph{not} apply if a plot is used.
-\begin{codeexample}[width=10cm]
-\begin{tikzpicture}
-\wheelchart[
-    counterclockwise,
-    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
-]{}
-\end{tikzpicture}
-\end{codeexample}
+If this key is set then the middle of the wheelchart will be filled with this style. This requires a fixed inner and outer radius for all slices. This key does \emph{not} apply if a plot is used.
 \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.
@@ -1481,30 +1593,34 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \wheelchart[
-    inner plot={{#1}:{#2+0.2*(cos(#1*\WCtotalcount)+1)}},
-    outer plot={{#1}:{#2+0.2*(cos(#1*\WCtotalcount*2)+1)}}
+  inner plot={{#1}:{#2+0.2*(cos(#1*\WCtotalcount)+1)}},
+  outer plot={{#1}:{#2+0.2*(cos(#1*\WCtotalcount*2)+1)}}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
-\begin{codeexample}[]
+\catcode`|=12%
+\begin{codeexample}[preamble={\usetikzlibrary{decorations.text}}]
 \begin{tikzpicture}
 \wheelchart[
-    arc data=\WCvarC,
-    arc data pos=0.5,
-    data=,
-    domain=0:450,
-    inner plot={
-        {int((#1)/180)*5+(0.5-((-1)^Mod(int((#1)/180),2))*2.5)*cos(#1)},
-        {(2.5-((-1)^Mod(int((#1)/180),2))*0.5)*sin(#1)}
-    },
-    outer plot={
-        {int((#1)/180)*5+(-0.5-((-1)^Mod(int((#1)/180),2))*2.5)*cos(#1)},
-        {(2.5+((-1)^Mod(int((#1)/180),2))*0.5)*sin(#1)}
-    },
-    value=1
+  arc data=slice \WCcount\\|\bfseries|\WCvarC,
+  arc data expand=f,
+  arc data pos=0.5,
+  arc data line sep factor=1.5,
+  data=,
+  domain=0:450,
+  inner plot={
+    {int((#1)/180)*5+(0.5-((-1)^Mod(int((#1)/180),2))*2.5)*cos(#1)},
+    {(2.5-((-1)^Mod(int((#1)/180),2))*0.5)*sin(#1)}
+  },
+  outer plot={
+    {int((#1)/180)*5+(-0.5-((-1)^Mod(int((#1)/180),2))*2.5)*cos(#1)},
+    {(2.5+((-1)^Mod(int((#1)/180),2))*0.5)*sin(#1)}
+  },
+  value=width("\WCvarC")
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
+\catcode`|=13%
 \end{key}
 \begin{stylekey}{/wheelchart/outer plot style=\marg{options} (initially \normalfont empty)}
 This key accepts a list of keys which will be applied to the plot determined by the key |outer plot|.
@@ -1512,14 +1628,8 @@
 \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/parse=\mchoice{pgfmath,l3fp} (initially pgfmath)}
-\begin{description}
-\item[\texttt{pgfmath}] In this case, the values of applicable keys will be parsed with |\pgfmathparse|.
-\item[\texttt{l3fp}] In this case, the values of applicable keys will be parsed with |\fp_eval:n|.
-\end{description}
-\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.
+This key defines the number of decimals up to which the percentage in the macros |\WCperc| and |\WCpercentagerounded| is rounded. The rounding is performed with |l3fp|. With the initial setting, for example \num{49.5} and \num{50.5} are both rounded to 50. With |perc precision={0,1}|, \num{49.5} is rounded to 50 and \num{50.5} to 51.
 \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|.
@@ -1533,10 +1643,10 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    domain=0:2,
-    plot={{(#1)^2},{#2}},
-    wheel data=text B,
-    wheel data angle pos=sqrt(2)/2
+  domain=0:2,
+  plot={{(#1)^2},{#2}},
+  wheel data=text B,
+  wheel data angle pos=sqrt(2)/2
 ]{1/BrickRed/text A}
 \end{tikzpicture}
 \end{codeexample}
@@ -1543,7 +1653,7 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    plot={{#1}:{0.5*(sin(#1*3)+1)+#2}}
+  plot={{#1}:{0.5*(sin(#1*3)+1)+#2}}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1550,31 +1660,31 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \wheelchart[
-    domain=0:720,
-    gap polar=5,
-    plot={{#1*3.5/180},{sin(#1)-#2}},
-    radius={0}{2},
-    value=1,
-    wheel data=\WCcount,
-    wheel data pos=0.5
+  domain=0:720,
+  gap polar=5,
+  plot={{#1*3.5/180},{sin(#1)-#2}},
+  radius={0}{2},
+  value=1,
+  wheel data=\WCcount,
+  wheel data pos=0.5
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
-\begin{codeexample}[width=10cm]
+\begin{codeexample}[width=10cm,preamble={\usetikzlibrary{decorations.text}}]
 \begin{tikzpicture}
 \wheelchart[
-    arc data=\WCvarC,
-    arc data dir={\WCmidangle<180?-1:1},
-    arc data pos=0.5,
-    data=,
-    domain=0:900,
-    plot={{#1}:
-        {(((#1)*pi/180+15)^2-1)/300
-            +(#2)-0.25}},
-    radius={0}{0.5},
-    slices arrow={1}{0},
-    value=sqrt(3+\WCcount*pi*(pi+6)/7)-
-        sqrt(3+(\WCcount-1)*pi*(pi+6)/7)
+  arc data=\WCvarC,
+  arc data dir={\WCmidangle<180?-1:1},
+  arc data pos=0.5,
+  data=,
+  domain=0:900,
+  plot={{#1}:
+    {(((#1)*pi/180+15)^2-1)/300
+      +(#2)-0.25}},
+  radius={0}{0.5},
+  slices arrow={1}{0},
+  value=sqrt(3+\WCcount*pi*(pi+6)/7)-
+    sqrt(3+(\WCcount-1)*pi*(pi+6)/7)
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1581,19 +1691,19 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    gap,
-    radius={1.3}{2},
-    start angle=180*(1-2/\WCtotalcount),
-    value=1
+  /wheelchart,
+  gap,
+  radius={1.3}{2},
+  start angle=180*(1-2/\WCtotalcount),
+  value=1
 }
 \wheelchart[
-    plot={{#1}:{(#2)*cos(180/\WCtotalcount)/cos(Mod(#1,{360/\WCtotalcount})-180/\WCtotalcount)}}
+  plot={{#1}:{(#2)*cos(180/\WCtotalcount)/cos(Mod(#1,{360/\WCtotalcount})-180/\WCtotalcount)}}
 ]{\exampleforthismanual}
 \wheelchart[
-    at={(8,0)},
-    slices inner arrow={-cot(90*(1-2/\WCtotalcount))}{0},
-    slices outer arrow={cot(90*(1-2/\WCtotalcount))}{0}
+  at={(8,0)},
+  slices inner arrow={-cot(90*(1-2/\WCtotalcount))}{0},
+  slices outer arrow={cot(90*(1-2/\WCtotalcount))}{0}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1603,20 +1713,6 @@
 \end{stylekey}
 \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}
 \end{key}
 \begin{key}{/wheelchart/samples=\marg{number} (initially 25)}
 This key determines the \meta{number} of samples used in the plots.
@@ -1628,55 +1724,32 @@
 \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[
-    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}
+
 In the following example, a |;| is placed at the beginning of the argument for the key |slices| because there is no path to be filled. Thereafter, a node is placed still within the argument for the key |slices|.
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    radius={3.5}{3.5},
-    slices={;\node[
-        bottom color=\WCvarB!60,
-        top color=\WCvarB!10,
-        circle,
-        draw=gray,
-        minimum width=2.5cm
-    ] (WCslice\WCcount)
-        {\WCcount: \WCvarC};},
-    slices style={},
-    start half,
-    value=1
+  data=,
+  radius={3.5}{3.5},
+  slices={
+    ;
+    \node[
+      bottom color=\WCvarB!60,
+      top color=\WCvarB!10,
+      circle,
+      draw=gray,
+      minimum width=2.5cm
+    ]
+    (WCslice\WCcount)
+    {\WCcount: \WCvarC};
+  },
+  slices style={},
+  start half,
+  value=1
 ]{\exampleforthismanual}
 \foreach\n in {1,...,7}{
-\pgfmathsetmacro{\k}{int(Mod(\n,7)+1)}
-\draw[->,line width=2pt] (WCslice\n)
+  \pgfmathsetmacro{\k}{int(Mod(\n,7)+1)}
+  \draw[->,line width=2pt] (WCslice\n)
     to[bend left=10] (WCslice\k);
 }
 \end{tikzpicture}
@@ -1687,20 +1760,20 @@
 \begin{key}{/wheelchart/slices angle shift=\marg{angle} (initially 0)}
 These keys determine the position of the slices if the key |slices| is used similar as the corresponding keys for the key |data|.
 \end{key}
-Below we list some keys to modify the shape of the slices. These keys only affect the shape of the slices and \emph{not} the computation of the inner and outer plot. In particular, these keys do \emph{not} affect the placement of |arc data|, |data|, |inner data|, |lines|, |wheel data| and |wheel lines|. If this placement should be changed then the keys |inner plot| and |outer plot| can be used.
+Below we list some keys to modify the shape of the slices. These keys only affect the shape of the slices and \emph{not} the computation of the inner and outer sides. In particular, these keys do \emph{not} affect the placement of |arc|, |arc data|, |data|, |inner data|, |lines|, |wheel data| and |wheel lines|. If this placement should be changed then the keys |inner plot| and |outer plot| can be used.
 \begin{key}{/wheelchart/slices arc=\marg{value 1}\marg{value 2}}
 This key sets |slices end arc| and |slices start arc| but uses the opposite of \meta{value 1} for |slices start arc|.
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    slices arc={1}{0},
-    wheel data=\WCcount,
-    wheel data angle pos=1,
-    wheel data pos=0.5,
-    wheel data style={
-        circle,
-        fill=\WCvarB!50
-    }
+  slices arc={1}{0},
+  wheel data=\WCcount,
+  wheel data angle pos=1,
+  wheel data pos=0.5,
+  wheel data style={
+    circle,
+    fill=\WCvarB!50
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1707,24 +1780,24 @@
 \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
+  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%
+  Yellow/Some text A,
+  Orange/Some text B,
+  Red/Some text C,
+  Green/Some text D,
+  Blue/Some text E%
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1734,7 +1807,7 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[font=\scriptsize]
 \foreach\a/\x in {0/0,45/4.5}{
-\wheelchart[
+  \wheelchart[
     at={(\x,0)},
     data=,
     gap,
@@ -1744,7 +1817,7 @@
     value=1,
     wheel data=\WCvarC,
     wheel data angle pos=0.6
-]{\exampleforthismanual}
+  ]{\exampleforthismanual}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1754,7 +1827,7 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \foreach\a/\x in {-60/0,0/4.5,60/10}{
-\wheelchart[
+  \wheelchart[
     at={(\x,0)},
     radius={0.66}{2},
     slices arc inner end start,
@@ -1761,7 +1834,7 @@
     slices inner angle shift=\a,
     slices style={fill=none,draw=Turquoise,ultra thick},
     total count=20
-]{}
+  ]{}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1771,20 +1844,20 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    middle={%
-        slices arc\\%
-        inner start,\\%
-        slices inner\\%
-        angle shift=90%
-    },
-    middle style={font=\ttfamily},
-    slices arc inner start,
-    slices inner angle shift=90
+  middle={%
+    slices arc\\%
+    inner start,\\%
+    slices inner\\%
+    angle shift=90%
+  },
+  middle style={font=\ttfamily},
+  slices arc inner start,
+  slices inner angle shift=90
 ]{%
-    1/Goldenrod/,
-    1/Mahogany/,
-    1/JungleGreen/,
-    1/RoyalBlue/%
+  1/Goldenrod/,
+  1/Mahogany/,
+  1/JungleGreen/,
+  1/RoyalBlue/%
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1794,17 +1867,17 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    gap polar=5,
-    middle={%
-        slices arc\\%
-        inner start end%
-    },
-    middle style={font=\ttfamily},
-    slices arc inner start end,
-    value=1,
-    wheel data=\WCvarC,
-    wheel data pos=0.4
+  data=,
+  gap polar=5,
+  middle={%
+    slices arc\\%
+    inner start end%
+  },
+  middle style={font=\ttfamily},
+  slices arc inner start end,
+  value=1,
+  wheel data=\WCvarC,
+  wheel data pos=0.4
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1816,20 +1889,20 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \foreach\a/\b/\x in
-    {end/1/0,inner/-1/4.8}{
-\wheelchart[
+  {end/1/0,inner/-1/4.8}{
+  \wheelchart[
     at={(\x,0)},
     radius={0.66}{2},
     slices arc match=
-        {\a}{\b}{1}{1}{inner end}
-        {inner start}{outer end},
+      {\a}{\b}{1}{1}{inner end}
+      {inner start}{outer end},
     slices inner angle shift=60,
     slices style={
-        fill=none,
-        draw=Turquoise
+      fill=none,
+      draw=Turquoise
     },
     total count=20
-]{}
+  ]{}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1842,16 +1915,16 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    gap polar=5,
-    middle={%
-        slices arc\\%
-        outer end start%
-    },
-    middle style={font=\ttfamily},
-    slices arc outer end start,
-    value=1,
-    wheel data=\WCvarC
+  data=,
+  gap polar=5,
+  middle={%
+    slices arc\\%
+    outer end start%
+  },
+  middle style={font=\ttfamily},
+  slices arc outer end start,
+  value=1,
+  wheel data=\WCvarC
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1861,18 +1934,18 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    gap=0.1,
-    slices arc inner start,
-    slices arc outer start,
-    slices style={
-        \WCvarB!50,
-        draw=\WCvarB,
-        ultra thick
-    },
-    value=1,
-    wheel data=\WCcount,
-    wheel data pos=0.8
+  data=,
+  gap=0.1,
+  slices arc inner start,
+  slices arc outer start,
+  slices style={
+    \WCvarB!50,
+    draw=\WCvarB,
+    ultra thick
+  },
+  value=1,
+  wheel data=\WCcount,
+  wheel data pos=0.8
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -1879,7 +1952,7 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \foreach\a/\x in {0/0,45/5,90/10}{
-\wheelchart[
+  \wheelchart[
     at={(\x,0)},
     data=,
     gap,
@@ -1887,7 +1960,7 @@
     slices arc outer start,
     slices outer angle shift=\a,
     value=1
-]{\exampleforthismanual}
+  ]{\exampleforthismanual}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -1895,17 +1968,53 @@
 \begin{key}{/wheelchart/slices arc outer start end=\opt{\meta{boolean}} (default true, initially false)}
 If true then the keys |slices end arc|, |slices outer arc| and |slices start arc| are set such that the outer part and the start of each of the slices of the wheelchart form one arc and such that the end has the same curvature as the start.
 \end{key}
+\begin{key}{/wheelchart/slices Arrow=\marg{angle}}
+This key sets |slices end| to |--(\WCpoint{1}{|\meta{angle}|}{0.5}{0})--(\WCpoint{1}{0}{0}{0})| and |slices start| to |--(\WCpoint{0}{|\meta{angle}|}{0.5}{0})--cycle|.
+\end{key}
 \begin{key}{/wheelchart/slices arrow=\marg{value 1}\marg{value 2}}
 This key is similar to the key |slices arc| but draws an arrow.
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    gap=0.3,
-    slices arrow={1}{-1}
+  gap=0.3,
+  slices arrow={1}{-1}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
+The example below compares arrows constructed with the key |slices Arrow| and the key |slices arrow|. Using the key |slices Arrow|, the arrow tip lies on the circle but the line segments do \emph{not} have the same length. Using the key |slices arrow|, the arrow tip does \emph{not} lie on the circle but the line segments have the same length.
+\begin{codeexample}[width=10cm]
+\begin{tikzpicture}
+\wheelchart[
+  gap=0.3,
+  middle=slices Arrow,
+  middle style={font=\ttfamily},
+  slices Arrow=10,
+  slices style={
+    fill=none,
+    draw=Bittersweet
+  },
+  total count=3
+]{}
+\draw (0,0) circle[radius=2.5];
+\wheelchart[
+  at={(0,-7)},
+  gap=0.3,
+  middle=slices arrow,
+  middle style={font=\ttfamily},
+  slices arrow={1}{0},
+  slices style={
+    fill=none,
+    draw=CadetBlue
+  },
+  total count=3
+]{}
+\draw (0,-7) circle[radius=2.5];
+\end{tikzpicture}
+\end{codeexample}
 \end{key}
+\begin{key}{/wheelchart/slices end=\marg{path}}
+This key determines the end of the slice. Initially, this is a line segment from the outer end to the inner end of the slice.
+\end{key}
 \begin{key}{/wheelchart/slices end arc=\marg{value 1}\marg{value 2}}
 This key determines the end of the slice.
 
@@ -1919,13 +2028,13 @@
 \begin{center}
 \begin{tikzpicture}[scale=3]
 \wheelchart[
-    slices end arc={2}{0.5},
-    slices style={
-        fill=none,
-        draw=Cyan,
-        ultra thick
-    },
-    xbar={1}{1}
+  slices end arc={2}{0.5},
+  slices style={
+    fill=none,
+    draw=Cyan,
+    ultra thick
+  },
+  xbar={1}{1}
 ]{1//}
 \draw[<->] (1,0.5)--(1.5,0.5) node[below,midway] {$a$};
 \draw[<->] (1,0.5)--(1,0.75) node[left,midway] {$b$};
@@ -1940,24 +2049,24 @@
 \ifdim #2 pt<0pt
 \edef\r{\fpeval{0.25*((#2)-1)*(1/(#1)+(#1))}}
 \wheelchart[
-    at={({1.5+sqrt((\r)^2-0.25)-(#1)*0.5*(1-(#2))-\r},0)},
-    slices start arc={-(#1)}{#2},
-    slices style={
-        fill=none,
-        draw=Goldenrod,
-        ultra thick
-    },
-    xbar={0.5}{1}
+  at={({1.5+sqrt((\r)^2-0.25)-(#1)*0.5*(1-(#2))-\r},0)},
+  slices start arc={-(#1)}{#2},
+  slices style={
+    fill=none,
+    draw=Goldenrod,
+    ultra thick
+  },
+  xbar={0.5}{1}
 ]{1//}
 \fi
 \fi
 \wheelchart[
-    slices end arc={#1}{#2},
-    slices style={
-        fill=none,
-        draw
-    },
-    xbar={1.5}{1}
+  slices end arc={#1}{#2},
+  slices style={
+    fill=none,
+    draw
+  },
+  xbar={1.5}{1}
 ]{1//}
 \useasboundingbox ($(current bounding box.south west)-(2pt,2pt)$) rectangle ($(current bounding box.north east)+(2pt,2pt)$);
 \end{tikzpicture}%
@@ -1975,17 +2084,17 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    for loop start={
-        \definecolor{WCcolor}{wave}{
-        \fpeval{380+(\WCcount-1)*
-        340/(\WCtotalcount-1)}}
-    },
-    gap polar=180/\WCtotalcount,
-    radius={1.5}{3},
-    slices end arc={-0.6}{0},
-    slices start arc={1.2}{0},
-    slices style=WCcolor,
-    total count=20
+  for loop start={
+    \definecolor{WCcolor}{wave}{
+    \fpeval{380+(\WCcount-1)*
+    340/(\WCtotalcount-1)}}
+  },
+  gap polar=180/\WCtotalcount,
+  radius={1.5}{3},
+  slices end arc={-0.6}{0},
+  slices start arc={1.2}{0},
+  slices style=WCcolor,
+  total count=20
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -1996,6 +2105,64 @@
 \begin{key}{/wheelchart/slices end to=\marg{value 1}\marg{value 2}}
 This key sets the |to| path operation for the end of the slice. The angle at the inner side is determined by \meta{value 1} and the angle at the outer side is determined by \meta{value 2}.
 \end{key}
+\begin{key}{/wheelchart/slices inner=\marg{path}}
+This key determines the inner part of the slice. Initially, this is an arc from the inner end to the inner start of the slice.
+\begin{codeexample}[width=10cm]
+\begin{tikzpicture}
+\def\a{5}
+\def\b{12}
+\wheelchart[
+  data sep=0.3,
+  gap=0.1,
+  inner data=\WCcount,
+  inner data sep=2-2*cos(\b),
+  inner data style={
+    circle,
+    fill=\WCvarB!50
+  },
+  slices inner={
+    arc[
+      start angle=\WCangle{1}{0}{0}{0},
+      end angle=\WCangle{0.5}{\b}{0}{0},
+      radius=\WCradius{0}{0}
+    ]
+    arc[
+      start angle=\WCmidangle-90,
+      end angle=\WCmidangle+90,
+      radius=2*sin(\b)
+    ]
+    arc[
+      start angle=
+        \WCangle{0.5}{-\b}{0}{0},
+      end angle=\WCangle{0}{0}{0}{0},
+      radius=\WCradius{0}{0}
+    ]
+  },
+  slices outer={
+    arc[
+      start angle=\WCangle{0}{0}{1}{0},
+      end angle=\WCangle{0.5}{-\a}{1}{0},
+      radius=\WCradius{1}{0}
+    ]
+    --(\WCpoint{0.5}{0}{1}{0.3})
+    --(\WCpoint{0.5}{\a}{1}{0})
+    arc[
+      start angle=
+        \WCangle{0.5}{\a}{1}{0},
+      end angle=\WCangle{1}{0}{1}{0},
+      radius=\WCradius{1}{0}
+    ]
+  },
+  slices style={
+    draw=\WCvarB,
+    fill=\WCvarB!25,
+    ultra thick
+  },
+  value=1
+]{\exampleforthismanual}
+\end{tikzpicture}
+\end{codeexample}
+\end{key}
 \begin{key}{/wheelchart/slices inner angle reduce=\marg{angle}}
 This key sets |slices inner end angle shift| to $-\text{\meta{angle}}$ and |slices inner start angle shift| to \meta{angle}.
 \end{key}
@@ -2004,13 +2171,13 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    middle={%
-        slices inner\\%
-        angle shift=90%
-    },
-    middle style={font=\ttfamily},
-    slices inner angle shift=90
+  data=,
+  middle={%
+    slices inner\\%
+    angle shift=90%
+  },
+  middle style={font=\ttfamily},
+  slices inner angle shift=90
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2017,14 +2184,14 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    gap,
-    radius={1}{3},
-    slices arc={0.5}{0},
-    slices inner angle shift=45,
-    value=1,
-    wheel data=\WCvarC,
-    wheel data angle pos=0.8
+  data=,
+  gap,
+  radius={1}{3},
+  slices arc={0.5}{0},
+  slices inner angle shift=45,
+  value=1,
+  wheel data=\WCvarC,
+  wheel data angle pos=0.8
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2031,7 +2198,7 @@
 \begin{codeexample}[]
 \begin{tikzpicture}
 \foreach\a/\x in {-60/0,0/5.6,60/10}{
-\wheelchart[
+  \wheelchart[
     at={(\x,0)},
     radius={0.66}{2},
     slices arc inner start,
@@ -2039,7 +2206,7 @@
     slices style={fill=\WClistcolors},
     total count=40,
     WClistcolors={RedOrange,none}
-]{}
+  ]{}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -2046,23 +2213,23 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[font=\small]
 \pgfkeys{
-    /wheelchart,
-    data=,
-    inner data=\WCcount,
-    inner data pos=0.1,
-    inner data sep=0,
-    radius={1}{2.4},
-    slices inner angle shift=
-        90-180/\WCtotalcount,
-    slices inner arc={0}{0},
-    value=1,
-    wheel data=\WCvarC
+  /wheelchart,
+  data=,
+  inner data=\WCcount,
+  inner data pos=0.1,
+  inner data sep=0,
+  radius={1}{2.4},
+  slices inner angle shift=
+    90-180/\WCtotalcount,
+  slices inner arc={0}{0},
+  value=1,
+  wheel data=\WCvarC
 }
 \wheelchart{\exampleforthismanual}
 \wheelchart[
-    at={(4.8,0)},
-    slices outer arc={0}{0},
-    wheel data pos=0.58
+  at={(4.8,0)},
+  slices outer arc={0}{0},
+  wheel data pos=0.58
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2075,18 +2242,18 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    counterclockwise,
-    data=,
-    gap=0.1,
-    middle=slices inner\\arc tangent,
-    middle style={font=\ttfamily},
-    slices inner arc tangent,
-    slices style={
-        draw=\WCvarB,
-        fill=\WCvarB!50,
-        ultra thick
-    },
-    value=1
+  counterclockwise,
+  data=,
+  gap=0.1,
+  middle=slices inner\\arc tangent,
+  middle style={font=\ttfamily},
+  slices inner arc tangent,
+  slices style={
+    draw=\WCvarB,
+    fill=\WCvarB!50,
+    ultra thick
+  },
+  value=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2097,23 +2264,23 @@
 \begin{tikzpicture}
 \def\n{10}
 \wheelchart[
-    radius={0}{1.5},
-    slices outer arrow={cot(180/\n)}{0},
-    slices style{list}={
-        BurntOrange,RedOrange
-    },
-    total count=\n
+  radius={0}{1.5},
+  slices outer arrow={cot(180/\n)}{0},
+  slices style{list}={
+    BurntOrange,RedOrange
+  },
+  total count=\n
 ]{}
 \wheelchart[
-    radius={3*cos(180/\n)}
-        {3*cos(180/\n)},
-    slices inner arrow={cot(360/\n)}{0},
-    slices outer arrow={cot(360/\n)}{0},
-    slices style{list}={
-        Dandelion,Goldenrod
-    },
-    start half,
-    total count=\n
+  radius={3*cos(180/\n)}
+    {3*cos(180/\n)},
+  slices inner arrow={cot(360/\n)}{0},
+  slices outer arrow={cot(360/\n)}{0},
+  slices style{list}={
+    Dandelion,Goldenrod
+  },
+  start half,
+  total count=\n
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -2127,26 +2294,29 @@
 \begin{key}{/wheelchart/slices inner to=\marg{value 1}\marg{value 2}}
 This key sets the |to| path operation for the inner part of the slice. The angle at the start is determined by \meta{value 1} and the angle at the end is determined by \meta{value 2}.
 \end{key}
+\begin{key}{/wheelchart/slices outer=\marg{path}}
+This key determines the outer part of the slice. Initially, this is an arc from the outer start to the outer end of the slice.
+\end{key}
 \begin{key}{/wheelchart/slices outer angle reduce=\marg{angle}}
 This key sets |slices outer end angle shift| to $-\text{\meta{angle}}$ and |slices outer start angle shift| to \meta{angle}.
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    inner data=\WCcount,
-    inner data style={
-        circle,
-        fill=white
-    },
-    slices inner arrow={1}{0},
-    slices outer angle reduce=
-        180/\WCtotalcount,
-    slices outer arrow={0}{0},
-    value=1,
-    wheel data=\WCvarC,
-    wheel data style={
-        rotate=\WCmidangle-90
-    }
+  data=,
+  inner data=\WCcount,
+  inner data style={
+    circle,
+    fill=white
+  },
+  slices inner arrow={1}{0},
+  slices outer angle reduce=
+    180/\WCtotalcount,
+  slices outer arrow={0}{0},
+  value=1,
+  wheel data=\WCvarC,
+  wheel data style={
+    rotate=\WCmidangle-90
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2156,22 +2326,22 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[looseness=2]
 \wheelchart[
-    data=,
-    inner data={\Large\WCcount},
-    inner data pos=1.1,
-    radius={1}{3},
-    slices arc inner end,
-    slices outer angle shift=80,
-    slices outer to={80}{80},
-    slices style={
-        bottom color=\WCvarB,
-        top color=\WCvarB!80!black,
-        shading angle=\WCmidangle-90
-    },
-    value=1,
-    wheel data=\WCvarC,
-    wheel data angle pos=0.4,
-    wheel data pos=0.8
+  data=,
+  inner data={\Large\WCcount},
+  inner data pos=1.1,
+  radius={1}{3},
+  slices arc inner end,
+  slices outer angle shift=80,
+  slices outer to={80}{80},
+  slices style={
+    bottom color=\WCvarB,
+    top color=\WCvarB!80!black,
+    shading angle=\WCmidangle-90
+  },
+  value=1,
+  wheel data=\WCvarC,
+  wheel data angle pos=0.4,
+  wheel data pos=0.8
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2184,17 +2354,17 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    gap=0.1,
-    middle=slices outer\\arc tangent,
-    middle style={font=\ttfamily},
-    slices outer arc tangent,
-    slices style={
-        draw=\WCvarB,
-        fill=\WCvarB!50,
-        ultra thick
-    },
-    value=1
+  data=,
+  gap=0.1,
+  middle=slices outer\\arc tangent,
+  middle style={font=\ttfamily},
+  slices outer arc tangent,
+  slices style={
+    draw=\WCvarB,
+    fill=\WCvarB!50,
+    ultra thick
+  },
+  value=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2204,8 +2374,8 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[font=\scriptsize]
 \foreach\a/\x in
-    {1/0,{tan(180/\WCtotalcount)}/5}{
-\wheelchart[
+  {1/0,{tan(180/\WCtotalcount)}/5}{
+  \wheelchart[
     at={(\x,0)},
     data=,
     gap,
@@ -2214,7 +2384,7 @@
     start half,
     value=1,
     wheel data=\WCvarC
-]{\exampleforthismanual}
+  ]{\exampleforthismanual}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -2221,22 +2391,22 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \pgfkeys{
-    /wheelchart,
-    data=,
-    radius={1}{1.5},
-    value=1
+  /wheelchart,
+  data=,
+  radius={1}{1.5},
+  value=1
 }
 \wheelchart[
-    slices inner arrow={0}{0}
+  slices inner arrow={0}{0}
 ]{\exampleforthismanual}
 \wheelchart[
-    at={(3.25,0)},
-    slices outer arrow={0}{0}
+  at={(3.25,0)},
+  slices outer arrow={0}{0}
 ]{\exampleforthismanual}
 \wheelchart[
-    at={(6.5,0)},
-    slices inner arrow={0}{0},
-    slices outer arrow={0}{0}
+  at={(6.5,0)},
+  slices inner arrow={0}{0},
+  slices outer arrow={0}{0}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2243,20 +2413,20 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \foreach\r/\s/\a in
-    {3/0/0.5,2/15/1,1/30/0.7}{
-\wheelchart[
+  {3/0/0.5,2/15/1,1/30/0.7}{
+  \wheelchart[
     radius={0.5}{\r},
     slices outer arrow={\a}{0},
     slices style={
-        fill=\WClistcolors!20,
-        draw=\WClistcolors,
-        ultra thick,
-        double
+      fill=\WClistcolors!20,
+      draw=\WClistcolors,
+      ultra thick,
+      double
     },
     start half=\s,
     total count=12,
     WClistcolors={CarnationPink,Orchid}
-]{}
+  ]{}
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -2272,14 +2442,14 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[looseness=3]
 \wheelchart[
-    data=,
-    radius={0}{2.5},
-    slices arc={0.4}{0},
-    slices outer to={70}{70},
-    start half,
-    value=1,
-    wheel data=\WCvarC,
-    wheel data pos=1
+  data=,
+  radius={0}{2.5},
+  slices arc={0.4}{0},
+  slices outer to={70}{70},
+  start half,
+  value=1,
+  wheel data=\WCvarC,
+  wheel data pos=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2292,23 +2462,23 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data=,
-    radius={3.9}{4.5},
-    slices inner arc={0}{0},
-    slices outer angle reduce=5*90/7,
-    slices outer arc={0}{0},
-    slices scope={
-        shift={
-            ($(90+\WCmidangle:0.559572)
-            +(\WCmidangle:-1.16196)$)
-        }
-    },
-    value=1,
-    wheel data=\WCvarC,
-    wheel data pos=0,
-    wheel data style={
-        rotate=\WCmidangle-90
+  data=,
+  radius={3.9}{4.5},
+  slices inner arc={0}{0},
+  slices outer angle reduce=5*90/7,
+  slices outer arc={0}{0},
+  slices scope={
+    shift={
+      ($(90+\WCmidangle:0.559572)
+      +(\WCmidangle:-1.16196)$)
     }
+  },
+  value=1,
+  wheel data=\WCvarC,
+  wheel data pos=0,
+  wheel data style={
+    rotate=\WCmidangle-90
+  }
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2315,17 +2485,16 @@
 \begin{codeexample}[width=10cm,preamble={\usepackage{siunitx}}]
 \begin{tikzpicture}
 \wheelchart[
-    data=\WCvarC\\%
-        \qty{\fpeval{\WCvarA/2}}%
-        {\percent},
-    radius={0.5}{0.5+0.1*\WCvarA},
-    slices inner arc tangent,
-    slices outer angle reduce=
-        180/\WCtotalcount,
-    slices outer arc tangent,
-    slices scope={shift={(\WCmidangle:
-        {-cos(180/\WCtotalcount)/2})}},
-    value=1
+  data=\WCvarC\\%
+    \qty{\fpeval{\WCvarA/2}}{\percent},
+  radius={0.5}{0.5+0.1*\WCvarA},
+  slices inner arc tangent,
+  slices outer angle reduce=
+    180/\WCtotalcount,
+  slices outer arc tangent,
+  slices scope={shift={(\WCmidangle:
+    {-cos(180/\WCtotalcount)/2})}},
+  value=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2333,6 +2502,9 @@
 \begin{key}{/wheelchart/slices sep=\marg{value} (initially 0)}
 This key determines the position of the slices if the key |slices| is used similar as the corresponding key for the key |data|.
 \end{key}
+\begin{key}{/wheelchart/slices start=\marg{path}}
+This key determines the start of the slice. Initially, this is a line segment from the inner start to the outer start of the slice.
+\end{key}
 \begin{key}{/wheelchart/slices start arc=\marg{value 1}\marg{value 2}}
 This key is similar to the key |slices end arc| but sets the start of the slice.
 \end{key}
@@ -2350,13 +2522,13 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}[looseness=2]
 \wheelchart[
-    radius={1}{3},
-    slices inner angle shift=90,
-    slices inner arc={0}{0},
-    slices outer to={70}{70},
-    slices style{list}={Maroon,Salmon},
-    slices to={30}{30},
-    total count=6
+  radius={1}{3},
+  slices inner angle shift=90,
+  slices inner arc={0}{0},
+  slices outer to={70}{70},
+  slices style{list}={Maroon,Salmon},
+  slices to={30}{30},
+  total count=6
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -2397,11 +2569,11 @@
 \begin{tikzpicture}
 \def\n{57}
 \wheelchart[
-    gap=0.015,
-    middle={\Huge\qty{\n}{\percent}},
-    slices style=Gray,
-    slices style{1,...,\n}=Cyan,
-    total count=100
+  gap=0.015,
+  middle={\Huge\qty{\n}{\percent}},
+  slices style=Gray,
+  slices style{1,...,\n}=Cyan,
+  total count=100
 ]{}
 \end{tikzpicture}
 \end{codeexample}
@@ -2411,8 +2583,8 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    triangle proportional area={5}{4},
-    value=1
+  triangle proportional area={5}{4},
+  value=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2422,8 +2594,8 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    triangle proportional height={5}{4},
-    value=1
+  triangle proportional height={5}{4},
+  value=1
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2462,20 +2634,20 @@
 \colorlet{neutral}{black!60}
 \colorlet{none}{white}
 \wheelchart[
-    anchor xsep=15,
-    contour=gray,
-    data=``\WCvarC'': \WCvarA{} (\WCperc),
-    middle=Ratings given by\\\WCtotalnum{} participants,
-    radius={1.8}{2.2},
-    start half=270,
-    wheel lines={black!15,thick}
+  anchor xsep=15,
+  contour=gray,
+  data=``\WCvarC'': \WCvarA{} (\WCperc),
+  middle=Ratings given by\\\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%
+  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}
@@ -2485,11 +2657,11 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    data pos{list}={1,0},
-    data style={anchor=mid},
-    gap polar=0.05,
-    slices arrow={1}{0},
-    xbar={8}{1.5}
+  data pos{list}={1,0},
+  data style={anchor=mid},
+  gap polar=0.05,
+  slices arrow={1}{0},
+  xbar={8}{1.5}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2499,9 +2671,9 @@
 \begin{codeexample}[width=10cm]
 \begin{tikzpicture}
 \wheelchart[
-    inner data=\WCperc,
-    inner data style={anchor=east},
-    ybar={1}{4}
+  inner data=\WCperc,
+  inner data style={anchor=east},
+  ybar={1}{4}
 ]{\exampleforthismanual}
 \end{tikzpicture}
 \end{codeexample}
@@ -2516,39 +2688,39 @@
 \sffamily
 \readlist\WCcolors{orange!50,orange!75,orange}
 \pgfkeys{
-    /wheelchart,
-    arc data=\WCvarB,
-    arc data dir={\WCmidangle<180?-1:1},
-    arc data pos=0.5,
-    arc data style={text color=white},
-    counterclockwise,
-    data=,
-    gap,
-    gap radius,
-    slices style={
-        /utils/exec={
-            \ifdefempty{\WCvarB}{
-                \def\WCcolor{none}
-                \def\WCoverlay{true}
-            }{
-                \edef\WCcolor{\WCcolors[\fpeval{\WCmidangle<90?1:(\WCmidangle<210?2:(\WCmidangle<270?3:1))}]}
-                \def\WCoverlay{false}
-            }
-        },
-        fill=\WCcolor,
-        overlay=\WCoverlay
-    }
+  /wheelchart,
+  arc data=\WCvarB,
+  arc data dir={\WCmidangle<180?-1:1},
+  arc data pos=0.5,
+  arc data style={text color=white},
+  counterclockwise,
+  data=,
+  gap,
+  gap radius,
+  slices style={
+    /utils/exec={
+      \ifdefempty{\WCvarB}{
+        \def\WCcolor{none}
+        \def\WCoverlay{true}
+      }{
+        \edef\WCcolor{\WCcolors[\fpeval{\WCmidangle<90?1:(\WCmidangle<210?2:(\WCmidangle<270?3:1))}]}
+        \def\WCoverlay{false}
+      }
+    },
+    fill=\WCcolor,
+    overlay=\WCoverlay
+  }
 }
 \wheelchart[
-    middle=Root\\Node,
-    middle style=darkgray,
-    radius={1}{2}
+  middle=Root\\Node,
+  middle style=darkgray,
+  radius={1}{2}
 ]{2/Node 1,1/Node 2,3/Node 3}
 \wheelchart[
-    radius={2}{3}
+  radius={2}{3}
 ]{4/Sub1,4/Sub2,4/Sub3,3/Sub1,3/Sub2,6/Sub1,6/Sub2,3/Sub3,3/Sub4}
 \wheelchart[
-    radius={3}{4}
+  radius={3}{4}
 ]{4/Sub1-Sub1,20/,3/Sub2-Sub1,3/Sub2-Sub2,6/}
 \end{tikzpicture}
 \end{codeexample}
@@ -2574,63 +2746,63 @@
 \fill[background] (-6.8,-8) rectangle (13.8,8);
 \pgfkeys{/wheelchart,data=,radius={1.7}{5}}
 \wheelchart[
-    arc data{18,21}=|\bfseries|\WCvarE{} \WCpercentage{\,}{\unit{\percent}},
-    arc data pos=1.2,
-    arc data style={text color=slice\WCcount},
-    inner data{1,...,20}=\qty{\WCvarC}{\percent}\\[-4pt]yield,
-    inner data pos=0.5,
-    inner data style=\WCvarB,
-    legend entry={
-        \fill[slice\WCcount,shift={({int((\WCcount-1)/17)*4.5-3},0)}] ({45-Mod({\WCcount-1},17)*90/16}:10) circle[radius=0.4]
-        node[\WCvarB,font=\large] {\WCperc}
-        node[black,shift={(0.6,0)},anchor=west,font=\footnotesize,align=left,execute at begin node={\baselineskip=7pt}] {\WCvarD};
-    },
-    lines{18,21}=0.75,
-    lines sep=0.1,
-    lines style={slice\WCcount,dashed,ultra thick},
-    middle=Income\\[-4pt]\& growth\\{\Huge\textcolor{slice21}{\pounds 100k}}\\portfolio,
-    middle fill=white,
-    middle style={font=\bfseries\Large},
-    slices style=slice\WCcount,
-    wheel data={\Large \pounds\WCvarA k},
-    wheel data{21}=\pounds\\[-4pt]\WCvarA\\[-4pt]k,
-    wheel data pos=0.8,
-    wheel data style=\WCvarB
+  arc data{18,21}=|\bfseries|\WCvarE{} \WCperc,
+  arc data pos=1.2,
+  arc data style={text color=slice\WCcount},
+  inner data{1,...,20}=\qty{\WCvarC}{\percent}\\[-4pt]yield,
+  inner data pos=0.5,
+  inner data style=\WCvarB,
+  legend entry={
+    \fill[slice\WCcount,shift={({int((\WCcount-1)/17)*4.5-3},0)}] ({45-Mod({\WCcount-1},17)*90/16}:10) circle[radius=0.4]
+    node[\WCvarB,font=\large] {\WCperc}
+    node[black,shift={(0.6,0)},anchor=west,font=\footnotesize,align=left,execute at begin node={\baselineskip=7pt}] {\WCvarD};
+  },
+  lines{18,21}=0.75,
+  lines sep=0.1,
+  lines style={slice\WCcount,dashed,ultra thick},
+  middle=Income\\[-4pt]\& growth\\{\Huge\textcolor{slice21}{\pounds 100k}}\\portfolio,
+  middle fill=white,
+  middle style={font=\bfseries\Large},
+  slices style=slice\WCcount,
+  wheel data={\Large \pounds\WCvarA k},
+  wheel data{21}=\pounds\\[-4pt]\WCvarA\\[-4pt]k,
+  wheel data pos=0.8,
+  wheel data style=\WCvarB
 ]{%
-    5/text1/4.26/Miton Multi-Cap\\Income/,
-    6/text1/6.86/Schroder Income\\Maximiser/,
-    6/text1/3.82/Trojan\\Income/,
-    7/text1/3.32/CF Woodford\\Equity Income/,
-    7/text1/2.91/Artemis Global\\Income/,
-    4/text1/2.87/First State Global\\Listed Infrastructure/,
-    4/slice5/2.63/Lazard Global\\Listed Infrastructure/,
-    4/slice5/3.50/Legg Mason RARE\\Global Income/,
-    6/slice5/2.55/Newton Global\\Income/,
-    5/text1/4.6/Henderson\\Strategic Bond/,
-    4/text1/5.01/Invesco Perpetual\\Monthly Income Plus/,
-    5/text1/4.4/Jupiter Strategic\\Bond/,
-    4/slice11/0/L\&G All Stocks Index\\Linked Gilt Index/,
-    5/slice11/2.3/L\&G Short Dated Sterling\\Corporate Bond Index/,
-    4/slice11/5.95/Royal London Short Duration\\Global High Yield Bond/,
-    4/slice10/3.55/TwentyFour\\Corporate Bond/,
-    4/slice10/5.03/TwentyFour\\Dynamic Bond/,
-    5/text1/4.8/F\&C Property Growth\\\& Income/PROPERTY,
-    5/text1/4.44/Aviva Multi Strategy\\Target Income/,
-    5/text1/3.45/Invesco\\Perpetual\\Global Targeted\\Income/,
-    1/text2/0.01/Cash/CASH%
+  5/text1/4.26/Miton Multi-Cap\\Income/,
+  6/text1/6.86/Schroder Income\\Maximiser/,
+  6/text1/3.82/Trojan\\Income/,
+  7/text1/3.32/CF Woodford\\Equity Income/,
+  7/text1/2.91/Artemis Global\\Income/,
+  4/text1/2.87/First State Global\\Listed Infrastructure/,
+  4/slice5/2.63/Lazard Global\\Listed Infrastructure/,
+  4/slice5/3.50/Legg Mason RARE\\Global Income/,
+  6/slice5/2.55/Newton Global\\Income/,
+  5/text1/4.6/Henderson\\Strategic Bond/,
+  4/text1/5.01/Invesco Perpetual\\Monthly Income Plus/,
+  5/text1/4.4/Jupiter Strategic\\Bond/,
+  4/slice11/0/L\&G All Stocks Index\\Linked Gilt Index/,
+  5/slice11/2.3/L\&G Short Dated Sterling\\Corporate Bond Index/,
+  4/slice11/5.95/Royal London Short Duration\\Global High Yield Bond/,
+  4/slice10/3.55/TwentyFour\\Corporate Bond/,
+  4/slice10/5.03/TwentyFour\\Dynamic Bond/,
+  5/text1/4.8/F\&C Property Growth\\\& Income/PROPERTY,
+  5/text1/4.44/Aviva Multi Strategy\\Target Income/,
+  5/text1/3.45/Invesco\\Perpetual\\Global Targeted\\Income/,
+  1/text2/0.01/Cash/CASH%
 }
 \pgfkeys{/wheelchart,arc={draw=\WCvarB,dashed,ultra thick},arc around text,arc data{1,2,3,5}=|\bfseries|\WCvarC{} \WCvarA{\,}
 {\unit{\percent}},arc data pos=1.1,arc data style={text color=\WCvarB},arc pos=1.1,slices style={fill=none},value{5}=12}
 \wheelchart{%
-    24/slice1/UK EQUITIES,
-    25/slice5/GLOBAL EQUITIES,
-    35/slice10/FIXED INTEREST,
-    3/none/,
-    10/slice20/ALTERNATIVE,
-    1/none/%
+  24/slice1/UK EQUITIES,
+  25/slice5/GLOBAL EQUITIES,
+  35/slice10/FIXED INTEREST,
+  3/none/,
+  10/slice20/ALTERNATIVE,
+  1/none/%
 }
 \fill[disc] (12,-5.5) circle[radius=1.7]
-node[white,font=\Large\bfseries,align=center] {Portfolio\\[-4pt]income\\\pounds\num{3785}\\[10pt]{\large or \qty{3.79}{\percent}}};
+  node[white,font=\Large\bfseries,align=center] {Portfolio\\[-4pt]income\\\pounds\num{3785}\\[10pt]{\large or \qty{3.79}{\percent}}};
 \node[rotate=270,anchor=north west] at (13.8,8) {\emph{Source: Whitechurch Securities}};
 \end{tikzpicture}
 \end{codeexample}
@@ -2642,66 +2814,65 @@
 \begin{tikzpicture}
 \sffamily
 \wheelchart[
-    data=,
-    middle=Optimized\\vibrating\\%
-        systems,
-    middle fill=RoyalBlue,
-    middle style=white,
-    radius={1.2}{4},
-    slices={(0,0) circle[radius=0.8];},
-    slices style=\WCvarA,
-    start half,
-    value=1,
-    wheel data=\WCvarB,
-    wheel data pos=0.5,
-    wheel data style={
-        white,
-        align=center
-    }
+  data=,
+  middle=Optimized\\vibrating\\systems,
+  middle fill=RoyalBlue,
+  middle style=white,
+  radius={1.2}{4},
+  slices={(0,0) circle[radius=0.8];},
+  slices style=\WCvarA,
+  start half,
+  value=1,
+  wheel data=\WCvarB,
+  wheel data pos=0.5,
+  wheel data style={
+    white,
+    align=center
+  }
 ]{%
-    Green/Passive\\control,
-    Maroon/Feed-\\forward,
-    Orange/Active\\control%
+  Green/Passive\\control,
+  Maroon/Feed-\\forward,
+  Orange/Active\\control%
 }
 \wheelchart[
-    gap polar=25,
-    radius={2.5}{2.7},
-    slices end arrow={1}{-1},
-    slices start arrow={1}{-1},
-    slices style=Gray,
-    total count=3
+  gap polar=25,
+  radius={2.5}{2.7},
+  slices end arrow={1}{-1},
+  slices start arrow={1}{-1},
+  slices style=Gray,
+  total count=3
 ]{}
 \foreach\n in {-30,90,210}{
-    \draw[->,MidnightBlue,ultra thick]
-        (\n:1.7)--(\n:1.3);
+  \draw[->,MidnightBlue,ultra thick]
+    (\n:1.7)--(\n:1.3);
 }
 \fill[
-    top color=Gray!50,
-    bottom color=Gray,
-    draw,
-    even odd rule
+  top color=Gray!50,
+  bottom color=Gray,
+  draw,
+  even odd rule
 ] (0,0) circle[radius=3.5]
-    circle[radius=4.2];
+  circle[radius=4.2];
 \wheelchart[
-    arc{2}={
-        <-,
-        ultra thick
-    },
-    arc around text,
-    arc data=~\WCvarA~,
-    arc data pos=0.5,
-    arc pos=0.5,
-    data=,
-    gap polar=10,
-    radius={3.5}{4.2},
-    slices style={fill=none},
-    start half=180,
-    value=1
+  arc{2}={
+    <-,
+    ultra thick
+  },
+  arc around text,
+  arc data=~\WCvarA~,
+  arc data pos=0.5,
+  arc pos=0.5,
+  data=,
+  gap polar=10,
+  radius={3.5}{4.2},
+  slices style={fill=none},
+  start half=180,
+  value=1
 ]{%
-    {Mass M, Damping D, Stiffness K},
-    Dynamic model,
-    Frequency response functions H,
-    %
+  {Mass M, Damping D, Stiffness K},
+  Dynamic model,
+  Frequency response functions H,
+  %
 }
 \end{tikzpicture}
 \end{codeexample}
@@ -2725,7 +2896,20 @@
 \item In v1.0, the key |data sep| was not applied if the key |lines ext| was used. In v2.0, this is not the case anymore.
 \item In v1.0, a negative value for the key |lines| was not applied. In v2.0, this is not the case anymore.
 \end{itemize}
+\item[] \textbf{Version 3.0 (2024/03/08)}
+\begin{itemize}
+\item Improved the parametrization of the slices in the case that no plot is used. In particular, the |arc| and |arc data| are placed with an arc if no plot is used whereas in v2.0, these were placed with a plot even if no plot was used. Also, the computation of |\WCdataangle| and |\WCmidangle| is more precise than in v2.0.
+\item Optimized the code. The compilation is faster than in v2.0.
+\item Added the commands |\WCangle|, |\WCcoordinate|, |\WCpoint| and |\WCradius|.
+\item \begin{flushleft}Added the keys |arc around line|, |arc data expand|, |arc data line sep factor|, |slices Arrow|, |slices end|, |slices inner|, |slices outer| and |slices start|.\end{flushleft}
+\item Changed the definition of |\WCperc| in the key |arc data| so that |\WCperc| follows the arc or plot.
+\item Added the possibility that the contents of the key |arc data| consists of multiple lines separated by |\\|.
+\item Reduced the functionality of the keys |contour| and |middle fill| to require a fixed inner and outer radius for all slices.
+\item Removed the key |parse|. The values of applicable keys are parsed with |\pgfmathparse|. If a value should be parsed with |l3fp| then |\fpeval| can be used.
+\item In v2.0, the key |arc data angle shift| was not taken into account for the key |arc| in combination with the key |arc around text|. This is fixed in v3.0.
+\item In v2.0, the number of items for each slice in the \meta{wheelchart data} which can be accessed with the macros |\WCvarA| and so on was determined by the number of items for the last slice. For example, |data{1}=\WCvarD| in combination with the \meta{wheelchart data} |1/black/A/a,2/gray/B| was not possible with v2.0. This is not a limitation anymore with v3.0.
 \end{itemize}
+\end{itemize}
 \begin{thebibliography}{9}
 \bibitem{JhcIparowcltopotPGFm}
 Jake,

Modified: branches/branch2023.final/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty
===================================================================
--- branches/branch2023.final/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty	2024-03-08 23:22:34 UTC (rev 70517)
+++ branches/branch2023.final/Master/texmf-dist/tex/latex/wheelchart/wheelchart.sty	2024-03-08 23:22:43 UTC (rev 70518)
@@ -1,5 +1,5 @@
 %% wheelchart.sty
-%% Copyright 2023 Matthias Floré
+%% Copyright 2022-2024 Matthias Floré
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3c
@@ -18,7 +18,7 @@
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{tikz}
 \usetikzlibrary{calc}
-\ProvidesExplPackage{wheelchart}{2023/12/03}{2.0}{Draw wheelcharts with TikZ}
+\ProvidesExplPackage{wheelchart}{2024/03/08}{3.0}{Diagrams with circular or other shapes using TikZ and LaTeX3}
 
 %%> \subsection{Variables}
 
@@ -27,7 +27,6 @@
 \bool_new:N \l__wheelchart_arc_bool
 \bool_new:N \l__wheelchart_contour_bool
 \bool_new:N \g__wheelchart_def_angle_radius_shift_bool
-\bool_new:N \l__wheelchart_def_inner_contour_bool
 \bool_new:N \l__wheelchart_discrete_bool
 \bool_new:N \l__wheelchart_etoc_use_name_bool
 \bool_new:N \l__wheelchart_legend_only_bool
@@ -46,33 +45,38 @@
 \clist_new:N \g__wheelchart_slice_range_for_loop_clist
 \clist_new:N \l__wheelchart_slice_range_local_clist
 
-\fp_const:Nn \c__wheelchart_arc_data_end_factor_center_fp { 0.5 }
-\fp_const:Nn \c__wheelchart_arc_data_end_factor_left_fp { 1 }
-\fp_const:Nn \c__wheelchart_arc_data_end_factor_right_fp { 0 }
-\fp_const:Nn \c__wheelchart_arc_data_start_factor_center_fp { -0.5 }
-\fp_const:Nn \c__wheelchart_arc_data_start_factor_left_fp { 0 }
-\fp_const:Nn \c__wheelchart_arc_data_start_factor_right_fp { -1 }
-\fp_new:N \l__wheelchart_abs_half_angle_minus_new_angle_fp
 \fp_new:N \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp
 \fp_new:N \l__wheelchart_anchor_xsep_fp
 \fp_new:N \l__wheelchart_anchor_ysep_fp
 \fp_new:N \g__wheelchart_angle_fp
-\fp_new:N \l__wheelchart_angle_wheel_lines_fp
+\fp_new:N \l__wheelchart_arc_around_line_fp
 \fp_new:N \l__wheelchart_arc_data_angle_pos_fp
 \fp_new:N \l__wheelchart_arc_data_angle_shift_fp
+\fp_new:N \g__wheelchart_arc_data_aux_i_fp
+\fp_new:N \g__wheelchart_arc_data_aux_ii_fp
 \fp_new:N \l__wheelchart_arc_data_dir_fp
-\fp_new:N \g__wheelchart_arc_data_factor_fp
+\fp_const:Nn \c__wheelchart_arc_data_end_factor_center_fp { 0.5 }
+\fp_const:Nn \c__wheelchart_arc_data_end_factor_left_fp { 1 }
+\fp_const:Nn \c__wheelchart_arc_data_end_factor_right_fp { 0 }
+\fp_new:N \l__wheelchart_arc_data_line_sep_factor_fp
 \fp_new:N \l__wheelchart_arc_data_pos_fp
+\fp_new:N \l__wheelchart_arc_data_radius_plot_false_fp
 \fp_new:N \l__wheelchart_arc_data_sep_fp
 \fp_new:N \g__wheelchart_arc_data_slice_length_fp
+\fp_new:N \l__wheelchart_arc_data_start_angle_plot_false_fp
+\fp_const:Nn \c__wheelchart_arc_data_start_factor_center_fp { -0.5 }
+\fp_const:Nn \c__wheelchart_arc_data_start_factor_left_fp { 0 }
+\fp_const:Nn \c__wheelchart_arc_data_start_factor_right_fp { -1 }
+\fp_new:N \l__wheelchart_arc_data_text_pos_fp
+\fp_new:N \l__wheelchart_arc_data_total_angle_plot_false_fp
 \fp_new:N \l__wheelchart_arc_pos_fp
+\fp_new:N \l__wheelchart_arc_radius_fp
 \fp_new:N \l__wheelchart_arc_sep_fp
+\fp_new:N \l__wheelchart_arc_start_angle_fp
 \fp_new:N \l__wheelchart_coord_determinant_fp
+\fp_new:N \g__wheelchart_coord_x_fp
+\fp_new:N \g__wheelchart_coord_y_fp
 \fp_new:N \l__wheelchart_counter_or_clockwise_fp
-\fp_new:N \l__wheelchart_data_angle_pos_fp
-\fp_new:N \l__wheelchart_data_angle_shift_fp
-\fp_new:N \l__wheelchart_data_pos_fp
-\fp_new:N \l__wheelchart_data_sep_fp
 \fp_new:N \g__wheelchart_def_angle_angle_fp
 \fp_new:N \l__wheelchart_discrete_end_length_fp
 \fp_new:N \l__wheelchart_discrete_factor_fp
@@ -85,7 +89,6 @@
 \fp_new:N \l__wheelchart_discrete_start_length_fp
 \fp_new:N \l__wheelchart_discrete_sublevel_end_length_fp
 \fp_new:N \l__wheelchart_discrete_sublevel_start_length_fp
-\fp_new:N \l__wheelchart_explode_fp
 \fp_new:N \l__wheelchart_gap_fp
 \fp_new:N \l__wheelchart_gap_max_angle_fp
 \fp_new:N \l__wheelchart_gap_max_angle_def_fp
@@ -96,14 +99,11 @@
 \fp_new:N \l__wheelchart_inner_data_angle_shift_fp
 \fp_new:N \l__wheelchart_inner_data_pos_fp
 \fp_new:N \l__wheelchart_inner_data_sep_fp
-\fp_new:c { l__wheelchart_inner~end_x_fp }
-\fp_new:c { l__wheelchart_inner~end_y_fp }
-\fp_new:N \l__wheelchart_inner_gap_fp
-\fp_new:N \l__wheelchart_inner_plot_variable_fp
+\fp_new:c { g__wheelchart_inner~end_x_fp }
+\fp_new:c { g__wheelchart_inner~end_y_fp }
 \fp_new:N \l__wheelchart_inner_radius_fp
-\fp_new:N \l__wheelchart_inner_radius_orig_fp
-\fp_new:c { l__wheelchart_inner~start_x_fp }
-\fp_new:c { l__wheelchart_inner~start_y_fp }
+\fp_new:c { g__wheelchart_inner~start_x_fp }
+\fp_new:c { g__wheelchart_inner~start_y_fp }
 \fp_new:N \l__wheelchart_lines_fp
 \fp_new:N \l__wheelchart_lines_angle_pos_fp
 \fp_new:N \l__wheelchart_lines_angle_shift_fp
@@ -114,21 +114,14 @@
 \fp_new:N \l__wheelchart_lines_pos_fp
 \fp_new:N \l__wheelchart_lines_sep_fp
 \fp_new:N \g__wheelchart_new_angle_fp
-\fp_new:c { l__wheelchart_outer~end_x_fp }
-\fp_new:c { l__wheelchart_outer~end_y_fp }
-\fp_new:N \l__wheelchart_outer_gap_fp
-\fp_new:N \l__wheelchart_outer_plot_variable_fp
+\fp_new:c { g__wheelchart_outer~end_x_fp }
+\fp_new:c { g__wheelchart_outer~end_y_fp }
 \fp_new:N \l__wheelchart_outer_radius_fp
-\fp_new:c { l__wheelchart_outer~start_x_fp }
-\fp_new:c { l__wheelchart_outer~start_y_fp }
-\fp_new:N \l__wheelchart_plot_variable_fp
-\fp_new:N \g__wheelchart_previous_x_coord_fp
-\fp_new:N \g__wheelchart_previous_y_coord_fp
+\fp_new:c { g__wheelchart_outer~start_x_fp }
+\fp_new:c { g__wheelchart_outer~start_y_fp }
+\fp_new:N \g__wheelchart_previous_coord_x_fp
+\fp_new:N \g__wheelchart_previous_coord_y_fp
 \fp_new:N \l__wheelchart_samples_fp
-\fp_new:N \l__wheelchart_slice_inner_end_angle_fp
-\fp_new:N \l__wheelchart_slice_inner_start_angle_fp
-\fp_new:N \l__wheelchart_slice_outer_end_angle_fp
-\fp_new:N \l__wheelchart_slice_outer_start_angle_fp
 \fp_new:N \l__wheelchart_slices_angle_fp
 \fp_new:N \l__wheelchart_slices_angle_pos_fp
 \fp_new:N \l__wheelchart_slices_angle_shift_fp
@@ -152,17 +145,11 @@
 \fp_new:N \l__wheelchart_start_angle_fp
 \fp_new:N \l__wheelchart_total_angle_fp
 \fp_new:N \l__wheelchart_total_count_fp
-\fp_new:N \l__wheelchart_value_fp
-\fp_new:N \g__wheelchart_value_global_fp
 \fp_new:N \l__wheelchart_wheel_data_angle_pos_fp
 \fp_new:N \l__wheelchart_wheel_data_angle_shift_fp
 \fp_new:N \l__wheelchart_wheel_data_pos_fp
 \fp_new:N \l__wheelchart_wheel_data_sep_fp
-\fp_new:N \g__wheelchart_x_coord_fp
-\fp_new:N \g__wheelchart_y_coord_fp
 
-\int_const:Nn \c__wheelchart_lines_ext_dir_left_int { -1 }
-\int_const:Nn \c__wheelchart_lines_ext_dir_right_int { 1 }
 \int_new:N \g__wheelchart_discrete_count_int
 \int_new:N \l__wheelchart_discrete_levels_int
 \int_new:N \l__wheelchart_discrete_partitioning_first_index_int
@@ -176,9 +163,12 @@
 \int_new:N \l__wheelchart_legend_rows_int
 \int_new:N \l__wheelchart_lines_ext_bottom_dir_int
 \int_new:N \l__wheelchart_lines_ext_dir_int
+\int_const:Nn \c__wheelchart_lines_ext_dir_left_int { -1 }
+\int_const:Nn \c__wheelchart_lines_ext_dir_right_int { 1 }
 \int_new:N \l__wheelchart_lines_ext_top_dir_int
-\int_new:N \l__wheelchart_slice_range_index_int
+\int_new:N \l__wheelchart_max_list_items_int
 
+\seq_new:N \l__wheelchart_arc_data_seq
 \seq_new:N \l__wheelchart_discrete_coefficients_first_seq
 \seq_new:N \l__wheelchart_discrete_coefficients_second_seq
 \seq_new:N \l__wheelchart_discrete_points_seq
@@ -185,6 +175,15 @@
 \seq_new:N \l__wheelchart_list_seq
 \seq_new:N \l__wheelchart_list_items_seq
 
+\tl_new:N \WClegend
+\tl_const:Nn \c__wheelchart_arc_around_text_aux_tl
+  {
+    sign ( \l__wheelchart_arc_data_dir_fp ) *
+      (
+        \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end:
+        + \cs:w c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end:
+      )
+  }
 \tl_new:N \l__wheelchart_arc_data_align_tl
 \tl_new:N \l__wheelchart_data_anchor_tl
 \tl_new:N \l__wheelchart_etoc_level_tl
@@ -191,78 +190,77 @@
 \tl_new:N \l__wheelchart_etoc_name_tl
 \tl_new:N \l__wheelchart_expand_list_tl
 \tl_new:N \l__wheelchart_expand_list_items_tl
-\tl_new:N \g__wheelchart_inner_contour_tl
+\tl_new:N \l__wheelchart_inner_plot_variable_tl
 \tl_new:N \l__wheelchart_key_name_tl
 \tl_new:N \l__wheelchart_key_range_tl
 \tl_new:N \l__wheelchart_legend_row_tl
 \tl_new:N \g__wheelchart_name_tl
-\tl_new:N \g__wheelchart_outer_contour_tl
+\tl_new:N \l__wheelchart_outer_plot_variable_tl
+\tl_new:N \l__wheelchart_plot_variable_tl
+\tl_new:N \l__wheelchart_slice_range_index_tl
 \tl_new:N \l__wheelchart_slices_tl
-\tl_new:N \l__wheelchart_slices_end_tl
-\tl_set:Nn \l__wheelchart_slices_end_tl
-  { -- ( \fp_use:c { l__wheelchart_inner~end_x_fp } , \fp_use:c { l__wheelchart_inner~end_y_fp } ) }
-\tl_new:N \l__wheelchart_slices_inner_tl
-\tl_set:Nn \l__wheelchart_slices_inner_tl
-  {
-    \fp_compare:nNnT { \l__wheelchart_inner_radius_fp } > { 0 }
-      {
-        \fp_compare:nNnT { \l__wheelchart_inner_gap_fp } < { \l__wheelchart_abs_half_angle_minus_new_angle_fp }
-          {
-            arc
-              [
-                start~angle = \fp_use:N \l__wheelchart_slice_inner_end_angle_fp ,
-                end~angle = \fp_use:N \l__wheelchart_slice_inner_start_angle_fp ,
-                radius = \fp_use:N \l__wheelchart_inner_radius_fp
-              ]
-          }
-      }
-  }
-\tl_new:N \l__wheelchart_slices_outer_tl
-\tl_set:Nn \l__wheelchart_slices_outer_tl
-  {
-    arc
-      [
-        start~angle = \fp_use:N \l__wheelchart_slice_outer_start_angle_fp ,
-        end~angle = \fp_use:N \l__wheelchart_slice_outer_end_angle_fp ,
-        radius = \fp_use:N \l__wheelchart_outer_radius_fp
-      ]
-  }
-\tl_new:N \l__wheelchart_slices_start_tl
-\tl_set:Nn \l__wheelchart_slices_start_tl { -- cycle }
+\tl_new:N \g__wheelchart_totalcount_tl
 \tl_new:N \l__wheelchart_type_tl
 \tl_set:Nn \l__wheelchart_type_tl { default }
 
 %%> \subsection{Functions}
 
-\cs_generate_variant:Nn \seq_set_split:Nnn { Nen , Neo }
+\cs_generate_variant:Nn \seq_set_split:Nnn { Nen , Neo , Nnf }
 \cs_generate_variant:Nn \tl_build_put_right:Nn { NV }
 
-\cs_new:Npn \__wheelchart_arc_around_text:nnn #1#2#3
+\cs_new_protected:Npn \__wheelchart_arc_around_text_plot_false:nn #1#2
   {
+    \fp_set:Nn \l__wheelchart_arc_start_angle_fp
+      {
+        \__wheelchart_def_angle_plot_false:nnnnn
+          { \WCcount }
+          { \l__wheelchart_arc_data_angle_pos_fp }
+          {
+            ( 0.5 * \c__wheelchart_arc_around_text_aux_tl + #2 - 0.5 ) * \g__wheelchart_arc_data_aux_ii_fp
+            + \l__wheelchart_arc_data_angle_shift_fp
+          }
+          { \l__wheelchart_arc_pos_fp }
+          { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+      }
+    \path
+      [ draw , / wheelchart / arc_style , / wheelchart / arc_#1_half ]
+      ( \fp_use:N \l__wheelchart_arc_start_angle_fp \c_colon_str \fp_use:N \l__wheelchart_arc_radius_fp )
+      arc
+        [
+          start~angle = \fp_use:N \l__wheelchart_arc_start_angle_fp ,
+          end~angle =
+            \__wheelchart_def_angle_plot_false:nnnnn
+              { \WCcount }
+              {#2}
+              { 0 }
+              { \l__wheelchart_arc_pos_fp }
+              { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp } ,
+          radius = \fp_use:N \l__wheelchart_arc_radius_fp
+        ]
+      ;
+  }
+
+\cs_new_protected:Npn \__wheelchart_arc_around_text_plot_true:nnn #1#2#3
+  {
     \__wheelchart_convex_comb_coord_plot:nnnnnnn
       { draw , / wheelchart / arc_style , / wheelchart / arc_#1_half }
+      { 1 }
+      { 0 }
       {
+        \l__wheelchart_plot_variable_tl *
         \fp_eval:n
           {
-            \l__wheelchart_arc_data_angle_pos_fp + 0.5 * \g__wheelchart_arc_data_factor_fp *
-              (
-                sign ( \l__wheelchart_arc_data_dir_fp ) *
-                  (
-                    \fp_use:c { c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp }
-                    + \fp_use:c { c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp }
-                  )
-                + #2
-              )
+            \l__wheelchart_arc_data_angle_pos_fp + 0.5 * \g__wheelchart_arc_data_aux_ii_fp *
+              ( \c__wheelchart_arc_around_text_aux_tl + #2 )
           }
+        + (#3) * ( 1 - \l__wheelchart_plot_variable_tl )
       }
-      {#3}
-      { \l__wheelchart_plot_variable_fp }
-      { 0 }
+      { \l__wheelchart_plot_variable_tl * \l__wheelchart_arc_data_angle_shift_fp }
       { \l__wheelchart_arc_pos_fp }
       { \l__wheelchart_arc_sep_fp }
   }
 
-\cs_new:Npn \__wheelchart_caption_and_title:nnnnn #1#2#3#4#5
+\cs_new_protected:Npn \__wheelchart_caption_and_title:nnnnn #1#2#3#4#5
   {
     \__wheelchart_if_text:nn {#1}
       {
@@ -284,12 +282,12 @@
           {
             \fp_eval:n
               {
-                ( 1 - (#1) ) * \l__wheelchart_slice_inner_start_angle_fp
-                + (#1) * \l__wheelchart_slice_inner_end_angle_fp
+                ( 1 - (#1) ) * \cs:w g__wheelchart_slice_inner_start_angle_\WCcount _fp\cs_end:
+                + (#1) * \cs:w g__wheelchart_slice_inner_end_angle_\WCcount _fp\cs_end:
                 + \l__wheelchart_counter_or_clockwise_fp * (#2)
               }
           }
-          { \fp_eval:n { \l__wheelchart_inner_radius_fp - (#4) } }
+          { \fp_eval:n { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: - (#4) } }
       )
       ! { \fp_eval:n {#3} } !
       (
@@ -297,26 +295,23 @@
           {
             \fp_eval:n
               {
-                ( 1 - (#1) ) * \l__wheelchart_slice_outer_start_angle_fp
-                + (#1) * \l__wheelchart_slice_outer_end_angle_fp
+                ( 1 - (#1) ) * \cs:w g__wheelchart_slice_outer_start_angle_\WCcount _fp\cs_end:
+                + (#1) * \cs:w g__wheelchart_slice_outer_end_angle_\WCcount _fp\cs_end:
                 + \l__wheelchart_counter_or_clockwise_fp * (#2)
               }
           }
-          { \fp_eval:n { \l__wheelchart_outer_radius_fp + (#4) } }
+          { \fp_eval:n { \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + (#4) } }
       )
     $%note the () around the #i's to keep these contents together
   }
 
-\cs_new:Npn \__wheelchart_convex_comb_coord:nnnn #1#2#3#4
-  { \__wheelchart_convex_comb_coord_aux:o { \__wheelchart_convex_comb_coord_def:nnnn {#1} {#2} {#3} {#4} } }
-
-\cs_new:Npn \__wheelchart_convex_comb_coord_plot_aux:nnnn #1#2#3#4
+\cs_new_protected:Npn \__wheelchart_convex_comb_coord_plot_aux:nnnn #1#2#3#4
   {
     \path [#1] plot
       [
         domain = {#2} \c_colon_str {#3} ,
-        samples = \fp_use:N \l__wheelchart_samples_fp ,
-        variable = \l__wheelchart_plot_variable_fp
+        samples = \fp_use:c { g__wheelchart_samples_\WCcount _fp } ,
+        variable = \l__wheelchart_plot_variable_tl
       ]
       ( {#4} ) ;
   }
@@ -323,106 +318,173 @@
 
 \cs_generate_variant:Nn \__wheelchart_convex_comb_coord_plot_aux:nnnn { nnno }
 
-\cs_new:Npn \__wheelchart_convex_comb_coord_plot:nnnnnnn #1#2#3#4#5#6#7
+\cs_new_protected:Npn \__wheelchart_convex_comb_coord_plot:nnnnnnn #1#2#3#4#5#6#7
   {
     \__wheelchart_convex_comb_coord_plot_aux:nnno {#1} {#2} {#3}
       { \__wheelchart_convex_comb_coord_def:nnnn {#4} {#5} {#6} { \g__wheelchart_half_ex_over_one_cm_fp + (#7) } }
   }
 
-\cs_new:Npn \__wheelchart_def_angle:nnnN #1#2#3#4
+\cs_new_protected:Npn \__wheelchart_def_angle_aux:
   {
-    \path let
-      \p { l__wheelchart_def_angle_1 } = \__wheelchart_convex_comb_coord:nnnn {#1} {#2} { 0 } {#3} ,
-      \p { l__wheelchart_def_angle_2 } = \__wheelchart_convex_comb_coord:nnnn {#1} {#2} { 1 } {#3}
-      in
-        [
-          / utils / exec =
-            {
-              \bool_gset:Nn \g__wheelchart_def_angle_radius_shift_bool
-                {
-                  \fp_compare_p:n
-                    {
-                      \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } == 0
-                      &&
-                      \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 } == 0
-                    }
-                }
-              \bool_if:NF \g__wheelchart_def_angle_radius_shift_bool
-                {
-                  \fp_gset:Nn \g__wheelchart_def_angle_angle_fp
-                    {
-                      atand
-                        (
-                          \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } ,
-                          \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 }
-                        )
-                    }%here \pgf at xx and so on are not used
-                }
-            }
-        ]
-      ;
-    \bool_if:NT \g__wheelchart_def_angle_radius_shift_bool
+    \fp_gset:Nn \g__wheelchart_def_angle_angle_fp
       {
+        atand
+          (
+            (
+              \pgf at xx * ( \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } )
+              - \pgf at xy * ( \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 } )
+            )
+            / \l__wheelchart_coord_determinant_fp ,
+            (
+              \pgf at yy * ( \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 } )
+              - \pgf at yx * ( \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } )
+            )
+            / \l__wheelchart_coord_determinant_fp
+          )
+      }%\pgf at xx and so on are necessary if an option such as [x={(-0.5,0)},y={(0,0.5)}] is given to the tikzpicture
+  }
+
+\cs_new_protected:Npn \__wheelchart_def_angle:nnnn #1#2#3#4
+  {
+    \bool_if:NTF \l__wheelchart_plot_bool
+      {
         \path let
-          \p { l__wheelchart_def_angle_1 } =
-            \__wheelchart_convex_comb_coord:nnnn {#1} {#2} { 0 } { \fp_eval:n { (#3) + 1 / \l__wheelchart_samples_fp } } ,
-          \p { l__wheelchart_def_angle_2 } =
-            \__wheelchart_convex_comb_coord:nnnn {#1} {#2} { 1 } { \fp_eval:n { (#3) + 1 / \l__wheelchart_samples_fp } }
+          \p { l__wheelchart_def_angle_1 } = \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 0 } {#4} ,
+          \p { l__wheelchart_def_angle_2 } = \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 1 } {#4}
           in
             [
               / utils / exec =
                 {
-                  \fp_gset:Nn \g__wheelchart_def_angle_angle_fp
+                  \bool_gset:Nn \g__wheelchart_def_angle_radius_shift_bool
                     {
-                      atand
-                        (
-                          \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } ,
-                          \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 }
-                        )
+                      \fp_compare_p:n
+                        {
+                          \y { l__wheelchart_def_angle_2 } - \y { l__wheelchart_def_angle_1 } == 0
+                          &&
+                          \x { l__wheelchart_def_angle_2 } - \x { l__wheelchart_def_angle_1 } == 0
+                        }
                     }
+                  \bool_if:NF \g__wheelchart_def_angle_radius_shift_bool
+                    { \__wheelchart_def_angle_aux: }
                 }
             ]
-          ;%here \pgf at xx and so on are not used
+          ;
+        \bool_if:NT \g__wheelchart_def_angle_radius_shift_bool
+          {
+            \path let
+              \p { l__wheelchart_def_angle_1 } =
+                \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 0 }
+                  { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp\cs_end: } } ,
+              \p { l__wheelchart_def_angle_2 } =
+                \__wheelchart_point_plot_true:nnnnn { \WCcount } {#1} {#2} { 1 }
+                  { \fp_eval:n { (#4) + 1 / \cs:w g__wheelchart_samples_\WCcount _fp\cs_end: } }
+              in [ / utils / exec = { \__wheelchart_def_angle_aux: } ]
+              ;
+          }
+        \pgfmathparse { Mod ( \fp_use:N \g__wheelchart_def_angle_angle_fp , 360 ) }
       }
-    \pgfmathsetmacro {#4} { Mod ( \fp_use:N \g__wheelchart_def_angle_angle_fp , 360 ) }
+      {
+        \pgfmathparse { Mod ( \__wheelchart_def_angle_plot_false:nnnnn { \WCcount } {#1} {#2} {#3} {#4} , 360 ) }
+      }
   }
 
-\cs_new:Npn \__wheelchart_def_coord_aux:nn #1#2
+\cs_new:Npn \__wheelchart_def_angle_plot_false_aux_angle:nn #1#2
   {
-    \path let \p { l__wheelchart_coord } = ( \use:c { __wheelchart_#1_plot:nn } {#2} { \fp_use:c { l__wheelchart_#1_radius_fp } } )
+    ( 1 - (#2) ) *
+      (
+        \cs:w g__wheelchart_slice_outer_start_angle_#1_fp\cs_end:
+        - \cs:w g__wheelchart_slice_inner_start_angle_#1_fp\cs_end:
+      )
+    + (#2) * ( \cs:w g__wheelchart_slice_outer_end_angle_#1_fp\cs_end: - \cs:w g__wheelchart_slice_inner_end_angle_#1_fp\cs_end: )
+  }
+
+\cs_new:Npn \__wheelchart_def_angle_plot_false:nnnnn #1#2#3#4#5
+  {
+    \fp_eval:n
+      {
+        \fp_compare:nNnTF { \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} } = { 0 }
+          { 0 }
+          {
+            asind
+              (
+                (
+                  sqrt
+                    (
+                      ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: ) ^ 2
+                      - \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: *
+                        (
+                          2 + 2 * cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} )
+                          + \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end:
+                            *
+                              (
+                                (
+                                  sind ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} )
+                                  / \__wheelchart_def_radius:nnn {#1} {#4} {#5}
+                                )
+                                ^ 2
+                              )
+                        )
+                    )
+                  + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: *
+                    (
+                      \cs:w g__wheelchart_inner_radius_#1_fp\cs_end:
+                      - \cs:w g__wheelchart_outer_radius_#1_fp\cs_end:
+                        * cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} )
+                    )
+                    / \__wheelchart_def_radius:nnn {#1} {#4} {#5}
+                )
+                * \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * sind ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} )
+                /
+                (
+                  ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: ) ^ 2
+                  - 2 * \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: * \cs:w g__wheelchart_inner_radius_#1_fp\cs_end:
+                    * ( 1 + cosd ( \__wheelchart_def_angle_plot_false_aux_angle:nn {#1} {#2} ) )
+                )
+              )
+          }
+        + ( 1 - (#2) ) * ( \cs:w g__wheelchart_slice_inner_start_angle_#1_fp\cs_end: )
+        + (#2) * ( \cs:w g__wheelchart_slice_inner_end_angle_#1_fp\cs_end: )
+        + \l__wheelchart_counter_or_clockwise_fp * (#3)
+      }
+  }
+
+\cs_new_protected:Npn \__wheelchart_def_coord:nnnn #1#2#3#4
+  {
+    \path let \p { l__wheelchart_coord } =
+      ( \cs:w __wheelchart_#2_plot:nn\cs_end: {#4} { \fp_use:c { g__wheelchart_#2_radius_\WCcount _fp } } )
       in
         [
           / utils / exec =
             {
-              \fp_gset:Nn \g__wheelchart_x_coord_fp
+              \fp_gset:cn { g__wheelchart_#1_x_fp }
                 {
                   ( \pgf at yy * \x { l__wheelchart_coord } - \pgf at yx * \y { l__wheelchart_coord } ) / \l__wheelchart_coord_determinant_fp
                 }
-              \fp_gset:Nn \g__wheelchart_y_coord_fp
+              \fp_gset:cn { g__wheelchart_#1_y_fp }
                 {
                   ( \pgf at xx * \y { l__wheelchart_coord } - \pgf at xy * \x { l__wheelchart_coord } ) / \l__wheelchart_coord_determinant_fp
                 }
             }
         ]
+        coordinate ( g__wheelchart_slice_\WCcount _#2~#3_coordinate ) at ( \p { l__wheelchart_coord } )
       ;
   }
 
-\cs_new:Npn \__wheelchart_def_coord:nn #1#2
+\cs_new_protected:Npn \__wheelchart_def_fp:nn #1#2
   {
-    \__wheelchart_def_coord_aux:nn {#1} { \fp_use:c { l__wheelchart_slice_#1_#2_angle_fp } }
-    \fp_set_eq:cN { l__wheelchart_#1~#2_x_fp } \g__wheelchart_x_coord_fp
-    \fp_set_eq:cN { l__wheelchart_#1~#2_y_fp } \g__wheelchart_y_coord_fp
+    \pgfmathparse { \pgfkeysvalueof { / wheelchart / #2 } }
+    \fp_set:cn { l__wheelchart_#1_fp } { \pgfmathresult }
   }
 
-\cs_new:Npn \__wheelchart_def_gap:NN #1#2
+\cs_new_protected:Npn \__wheelchart_def_gap:nn #1#2
   {
-    \fp_set:Nn #1
+    \fp_gset:cn { g__wheelchart_#1_gap_\WCcount _fp }
       {
         (#2) * sind ( min ( \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp , \l__wheelchart_gap_max_angle_def_fp ) )
         <
         \l__wheelchart_gap_fp
         ?
-        min ( \l__wheelchart_abs_half_angle_minus_new_angle_fp , \l__wheelchart_gap_max_angle_def_fp )
+        min ( \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: , \l__wheelchart_gap_max_angle_def_fp )
         :
         asind ( min ( \l__wheelchart_gap_fp / ( (#2) + 1 - sign (#2) ) , 1 ) ) + \l__wheelchart_gap_polar_fp
         %note the min ( ... , 1 ) such that the asind is always defined
@@ -430,70 +492,125 @@
       }
   }
 
-\cs_new:Npn \__wheelchart_def_macro:Nn #1#2
+\cs_new_protected:Npn \__wheelchart_def_inner_radius:
   {
-    \str_case:enF { \pgfkeysvalueof { / wheelchart / parse } }
+    \bool_if:NTF \l__wheelchart_pie_bool
+      { \fp_set:Nn \l__wheelchart_inner_radius_fp { 0 } }
       {
-        { pgfmath }
-          {
-            \pgfmathparse {#2}
-            \fp_set:Nn #1 { \pgfmathresult }
-          }
-        { l3fp }
-          { \fp_set:Nn #1 {#2} }
+        \pgfmathparse { \pgfkeysvalueof { / wheelchart / inner~radius } }
+        \fp_set:Nn \l__wheelchart_inner_radius_fp { \pgfmathresult + \l__wheelchart_gap_radius_fp }
       }
-      { \pgfkeys { / errors / unknown~choice~value /. expanded = { parse } { \pgfkeysvalueof { / wheelchart / parse } } } }
   }
 
-\cs_new:Npn \__wheelchart_def_macros:n #1
+\cs_new_protected:Npn \__wheelchart_def_orientation:
+  {%determine the orientation, this is necessary even if no plot is used, for example if
+  %inner radius > outer radius then \g__wheelchart_slices_orientation_fp is different from
+  %\l__wheelchart_counter_or_clockwise_fp
+    \fp_set:Nn \l__wheelchart_slices_orientation_new_angle_fp
+      {
+        \g__wheelchart_angle_fp +
+        (
+          \g__wheelchart_new_angle_fp == \g__wheelchart_angle_fp
+          ?
+          \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
+          :
+          \g__wheelchart_new_angle_fp - \g__wheelchart_angle_fp
+        )
+        / \cs:w g__wheelchart_samples_1_fp\cs_end:
+      }
+    \path let
+      \p { l__wheelchart_slices_orientation_1 } =
+        (
+          \__wheelchart_outer_plot:nn
+            { \fp_use:N \g__wheelchart_angle_fp }
+            { \fp_use:c { g__wheelchart_outer_radius_1_fp } }
+        ) ,
+      \p { l__wheelchart_slices_orientation_2 } =
+        (
+          \__wheelchart_outer_plot:nn
+            { \fp_use:N \l__wheelchart_slices_orientation_new_angle_fp }
+            { \fp_use:c { g__wheelchart_outer_radius_1_fp } }
+        ) ,
+      \p { l__wheelchart_slices_orientation_3 } =
+        (
+          \__wheelchart_inner_plot:nn
+            { \fp_use:N \l__wheelchart_slices_orientation_new_angle_fp }
+            { \fp_use:c { g__wheelchart_inner_radius_1_fp } }
+        ) ,
+      \p { l__wheelchart_slices_orientation_4 } =
+        (
+          \__wheelchart_inner_plot:nn
+            { \fp_use:N \g__wheelchart_angle_fp }
+            { \fp_use:c { g__wheelchart_inner_radius_1_fp } }
+        )
+      in
+        [
+          / utils / exec =
+            {
+              \fp_gset:Nn \g__wheelchart_slices_orientation_fp
+                {
+                  sign
+                    (
+                      0.1 * \y { l__wheelchart_slices_orientation_1 }
+                      * ( \x { l__wheelchart_slices_orientation_4 } - \x { l__wheelchart_slices_orientation_2 } )
+                      + 0.1 * \y { l__wheelchart_slices_orientation_2 }
+                      * ( \x { l__wheelchart_slices_orientation_1 } - \x { l__wheelchart_slices_orientation_3 } )
+                      + 0.1 * \y { l__wheelchart_slices_orientation_3 }
+                      * ( \x { l__wheelchart_slices_orientation_2 } - \x { l__wheelchart_slices_orientation_4 } )
+                      + 0.1 * \y { l__wheelchart_slices_orientation_4 }
+                      * ( \x { l__wheelchart_slices_orientation_3 } - \x { l__wheelchart_slices_orientation_1 } )
+                    )
+                  * sign ( \l__wheelchart_coord_determinant_fp )
+                }
+            }
+        ]
+    ;%the terms are multiplied with 0.1 to try to avoid an overflow
+    \fp_compare:nNnT { \g__wheelchart_slices_orientation_fp } = { 0 }
+      { \fp_gset_eq:NN \g__wheelchart_slices_orientation_fp \l__wheelchart_counter_or_clockwise_fp }
+  }
+
+\cs_new_protected:Npn \__wheelchart_def_outer_radius:
   {
-    \str_case:enF { \pgfkeysvalueof { / wheelchart / parse } }
+    \pgfmathparse { \pgfkeysvalueof { / wheelchart / outer~radius } }
+    \fp_set:Nn \l__wheelchart_outer_radius_fp { \pgfmathresult - \l__wheelchart_gap_radius_fp }
+  }
+
+\cs_new:Npn \__wheelchart_def_radius:nnn #1#2#3
+  {
+    \fp_eval:n
       {
-        { pgfmath }
-          {
-            \clist_map_inline:nn {#1}
-              {
-                \pgfmathparse { \pgfkeysvalueof { / wheelchart / ##1 } }
-                \fp_set:cn { l__wheelchart_\str_map_function:nN {##1} \__wheelchart_space_to_underscore:n _fp } { \pgfmathresult }
-              }
-          }
-        { l3fp }
-          {
-            \clist_map_inline:nn {#1}
-              {
-                \fp_set:cn { l__wheelchart_\str_map_function:nN {##1} \__wheelchart_space_to_underscore:n _fp }
-                  { \pgfkeysvalueof { / wheelchart / ##1 } }
-              }
-          }
+        ( 1 - (#2) ) * ( \cs:w g__wheelchart_inner_radius_#1_fp\cs_end: - (#3) )
+        + (#2) * ( \cs:w g__wheelchart_outer_radius_#1_fp\cs_end: + (#3) )
       }
-      { \pgfkeys { / errors / unknown~choice~value /. expanded = { parse } { \pgfkeysvalueof { / wheelchart / parse } } } }
   }
 
-\cs_new:Npn \__wheelchart_def_slice_angle:nnnn #1#2#3#4
+\cs_new_protected:Npn \__wheelchart_def_slice_angle:nnnn #1#2#3#4
   {
+    \fp_gzero_new:c { g__wheelchart_slice_#1_#2_angle_\WCcount _fp }
     \bool_if:NTF \l__wheelchart_plot_bool
       {
-        \fp_set:cn { l__wheelchart_slice_#1_#2_angle_fp }
+        \fp_gset:cn { g__wheelchart_slice_#1_#2_angle_\WCcount _fp }
           {
-            \fp_use:c { g__wheelchart_#3angle_fp } +
+            \cs:w g__wheelchart_#3angle_fp\cs_end: +
               (
                 \l__wheelchart_counter_or_clockwise_fp *
-                  ( (#4) * \fp_use:c { l__wheelchart_#1_gap_fp } + \fp_use:c { l__wheelchart_slices_#1_#2_angle_shift_fp } )
+                  ( (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp\cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end: )
               )
           }
       }
       {
-        \fp_set:cn { l__wheelchart_slice_#1_#2_angle_fp }
+        \fp_gset:cn { g__wheelchart_slice_#1_#2_angle_\WCcount _fp }
           {
-            \fp_use:c { g__wheelchart_#3angle_fp } +
+            \cs:w g__wheelchart_#3angle_fp\cs_end: +
               (
                 \l__wheelchart_counter_or_clockwise_fp *
                   (
-                    (#4) * \fp_use:c { l__wheelchart_#1_gap_fp } + \fp_use:c { l__wheelchart_slices_#1_#2_angle_shift_fp }
+                    (#4) * \cs:w g__wheelchart_#1_gap_\WCcount _fp\cs_end: + \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end:
                     - asind
                       (
-                        \l__wheelchart_inner_radius_fp * sind ( \fp_use:c { l__wheelchart_slices_#1_#2_angle_shift_fp } )
-                        / \l__wheelchart_outer_radius_fp
+                        \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end:
+                        * sind ( \cs:w l__wheelchart_slices_#1_#2_angle_shift_fp\cs_end: )
+                        / \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end:
                       )
                   )
               )
@@ -501,7 +618,7 @@
       }
   }
 
-\cs_new:Npn \__wheelchart_def_slice_keys:n #1
+\cs_new_protected:Npn \__wheelchart_def_slice_keys:n #1
   {
     {%note the double {{...}} such that the contents is in a group
     %such that pgfkeys which are specific to the current slice are local for this slice
@@ -514,11 +631,10 @@
     }
   }
 
-\cs_new:Npn \__wheelchart_def_WClegend:
+\cs_new_protected:Npn \__wheelchart_def_WClegend:
   {
     \int_set:Nn \l__wheelchart_legend_columns_int
       { \fp_eval:n { ceil ( \WCtotalcount / ceil ( \WCtotalcount / ( \pgfkeysvalueof { / wheelchart / legend~columns } ) ) ) } }
-    \cs_set:Npn \WClegend {}
     \tl_build_begin:N \WClegend
       \int_compare:nNnTF { \l__wheelchart_legend_columns_int } = { 1 }
         { \int_step_inline:nnn { 2 } { \WCtotalcount } { \__wheelchart_legend_append:nn {##1} { \\ } } }
@@ -569,7 +685,7 @@
       {
         \clist_if_empty:NTF \l__wheelchart_header_clist
           {
-            \int_step_inline:nn { \seq_count:N \l__wheelchart_list_items_seq }
+            \int_step_inline:nn { \l__wheelchart_max_list_items_int }
               {
                 \cs_set:cpn { WCvar\int_to_Alph:n {##1} }
                   { \cs:w l__wheelchart_item_WCvar\int_to_Alph:n {##1}_\theg__wheelchart_WCcount_counter\cs_end: }
@@ -576,7 +692,7 @@
               }
           }
           {
-            \int_step_inline:nn { \seq_count:N \l__wheelchart_list_items_seq }
+            \int_step_inline:nn { \l__wheelchart_max_list_items_int }
               {
                 \cs_set:cpn { \pgfkeysvalueof { / wheelchart / header~prefix } \clist_item:Nn \l__wheelchart_header_clist {##1} }
                   {
@@ -601,13 +717,13 @@
               (
                 atand
                   (
-                    \fp_use:c { l__wheelchart_#3_y_fp } - \fp_use:c { l__wheelchart_#4_y_fp } ,
-                    \fp_use:c { l__wheelchart_#3_x_fp } - \fp_use:c { l__wheelchart_#4_x_fp }
+                    \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: ,
+                    \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end:
                   )
                 - atand
                   (
-                    \fp_use:c { l__wheelchart_#1_y_fp } - \fp_use:c { l__wheelchart_#2_y_fp } ,
-                    \fp_use:c { l__wheelchart_#1_x_fp } - \fp_use:c { l__wheelchart_#2_x_fp }
+                    \cs:w g__wheelchart_#1_y_fp\cs_end: - \cs:w g__wheelchart_#2_y_fp\cs_end: ,
+                    \cs:w g__wheelchart_#1_x_fp\cs_end: - \cs:w g__wheelchart_#2_x_fp\cs_end:
                   )
               )
           }
@@ -616,17 +732,12 @@
       )%note the Mod 360 because for example cos(90/2)\neq cos(-270/2)
   }
 
-\cs_new:Npn \__wheelchart_discrete_algorithm:
+\cs_new_protected:Npn \__wheelchart_discrete_algorithm:
   {
-    \__wheelchart_def_macros:n { discrete~factor , gap~radius , samples }
-    \__wheelchart_def_macro:Nn \l__wheelchart_outer_radius_fp
-      { \pgfkeysvalueof { / wheelchart / outer~radius } - \fp_use:N \l__wheelchart_gap_radius_fp }
-    \bool_if:NTF \l__wheelchart_pie_bool
-      { \fp_set:Nn \l__wheelchart_inner_radius_fp { 0 } }
-      {
-        \__wheelchart_def_macro:Nn \l__wheelchart_inner_radius_fp
-          { \pgfkeysvalueof { / wheelchart / inner~radius } + \fp_use:N \l__wheelchart_gap_radius_fp }
-      }
+    \__wheelchart_def_fp:nn { discrete_factor } { discrete~factor }
+    \__wheelchart_def_fp:nn { gap_radius } { gap~radius }
+    \__wheelchart_def_outer_radius:
+    \__wheelchart_def_inner_radius:
     \int_compare:nNnT { \l__wheelchart_discrete_space_at_borders_int } = { -1 }
       {
         \pgfkeys
@@ -639,6 +750,7 @@
     \seq_clear:N \l__wheelchart_discrete_points_seq
     \bool_if:NTF \l__wheelchart_plot_bool
       {
+        \__wheelchart_def_fp:nn { samples } { samples }
         \fp_zero:N \l__wheelchart_discrete_outer_length_fp
         \__wheelchart_discrete_def_coord:nn { outer } { 0 }
         \int_step_inline:nn { \fp_use:N \l__wheelchart_samples_fp - 1 }
@@ -648,8 +760,8 @@
               {
                 sqrt
                   (
-                    ( \g__wheelchart_x_coord_fp - \g__wheelchart_previous_x_coord_fp ) ^ 2
-                    + ( \g__wheelchart_y_coord_fp - \g__wheelchart_previous_y_coord_fp ) ^ 2
+                    ( \g__wheelchart_coord_x_fp - \g__wheelchart_previous_coord_x_fp ) ^ 2
+                    + ( \g__wheelchart_coord_y_fp - \g__wheelchart_previous_coord_y_fp ) ^ 2
                   )
               }
           }
@@ -658,8 +770,8 @@
           {
             sqrt
               (
-                ( \g__wheelchart_x_coord_fp - \g__wheelchart_previous_x_coord_fp ) ^ 2
-                + ( \g__wheelchart_y_coord_fp - \g__wheelchart_previous_y_coord_fp ) ^ 2
+                ( \g__wheelchart_coord_x_fp - \g__wheelchart_previous_coord_x_fp ) ^ 2
+                + ( \g__wheelchart_coord_y_fp - \g__wheelchart_previous_coord_y_fp ) ^ 2
               )
           }
         \fp_zero:N \l__wheelchart_discrete_inner_length_fp
@@ -670,8 +782,8 @@
               {
                 sqrt
                   (
-                    ( \g__wheelchart_x_coord_fp - \g__wheelchart_previous_x_coord_fp ) ^ 2
-                    + ( \g__wheelchart_y_coord_fp - \g__wheelchart_previous_y_coord_fp ) ^ 2
+                    ( \g__wheelchart_coord_x_fp - \g__wheelchart_previous_coord_x_fp ) ^ 2
+                    + ( \g__wheelchart_coord_y_fp - \g__wheelchart_previous_coord_y_fp ) ^ 2
                   )
               }
           }
@@ -680,8 +792,8 @@
           {
             sqrt
               (
-                ( \g__wheelchart_x_coord_fp - \g__wheelchart_previous_x_coord_fp ) ^ 2
-                + ( \g__wheelchart_y_coord_fp - \g__wheelchart_previous_y_coord_fp ) ^ 2
+                ( \g__wheelchart_coord_x_fp - \g__wheelchart_previous_coord_x_fp ) ^ 2
+                + ( \g__wheelchart_coord_y_fp - \g__wheelchart_previous_coord_y_fp ) ^ 2
               )
           }
       }
@@ -857,9 +969,9 @@
     \__wheelchart_for_loop:n
       {
         \pgfkeysvalueof { / wheelchart / before~slices }
-        \int_step_inline:nn { \fp_eval:n { round ( \l__wheelchart_value_fp ) } }%note that \fp_eval:n { round ( ... ) } is necessary
-        %even when the value is an integer because if parse=pgfmath then .0 is added and then
-        %\int_step_inline:nn { \fp_use:N \l__wheelchart_value_fp } would give the messages
+        \int_step_inline:nn { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) } }
+        %note that \fp_eval:n { round ( ... ) } is necessary even when the value is an integer because if parse=pgfmath
+        %then .0 is added and then \int_step_inline:nn { \cs:w g__wheelchart_value_\WCcount _fp\cs_end: } would give the messages
         %Missing character: There is no . in font nullfont! Missing character: There is no 0 in font nullfont!
           {
             \int_gincr:N \g__wheelchart_discrete_count_int
@@ -870,45 +982,70 @@
             %greater than the rounded value of \WCtotalnum.
             %For example if there are 2 values 1.6 and 1.7 then these numbers are 4 and 3 and then there is no 4-th item in the list.
             %However only positive integer values make practical sense for this diagram.
-            \pic [ / wheelchart / slices_style ] at
-              (
-                $
+            \bool_if:NTF \l__wheelchart_plot_bool
+              {
+                \coordinate ( g__wheelchart_slice_##1_####1_coordinate ) at
                   (
-                    \__wheelchart_inner_plot:nn
-                      {
-                        \fp_eval:n
+                    $
+                      (
+                        \__wheelchart_inner_plot:nn
                           {
-                            \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp *
-                              (
-                                \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
-                                  { \l__wheelchart_discrete_partitioning_first_index_int }
-                              )
+                            \fp_eval:n
+                              {
+                                \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp *
+                                  (
+                                    \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
+                                      { \l__wheelchart_discrete_partitioning_first_index_int }
+                                  )
+                              }
                           }
-                      }
-                      { \fp_use:N \l__wheelchart_inner_radius_fp }
-                  )
-                  !
-                    {
-                      \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
-                        { \l__wheelchart_discrete_partitioning_second_index_int }
-                    }
-                  !
+                          { \fp_use:N \l__wheelchart_inner_radius_fp }
+                      )
+                      !
+                        {
+                          \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
+                            { \l__wheelchart_discrete_partitioning_second_index_int }
+                        }
+                      !
+                      (
+                        \__wheelchart_outer_plot:nn
+                          {
+                            \fp_eval:n
+                              {
+                                \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp *
+                                  (
+                                    \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
+                                      { \l__wheelchart_discrete_partitioning_first_index_int }
+                                  )
+                              }
+                          }
+                          { \fp_use:N \l__wheelchart_outer_radius_fp }
+                      )
+                    $
+                  ) ;
+              }
+              {
+                \coordinate ( g__wheelchart_slice_##1_####1_coordinate ) at
                   (
-                    \__wheelchart_outer_plot:nn
+                    \fp_eval:n
                       {
-                        \fp_eval:n
-                          {
-                            \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp *
-                              (
-                                \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
-                                  { \l__wheelchart_discrete_partitioning_first_index_int }
-                              )
-                          }
+                        \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp *
+                          (
+                            \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
+                              { \l__wheelchart_discrete_partitioning_first_index_int }
+                          )
                       }
-                      { \fp_use:N \l__wheelchart_outer_radius_fp }
-                  )
-                $
-              )
+                    \c_colon_str
+                    \fp_eval:n
+                      {
+                        \l__wheelchart_inner_radius_fp
+                        + \seq_item:Nn \l__wheelchart_discrete_coefficients_first_seq
+                          { \l__wheelchart_discrete_partitioning_second_index_int }
+                          * ( \l__wheelchart_outer_radius_fp - \l__wheelchart_inner_radius_fp )
+                      }
+                  ) ;
+              }
+            \pic [ / wheelchart / slices_style ] at ( g__wheelchart_slice_##1_####1_coordinate )
               { code = { \pgfkeysvalueof { / wheelchart / discrete~pic } } } ;
           }
         \pgfkeysvalueof { / wheelchart / after~slices }
@@ -915,12 +1052,14 @@
       }
   }
 
-\cs_new:Npn \__wheelchart_discrete_def_coord:nn #1#2
+\cs_new_protected:Npn \__wheelchart_discrete_def_coord:nn #1#2
   {
-    \fp_gset_eq:NN \g__wheelchart_previous_x_coord_fp \g__wheelchart_x_coord_fp
-    \fp_gset_eq:NN \g__wheelchart_previous_y_coord_fp \g__wheelchart_y_coord_fp
-    \__wheelchart_def_coord_aux:nn
+    \fp_gset_eq:NN \g__wheelchart_previous_coord_x_fp \g__wheelchart_coord_x_fp
+    \fp_gset_eq:NN \g__wheelchart_previous_coord_y_fp \g__wheelchart_coord_y_fp
+    \__wheelchart_def_coord:nnnn
+      { coord }
       {#1}
+      {}
       {
         \fp_eval:n
           {
@@ -930,134 +1069,33 @@
       }
   }
 
-\cs_new:Npn \__wheelchart_for_loop:n #1
+\cs_new_protected:Npn \__wheelchart_for_loop:n #1
   {
-    \fp_gset_eq:NN \g__wheelchart_angle_fp \l__wheelchart_start_angle_fp
     \__wheelchart_for_loop_initial:n
       {
         \__wheelchart_def_slice_keys:n
           {
-            \fp_set_eq:Nc \l__wheelchart_value_fp { l__wheelchart_value_\WCcount _fp }
             \cs_set_eq:Nc \WCpercentage { l__wheelchart_WCpercentage_\WCcount }
             \cs_set_eq:Nc \WCpercentagerounded { l__wheelchart_WCpercentagerounded_\WCcount }
-            \fp_gset:Nn \g__wheelchart_new_angle_fp
-              {
-                \WCcount == \WCtotalcount
-                ?
-                \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
-                :
-                \g__wheelchart_angle_fp +
-                  (
-                    \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_value_fp
-                    * ( \l__wheelchart_total_angle_fp / \WCtotalnum )
-                  )
-              }
-            \__wheelchart_def_macros:n
-              {
-                data~angle~pos ,
-                gap ,
-                gap~max~angle ,
-                gap~polar ,
-                gap~radius ,
-                samples ,
-                slices~inner~end~angle~shift ,
-                slices~inner~start~angle~shift ,
-                slices~outer~end~angle~shift ,
-                slices~outer~start~angle~shift
-              }
-            \__wheelchart_def_macro:Nn \l__wheelchart_outer_radius_fp
-              { \pgfkeysvalueof { / wheelchart / outer~radius } - \fp_use:N \l__wheelchart_gap_radius_fp }
-            \bool_if:NTF \l__wheelchart_pie_bool
-              { \fp_set:Nn \l__wheelchart_inner_radius_fp { 0 } }
-              {
-                \__wheelchart_def_macro:Nn \l__wheelchart_inner_radius_fp
-                  { \pgfkeysvalueof { / wheelchart / inner~radius } + \fp_use:N \l__wheelchart_gap_radius_fp }
-              }
-            \fp_set_eq:NN \l__wheelchart_inner_radius_orig_fp \l__wheelchart_inner_radius_fp
-            \fp_set:Nn \l__wheelchart_abs_half_angle_minus_new_angle_fp
-              { abs ( \g__wheelchart_angle_fp - \g__wheelchart_new_angle_fp ) / 2 }
-            \fp_set:Nn \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp
-              { \l__wheelchart_abs_half_angle_minus_new_angle_fp - \l__wheelchart_gap_polar_fp }
-            \bool_if:NTF \l__wheelchart_plot_bool
-              {
-                \fp_set_eq:NN \l__wheelchart_outer_gap_fp \l__wheelchart_gap_polar_fp
-                \fp_set_eq:NN \l__wheelchart_inner_gap_fp \l__wheelchart_gap_polar_fp
-              }
-              {
-                \fp_set:Nn \l__wheelchart_gap_max_angle_def_fp
-                  {
-                    \l__wheelchart_inner_radius_fp > 0
-                    ?
-                    90
-                    :
-                    (
-                      sind ( \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp ) < 0.001
-                      ?
-                      (
-                        90 < \l__wheelchart_gap_max_angle_fp && \l__wheelchart_gap_max_angle_fp < 180
-                        ?
-                        \l__wheelchart_gap_max_angle_fp
-                        :
-                        90
-                      )
-                      :
-                      (
-                        \l__wheelchart_gap_max_angle_fp < 90 || \l__wheelchart_gap_max_angle_fp > 180
-                        ?
-                        180
-                        :
-                        \l__wheelchart_gap_max_angle_fp
-                      )
-                    )
-                  }
-                \__wheelchart_def_gap:NN \l__wheelchart_outer_gap_fp \l__wheelchart_outer_radius_fp
-                \__wheelchart_def_gap:NN \l__wheelchart_inner_gap_fp \l__wheelchart_inner_radius_fp
-                \fp_compare:nNnT { \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp } > { 0.01 }
-                  {
-                    \fp_set:Nn \l__wheelchart_inner_radius_fp
-                      {
-                        max
-                          (
-                            \l__wheelchart_gap_fp
-                            / sind
-                              (
-                                min
-                                  (
-                                    \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp ,
-                                    \l__wheelchart_gap_max_angle_def_fp
-                                  )
-                              )
-                            ,
-                            \l__wheelchart_inner_radius_fp
-                          )
-                      }
-                  }
-              }
-            \__wheelchart_def_slice_angle:nnnn { inner } { end } { new_ } { -1 }
-            \__wheelchart_def_slice_angle:nnnn { inner } { start } {} { 1 }
-            \__wheelchart_def_slice_angle:nnnn { outer } { end } { new_ } { -1 }
-            \__wheelchart_def_slice_angle:nnnn { outer } { start } {} { 1 }
-            \__wheelchart_def_angle:nnnN { 0.5 } { 0 } { 0 } \WCmidangle
-            \__wheelchart_def_macros:n { data~angle~shift , data~sep }
-            \__wheelchart_def_angle:nnnN
-              { \l__wheelchart_data_angle_pos_fp }
-              { \l__wheelchart_data_angle_shift_fp }
-              { \l__wheelchart_data_sep_fp }
-              \WCdataangle
-            \__wheelchart_def_macros:n { explode }
+            \cs_set:Npe \WCdataangle
+              { \fp_use:c { g__wheelchart_WCdataangle_\WCcount _fp } }
+            \cs_set:Npe \WCmidangle
+              { \fp_use:c { g__wheelchart_WCmidangle_\WCcount _fp } }
             \pgfkeysvalueof { / wheelchart / for~loop~start }%this must be placed after the definition of macros such as \WCpercentage
             %such that these macros can be used in the key for loop start
             \begin { scope }
-              [ shift = { ( \WCmidangle \c_colon_str \fp_use:N \l__wheelchart_explode_fp ) } , / wheelchart / slices_scope ]
+              [
+                shift = { ( \WCmidangle \c_colon_str \fp_use:c { g__wheelchart_explode_\WCcount _fp } ) } ,
+                / wheelchart / slices_scope
+              ]
               #1
             \end { scope }
-            \fp_gset_eq:NN \g__wheelchart_angle_fp \g__wheelchart_new_angle_fp
             \pgfkeysvalueof { / wheelchart / for~loop~end }
           }
       }
   }
 
-\cs_new:Npn \__wheelchart_for_loop_initial:n #1
+\cs_new_protected:Npn \__wheelchart_for_loop_initial:n #1
   {
     \str_case:en { \l__wheelchart_type_tl }
       {
@@ -1068,7 +1106,7 @@
                 \int_step_inline:nn { \WCtotalcount }
                   {
                     \cs_set:Npe \WCcount {##1}
-                    \int_step_inline:nn { \seq_count:N \l__wheelchart_list_items_seq }
+                    \int_step_inline:nn { \l__wheelchart_max_list_items_int }
                       { \cs_set_eq:cc { WCvar\int_to_Alph:n {####1} } { l__wheelchart_item_WCvar\int_to_Alph:n {####1}_##1 } }
                     #1
                   }
@@ -1077,7 +1115,7 @@
                 \int_step_inline:nn { \WCtotalcount }
                   {
                     \cs_set:Npe \WCcount {##1}
-                    \int_step_inline:nn { \seq_count:N \l__wheelchart_list_items_seq }
+                    \int_step_inline:nn { \l__wheelchart_max_list_items_int }
                       {
                         \cs_set_eq:cc
                           { \pgfkeysvalueof { / wheelchart / header~prefix } \clist_item:Nn \l__wheelchart_header_clist {####1} }
@@ -1116,8 +1154,15 @@
       }
   }
 
-\cs_new:Npn \__wheelchart_if_text:nn #1#2
+\cs_new_protected:Npn \__wheelchart_gdef_count_fp:nn #1#2
   {
+    \fp_gzero_new:c { g__wheelchart_#1_\WCcount _fp }
+    \pgfmathparse { \pgfkeysvalueof { / wheelchart / #2 } }
+    \fp_gset:cn { g__wheelchart_#1_\WCcount _fp } { \pgfmathresult }
+  }
+
+\cs_new_protected:Npn \__wheelchart_if_text:nn #1#2
+  {
   %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
     \begin { pgfinterruptpicture }
@@ -1128,7 +1173,7 @@
       { {#2} }
   }
 
-\cs_new:Npn \__wheelchart_initial:n #1
+\cs_new_protected:Npn \__wheelchart_initial:n #1
   {
     \str_case:en { \l__wheelchart_type_tl }
       {
@@ -1137,17 +1182,20 @@
             \tl_if_empty:nTF {#1}
               { \cs_set:Npn \WCtotalcount { 0 } }
               {
-                \use:c { seq_set_split:Ne\l__wheelchart_expand_list_tl }
+                \cs:w seq_set_split:Ne\l__wheelchart_expand_list_tl\cs_end:
                   \l__wheelchart_list_seq
                   { \pgfkeysvalueof { / wheelchart / separator~rows } }
                   {#1}
                 \cs_set:Npe \WCtotalcount { \seq_count:N \l__wheelchart_list_seq }
+                \int_zero:N \l__wheelchart_max_list_items_int
                 \seq_map_indexed_inline:Nn \l__wheelchart_list_seq
                   {
-                    \use:c { seq_set_split:Ne\l__wheelchart_expand_list_items_tl }
+                    \cs:w seq_set_split:Ne\l__wheelchart_expand_list_items_tl\cs_end:
                       \l__wheelchart_list_items_seq
                       { \pgfkeysvalueof { / wheelchart / separator~columns } }
                       {##2}
+                    \int_compare:nNnT { \seq_count:N \l__wheelchart_list_items_seq } > { \l__wheelchart_max_list_items_int }
+                      { \int_set:Nn \l__wheelchart_max_list_items_int { \seq_count:N \l__wheelchart_list_items_seq } }
                     %make sure that the namespace l__wheelchart_item_ below is unique
                     \clist_if_empty:NTF \l__wheelchart_header_clist
                       {
@@ -1184,7 +1232,7 @@
                   { \cs_set:Npn \WCtotalcount { 0 } }
               }
               {
-                \@ifpackageloaded { etoc } {}
+                \IfPackageLoadedTF { etoc } {}
                   { \PackageError { wheelchart } { The~package~etoc~must~be~loaded~to~use~the~key~etoc~level } {} }
                 \etocsetlevel { part } { 0 }
                 \etocsetlevel { chapter } { 0 }
@@ -1197,7 +1245,7 @@
                 \etocsetnexttocdepth { -1 }%only for the next toc
                 \etocsetstyle { \l__wheelchart_etoc_level_tl } {} {}
                   {
-                    \int_compare:nNnT { \int_use:c { g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int } } > { 0 }
+                    \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int\cs_end: } > { 0 }
                       {
                         \cs_gset:cpe
                           {
@@ -1256,7 +1304,7 @@
                   {}
                 \int_gzero_new:c { g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int }
                 \pgfkeysvalueof { / wheelchart / etoc~code }
-                \int_compare:nNnT { \int_use:c { g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int } } > { 0 }
+                \int_compare:nNnT { \cs:w g__wheelchart_etoc_item_\l__wheelchart_etoc_name_tl _count_int\cs_end: } > { 0 }
                   {
                     \cs_gset:cpe
                       {
@@ -1282,27 +1330,41 @@
     \__wheelchart_for_loop_initial:n
       {
         \__wheelchart_def_slice_keys:n
-          {
-            \__wheelchart_def_macros:n { value }
-            \fp_gset_eq:NN \g__wheelchart_value_global_fp \l__wheelchart_value_fp
-          }
-        \fp_zero_new:c { l__wheelchart_value_\WCcount _fp }
-        \fp_set_eq:cN { l__wheelchart_value_\WCcount _fp } \g__wheelchart_value_global_fp
-        \cs_set:Npe \WCtotalnum { \fp_eval:n { \WCtotalnum + \g__wheelchart_value_global_fp } }
+          { \__wheelchart_gdef_count_fp:nn { value } { value } }
+        \cs_set:Npe \WCtotalnum { \fp_eval:n { \WCtotalnum + \cs:w g__wheelchart_value_\WCcount _fp\cs_end: } }
       }
     \int_step_inline:nn { \WCtotalcount }
       {
         \cs_set:cpe { l__wheelchart_WCpercentage_##1 }
-          { \fp_eval:n { \fp_use:c { l__wheelchart_value_##1_fp } / ( \WCtotalnum / 100 ) } }
+          { \fp_eval:n { \cs:w g__wheelchart_value_##1_fp\cs_end: / ( \WCtotalnum / 100 ) } }
         \cs_set:cpe { l__wheelchart_WCpercentagerounded_##1 }
           { \fp_eval:n { round ( \cs:w l__wheelchart_WCpercentage_##1\cs_end: , \pgfkeysvalueof { / wheelchart / perc~precision } ) } }
       }
   }
 
+\cs_new_protected:Npn \__wheelchart_inner_and_wheel_data:n #1
+  {
+    \__wheelchart_if_text:nn { #1~data }
+      {
+        \__wheelchart_def_fp:nn { #1_data_angle_pos } { #1~data~angle~pos }
+        \__wheelchart_def_fp:nn { #1_data_angle_shift } { #1~data~angle~shift }
+        \__wheelchart_def_fp:nn { #1_data_pos } { #1~data~pos }
+        \__wheelchart_def_fp:nn { #1_data_sep } { #1~data~sep }
+        \node [ align = left , / wheelchart / #1_data_style ] at
+          \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end:
+            { \WCcount }
+            { \cs:w l__wheelchart_#1_data_angle_pos_fp\cs_end: }
+            { \cs:w l__wheelchart_#1_data_angle_shift_fp\cs_end: }
+            { \cs:w l__wheelchart_#1_data_pos_fp\cs_end: }
+            { \cs:w l__wheelchart_#1_data_sep_fp\cs_end: }
+          { \pgfkeysvalueof { / wheelchart / #1~data } } ;
+      }
+  }
+
 \cs_new:Npn \__wheelchart_inner_plot:nn #1#2
   { {#1} \c_colon_str {#2} }
 
-\cs_new:Npn \__wheelchart_legend_append:nn #1#2
+\cs_new_protected:Npn \__wheelchart_legend_append:nn #1#2
   {
     \tl_build_put_right:NV \WClegend \l__wheelchart_legend_row_tl%note the V specifier such that \WClegend can also be combined
     %with an S column of the package siunitx and such that \WClegend can be used in a tblr environment of the package tabularray
@@ -1316,27 +1378,44 @@
     \tl_build_put_right:Nn \WClegend {#2}
   }
 
+\cs_new:Npn \__wheelchart_mod:n #1
+  {
+    \int_eval:n
+      {
+        \int_mod:nn { (#1) - \int_compare:nNnTF {#1} > { 0 } { 1 } { 0 } } { \g__wheelchart_totalcount_tl }
+        + \int_compare:nNnTF {#1} > { 0 } { 1 } { \g__wheelchart_totalcount_tl }
+      }
+  }
+
 \cs_new:Npn \__wheelchart_outer_plot:nn #1#2
   { {#1} \c_colon_str {#2} }
 
-\cs_new:Npn \__wheelchart_slices_arc:nnnnnn #1#2#3#4#5#6
+\cs_new:Npn \__wheelchart_point_plot_false:nnnnn #1#2#3#4#5
+  { ( \__wheelchart_def_angle_plot_false:nnnnn {#1} {#2} {#3} {#4} {#5} \c_colon_str \__wheelchart_def_radius:nnn {#1} {#4} {#5} ) }
+
+\cs_new:Npn \__wheelchart_point_plot_true:nnnnn #1#2#3#4#5
+  { \__wheelchart_convex_comb_coord_aux:o { \__wheelchart_convex_comb_coord_def:nnnn {#2} {#3} {#4} {#5} } }
+
+\cs_new_protected:Npn \__wheelchart_slices_arc:nnnnnn #1#2#3#4#5#6
   {
     {
       [
         / utils / exec =
           {
-            \__wheelchart_def_macro:Nn \l__wheelchart_slices_arc_A_fp {#1}
+            \pgfmathparse {#1}
+            \fp_set:Nn \l__wheelchart_slices_arc_A_fp { \pgfmathresult }
             #6
             \fp_set:Nn \l__wheelchart_slices_arc_A_abs_fp { abs ( \l__wheelchart_slices_arc_A_fp ) }
             \fp_compare:nNnF { \l__wheelchart_slices_arc_A_abs_fp } < { 0.01 }
               {
-                \__wheelchart_def_macro:Nn \l__wheelchart_slices_arc_B_fp {#2}
+                \pgfmathparse {#2}
+                \fp_set:Nn \l__wheelchart_slices_arc_B_fp { \pgfmathresult }
                 \fp_set:Nn \l__wheelchart_slices_arc_rotate_fp
                   {
                     atand
                       (
-                        \fp_use:c { l__wheelchart_#3_y_fp } - \fp_use:c { l__wheelchart_#4_y_fp } ,
-                        \fp_use:c { l__wheelchart_#3_x_fp } - \fp_use:c { l__wheelchart_#4_x_fp }
+                        \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: ,
+                        \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end:
                       )
                   }
                 \fp_set:Nn \l__wheelchart_slices_arc_coord_fp
@@ -1375,9 +1454,9 @@
                   --
                     (
                       $
-                        ( \fp_use:c { l__wheelchart_#3_x_fp } , \fp_use:c { l__wheelchart_#3_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#3_coordinate )
                         ! { \fp_eval:n { \l__wheelchart_slices_arc_coord_fp / 2 } } !
-                        ( \fp_use:c { l__wheelchart_#4_x_fp } , \fp_use:c { l__wheelchart_#4_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#4_coordinate )
                       $
                     )
                 }
@@ -1407,8 +1486,8 @@
                           * abs ( ( 1 / \l__wheelchart_slices_arc_A_fp ) + \l__wheelchart_slices_arc_A_fp )
                           * sqrt
                             (
-                              ( \fp_use:c { l__wheelchart_#3_x_fp } - \fp_use:c { l__wheelchart_#4_x_fp } ) ^ 2
-                              + ( \fp_use:c { l__wheelchart_#3_y_fp } - \fp_use:c { l__wheelchart_#4_y_fp } ) ^ 2
+                              ( \cs:w g__wheelchart_#3_x_fp\cs_end: - \cs:w g__wheelchart_#4_x_fp\cs_end: ) ^ 2
+                              + ( \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: ) ^ 2
                             )
                         }
                     }
@@ -1420,16 +1499,18 @@
     }
   }
 
-\cs_new:Npn \__wheelchart_slices_arrow:nnnnn #1#2#3#4#5
+\cs_new_protected:Npn \__wheelchart_slices_arrow:nnnnn #1#2#3#4#5
   {
     {
       [
         / utils / exec =
           {
-            \__wheelchart_def_macro:Nn \l__wheelchart_slices_arrow_A_fp {#1}
+            \pgfmathparse {#1}
+            \fp_set:Nn \l__wheelchart_slices_arrow_A_fp { \pgfmathresult }
             \fp_compare:nNnF { \l__wheelchart_slices_arrow_A_fp } = { 0 }
               {
-                \__wheelchart_def_macro:Nn \l__wheelchart_slices_arrow_B_fp {#2}
+                \pgfmathparse {#2}
+                \fp_set:Nn \l__wheelchart_slices_arrow_B_fp { \pgfmathresult }
                 \fp_set:Nn \l__wheelchart_slices_arrow_coord_fp
                   {
                     \l__wheelchart_slices_arrow_A_fp < 0 && \l__wheelchart_slices_arrow_B_fp < 0 ? 0 : \l__wheelchart_slices_arrow_B_fp
@@ -1447,9 +1528,9 @@
                   --
                     (
                       $
-                        ( \fp_use:c { l__wheelchart_#3_x_fp } , \fp_use:c { l__wheelchart_#3_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#3_coordinate )
                         ! { \fp_eval:n { \l__wheelchart_slices_arrow_coord_fp / 2 } } !
-                        ( \fp_use:c { l__wheelchart_#4_x_fp } , \fp_use:c { l__wheelchart_#4_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#4_coordinate )
                       $
                     )
                 }
@@ -1458,11 +1539,11 @@
                   \fp_eval:n
                     {
                       (
-                        \fp_use:c { l__wheelchart_#3_x_fp } + \fp_use:c { l__wheelchart_#4_x_fp } +
+                        \cs:w g__wheelchart_#3_x_fp\cs_end: + \cs:w g__wheelchart_#4_x_fp\cs_end: +
                           (
                             \g__wheelchart_slices_orientation_fp * ( \l__wheelchart_slices_arrow_coord_fp - 1 )
                             * \l__wheelchart_slices_arrow_A_fp
-                            * ( \fp_use:c { l__wheelchart_#3_y_fp } - \fp_use:c { l__wheelchart_#4_y_fp } )
+                            * ( \cs:w g__wheelchart_#3_y_fp\cs_end: - \cs:w g__wheelchart_#4_y_fp\cs_end: )
                           )
                       )
                       / 2
@@ -1471,11 +1552,11 @@
                   \fp_eval:n
                     {
                       (
-                        \fp_use:c { l__wheelchart_#3_y_fp } + \fp_use:c { l__wheelchart_#4_y_fp } +
+                        \cs:w g__wheelchart_#3_y_fp\cs_end: + \cs:w g__wheelchart_#4_y_fp\cs_end: +
                           (
                             \g__wheelchart_slices_orientation_fp * ( \l__wheelchart_slices_arrow_coord_fp - 1 )
                             * \l__wheelchart_slices_arrow_A_fp
-                            * ( \fp_use:c { l__wheelchart_#4_x_fp } - \fp_use:c { l__wheelchart_#3_x_fp } )
+                            * ( \cs:w g__wheelchart_#4_x_fp\cs_end: - \cs:w g__wheelchart_#3_x_fp\cs_end: )
                           )
                       )
                       / 2
@@ -1486,9 +1567,9 @@
                   --
                     (
                       $
-                        ( \fp_use:c { l__wheelchart_#4_x_fp } , \fp_use:c { l__wheelchart_#4_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#4_coordinate )
                         ! { \fp_eval:n { \l__wheelchart_slices_arrow_coord_fp / 2 } } !
-                        ( \fp_use:c { l__wheelchart_#3_x_fp } , \fp_use:c { l__wheelchart_#3_y_fp } )
+                        ( g__wheelchart_slice_\WCcount _#3_coordinate )
                       $
                     )
                 }
@@ -1508,8 +1589,16 @@
       ]
   }
 
-\cs_new:Npn \__wheelchart_space_to_underscore:n #1
-  { \str_if_eq:nnTF {#1} { ~ } { _ } {#1} }
+\cs_new:Npn \__wheelchart_wheel_lines_aux:nn #1#2
+  {
+    \fp_eval:n
+      {
+        ( 1 - (#1) / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) , 1 ) )
+          * \cs:w g__wheelchart_slice_#2_start_angle_\WCcount _fp\cs_end:
+        + (#1) * \cs:w g__wheelchart_slice_#2_end_angle_\WCcount _fp\cs_end:
+          / max ( round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) , 1 )
+      }
+  }
 
 %%> \subsection{Pgfkeys}
 
@@ -1526,6 +1615,7 @@
         arc_style /. style = {#1}
       } ,
     arc_style /. style = {} ,
+    arc~around~line /. initial = 1 ,
     arc~around~text /. default = true ,%this key is not set up with /.is choice or \bool_set:Nn
     %such that for example \WCvarA can be used as value for this key
     arc~around~text /. initial = false ,
@@ -1536,6 +1626,8 @@
     arc~data~angle~pos /. initial = 0.5 ,
     arc~data~angle~shift /. initial = 0 ,
     arc~data~dir /. initial = 1 ,
+    arc~data~expand /. initial = n ,
+    arc~data~line~sep~factor /. initial = 1 ,
     arc~data~pos /. initial = 1 ,
     arc~data~sep /. initial = 1 ex / 1 cm ,
     arc~data~style /. style = { arc_data_style /. style = {#1} } ,
@@ -1613,7 +1705,7 @@
         \tl_set:Nn \l__wheelchart_etoc_level_tl {#1}
       } ,
     etoc~name /. code = { \tl_set:Nn \l__wheelchart_etoc_name_tl {#1} } ,
-    etoc~name = ,
+    etoc~name = {} ,
     etoc~use~name /. code =
       {
         \tl_set:Nn \l__wheelchart_etoc_name_tl {#1}
@@ -1656,23 +1748,27 @@
     inner~data~sep /. initial = 0.2 ,
     inner~data~style /. style = { inner_data_style /. style = {#1} } ,
     inner_data_style /. style = {} ,
-    inner~plot /. code =
+    inner~plot /. style =
       {
-        \bool_set_true:N \l__wheelchart_plot_bool
-        \cs_set:Npn \__wheelchart_inner_plot:nn ##1##2 {#1}
-        \tl_set:Nn \l__wheelchart_slices_inner_tl
+        bool_set_true = \l__wheelchart_plot_bool ,
+        / utils / exec = { \cs_set:Npn \__wheelchart_inner_plot:nn ##1##2 {#1} } ,
+        slices~inner =
           {
             -- plot
               [
                 domain =
-                  \fp_use:N \l__wheelchart_slice_inner_end_angle_fp
+                  \fp_use:c { g__wheelchart_slice_inner_end_angle_\WCcount _fp }
                   \c_colon_str
-                  \fp_use:N \l__wheelchart_slice_inner_start_angle_fp ,
-                samples = \fp_use:N \l__wheelchart_samples_fp ,
-                variable = \l__wheelchart_inner_plot_variable_fp ,
+                  \fp_use:c { g__wheelchart_slice_inner_start_angle_\WCcount _fp } ,
+                samples = \fp_use:c { g__wheelchart_samples_\WCcount _fp } ,
+                variable = \l__wheelchart_inner_plot_variable_tl ,
                 / wheelchart / inner_plot_style
               ]
-              ( \__wheelchart_inner_plot:nn { \l__wheelchart_inner_plot_variable_fp } { \fp_use:N \l__wheelchart_inner_radius_fp } )
+              (
+                \__wheelchart_inner_plot:nn
+                  { \l__wheelchart_inner_plot_variable_tl }
+                  { \fp_use:c { g__wheelchart_inner_radius_\WCcount _fp } }
+              )
           }
       } ,
     inner~plot~style /. style = { inner_plot_style /. style = {#1} } ,
@@ -1710,8 +1806,11 @@
       {
         \fp_eval:n
           {
-            \l__wheelchart_lines_ext_dir_int
-            * ( \l__wheelchart_outer_radius_fp + \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp )
+            \l__wheelchart_lines_ext_dir_int *
+            (
+              \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + \l__wheelchart_lines_sep_fp
+              + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp
+            )
           }
       } ,
     lines~ext~fixed~right /. initial =
@@ -1718,8 +1817,11 @@
       {
         \fp_eval:n
           {
-            \l__wheelchart_lines_ext_dir_int
-            * ( \l__wheelchart_outer_radius_fp + \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp )
+            \l__wheelchart_lines_ext_dir_int *
+            (
+              \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: + \l__wheelchart_lines_sep_fp
+              + \l__wheelchart_lines_fp + \l__wheelchart_lines_ext_fp
+            )
           }
       } ,
     lines~ext~left~anchor /. initial = mid~east ,
@@ -1741,29 +1843,32 @@
     middle_style /. style = {} ,
     name /. code = { \tl_gset:Ne \g__wheelchart_name_tl {#1} } ,
     name = wheelchart at name ,
-    outer~plot /. code =
+    outer~plot /. style =
       {
-        \bool_set_true:N \l__wheelchart_plot_bool
-        \cs_set:Npn \__wheelchart_outer_plot:nn ##1##2 {#1}
-        \tl_set:Nn \l__wheelchart_slices_outer_tl
+        bool_set_true = \l__wheelchart_plot_bool ,
+        / utils / exec = { \cs_set:Npn \__wheelchart_outer_plot:nn ##1##2 {#1} } ,
+        slices~outer =
           {
             -- plot
             [
               domain =
-                \fp_use:N \l__wheelchart_slice_outer_start_angle_fp
+                \fp_use:c { g__wheelchart_slice_outer_start_angle_\WCcount _fp }
                 \c_colon_str
-                \fp_use:N \l__wheelchart_slice_outer_end_angle_fp ,
-              samples = \fp_use:N \l__wheelchart_samples_fp ,
-              variable = \l__wheelchart_outer_plot_variable_fp ,
+                \fp_use:c { g__wheelchart_slice_outer_end_angle_\WCcount _fp } ,
+              samples = \fp_use:c { g__wheelchart_samples_\WCcount _fp } ,
+              variable = \l__wheelchart_outer_plot_variable_tl ,
               / wheelchart / outer_plot_style
             ]
-            ( \__wheelchart_outer_plot:nn { \l__wheelchart_outer_plot_variable_fp } { \fp_use:N \l__wheelchart_outer_radius_fp } )
+            (
+              \__wheelchart_outer_plot:nn
+                { \l__wheelchart_outer_plot_variable_tl }
+                { \fp_use:c { g__wheelchart_outer_radius_\WCcount _fp } }
+            )
           }
       } ,
     outer~plot~style /. style = { outer_plot_style /. style = {#1} } ,
     outer_plot_style /. style = {} ,
     outer~radius /. initial = 3 ,
-    parse /. initial = pgfmath ,
     perc~precision /. initial = 0 ,
     pie /. code = { \bool_set:Nn \l__wheelchart_pie_bool { \cs:w c_#1_bool\cs_end: } } ,
     pie /. default = true ,
@@ -1870,14 +1975,28 @@
     slices~arc~outer~start~end / true /. value~forbidden ,
     slices~arc~outer~start~end /. initial = false ,
     slices~arc~outer~start~end /. default = true ,
+    slices~Arrow /. style =
+      {
+        slices~end =
+          {
+            -- ( \WCpoint { 1 } {#1} { 0.5 } { 0 } )
+            -- ( \WCpoint { 1 } { 0 } { 0 } { 0 } )
+          } ,
+        slices~start =
+          {
+            -- ( \WCpoint { 0 } {#1} { 0.5 } { 0 } )
+            -- cycle
+          }
+      } ,
     slices~arrow /. style~2~args =
       {
         slices~start~arrow = { - (#1) } {#2} ,
         slices~end~arrow = {#1} {#2}
       } ,
-    slices~end~arc /. code~2~args =
+    slices~end /. initial = { -- ( g__wheelchart_slice_\WCcount _inner~end_coordinate ) } ,
+    slices~end~arc /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_end_tl
+        slices~end =
           {
             \__wheelchart_slices_arc:nnnnnn
               {#1}
@@ -1884,13 +2003,13 @@
               {#2}
               { outer~end }
               { inner~end }
-              { -- ( \fp_use:c { l__wheelchart_inner~end_x_fp } , \fp_use:c { l__wheelchart_inner~end_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _inner~end_coordinate ) }
               {}
           }
       } ,
-    slices~end~arrow /. code~2~args =
+    slices~end~arrow /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_end_tl
+        slices~end =
           {
             \__wheelchart_slices_arrow:nnnnn
               {#1}
@@ -1897,17 +2016,35 @@
               {#2}
               { outer~end }
               { inner~end }
-              { -- ( \fp_use:c { l__wheelchart_inner~end_x_fp } , \fp_use:c { l__wheelchart_inner~end_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _inner~end_coordinate ) }
           }
       } ,
-    slices~end~to /. code~2~args =
+    slices~end~to /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_end_tl
+        slices~end =
           {
             \__wheelchart_slices_to:nn {#2} {#1}
-            ( \fp_use:c { l__wheelchart_inner~end_x_fp } , \fp_use:c { l__wheelchart_inner~end_y_fp } )
+            ( g__wheelchart_slice_\WCcount _inner~end_coordinate )
           }
       } ,
+    slices~inner /. initial =
+      {
+        \fp_compare:nNnT { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: } > { 0 }
+          {
+            \fp_compare:nNnT
+              { \cs:w g__wheelchart_inner_gap_\WCcount _fp\cs_end: }
+              <
+              { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: }
+              {
+                arc
+                  [
+                    start~angle = \fp_use:c { g__wheelchart_slice_inner_end_angle_\WCcount _fp } ,
+                    end~angle = \fp_use:c { g__wheelchart_slice_inner_start_angle_\WCcount _fp } ,
+                    radius = \fp_use:c { g__wheelchart_inner_radius_\WCcount _fp }
+                  ]
+              }
+          }
+      } ,
     slices~inner~angle~reduce /. style =
       {
         slices~inner~end~angle~shift = { - (#1) } ,
@@ -1918,9 +2055,9 @@
         slices~inner~end~angle~shift = {#1} ,
         slices~inner~start~angle~shift = {#1}
       } ,
-    slices~inner~arc /. code~2~args =
+    slices~inner~arc /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_inner_tl
+        slices~inner =
           {
             \__wheelchart_slices_arc:nnnnnn
               {#1}
@@ -1927,7 +2064,7 @@
               {#2}
               { inner~end }
               { inner~start }
-              { -- ( \fp_use:c { l__wheelchart_inner~start_x_fp } , \fp_use:c { l__wheelchart_inner~start_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _inner~start_coordinate ) }
               {}
           }
       } ,
@@ -1934,9 +2071,9 @@
     slices~inner~arc~tangent /. is~choice ,
     slices~inner~arc~tangent / false /. code = {} ,
     slices~inner~arc~tangent / false /. value~forbidden ,
-    slices~inner~arc~tangent / true /. code =
+    slices~inner~arc~tangent / true /. style =
       {
-        \tl_set:Nn \l__wheelchart_slices_inner_tl
+        slices~inner =
           {
             \__wheelchart_slices_arc:nnnnnn
               { \__wheelchart_diff_atan:nnnn { outer~start } { inner~start } { outer~end } { inner~end } }
@@ -1943,7 +2080,7 @@
               { 0 }
               { inner~end }
               { inner~start }
-              { -- ( \fp_use:c { l__wheelchart_inner~start_x_fp } , \fp_use:c { l__wheelchart_inner~start_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _inner~start_coordinate ) }
               {
                 \fp_compare:nNnTF { \l__wheelchart_slices_arc_A_fp } > { 359.99 }
                   { \fp_set:Nn \l__wheelchart_slices_arc_A_fp { 1 } }
@@ -1954,9 +2091,9 @@
     slices~inner~arc~tangent / true /. value~forbidden ,
     slices~inner~arc~tangent /. initial = false ,
     slices~inner~arc~tangent /. default = true ,
-    slices~inner~arrow /. code~2~args =
+    slices~inner~arrow /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_inner_tl
+        slices~inner =
           {
             \__wheelchart_slices_arrow:nnnnn
             {#1}
@@ -1963,19 +2100,28 @@
             {#2}
             { inner~end }
             { inner~start }
-            { -- ( \fp_use:c { l__wheelchart_inner~start_x_fp } , \fp_use:c { l__wheelchart_inner~start_y_fp } ) }
+            { -- ( g__wheelchart_slice_\WCcount _inner~start_coordinate ) }
           }
       } ,
     slices~inner~end~angle~shift /. initial = 0 ,
     slices~inner~start~angle~shift /. initial = 0 ,
-    slices~inner~to /. code~2~args =
+    slices~inner~to /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_inner_tl
+        slices~inner =
           {
             \__wheelchart_slices_to:nn {#2} {#1}
-            ( \fp_use:c { l__wheelchart_inner~start_x_fp } , \fp_use:c { l__wheelchart_inner~start_y_fp } )
+            ( g__wheelchart_slice_\WCcount _inner~start_coordinate )
           }
       } ,
+    slices~outer /. initial =
+      {
+        arc
+          [
+            start~angle = \fp_use:c { g__wheelchart_slice_outer_start_angle_\WCcount _fp } ,
+            end~angle = \fp_use:c { g__wheelchart_slice_outer_end_angle_\WCcount _fp } ,
+            radius = \fp_use:c { g__wheelchart_outer_radius_\WCcount _fp }
+          ]
+      } ,
     slices~outer~angle~reduce /. style =
       {
         slices~outer~end~angle~shift = { - (#1) } ,
@@ -1986,9 +2132,9 @@
         slices~outer~end~angle~shift = {#1} ,
         slices~outer~start~angle~shift = {#1}
       } ,
-    slices~outer~arc /. code~2~args =
+    slices~outer~arc /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_outer_tl
+        slices~outer =
           {
             \__wheelchart_slices_arc:nnnnnn
               {#1}
@@ -1995,7 +2141,7 @@
               {#2}
               { outer~start }
               { outer~end }
-              { -- ( \fp_use:c { l__wheelchart_outer~end_x_fp } , \fp_use:c { l__wheelchart_outer~end_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _outer~end_coordinate ) }
               {}
           }
       } ,
@@ -2002,9 +2148,9 @@
     slices~outer~arc~tangent /. is~choice ,
     slices~outer~arc~tangent / false /. code = {} ,
     slices~outer~arc~tangent / false /. value~forbidden ,
-    slices~outer~arc~tangent / true /. code =
+    slices~outer~arc~tangent / true /. style =
       {
-        \tl_set:Nn \l__wheelchart_slices_outer_tl
+        slices~outer =
           {
             \__wheelchart_slices_arc:nnnnnn
               { \__wheelchart_diff_atan:nnnn { outer~start } { inner~start } { outer~end } { inner~end } }
@@ -2011,7 +2157,7 @@
               { 0 }
               { outer~start }
               { outer~end }
-              { -- ( \fp_use:c { l__wheelchart_outer~end_x_fp } , \fp_use:c { l__wheelchart_outer~end_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _outer~end_coordinate ) }
               {
                 \fp_compare:nNnTF { \l__wheelchart_slices_arc_A_fp } > { 359.99 }
                   { \fp_set:Nn \l__wheelchart_slices_arc_A_fp { 1 } }
@@ -2026,9 +2172,9 @@
     slices~outer~arc~tangent / true /. value~forbidden ,
     slices~outer~arc~tangent /. initial = false ,
     slices~outer~arc~tangent /. default = true ,
-    slices~outer~arrow /. code~2~args =
+    slices~outer~arrow /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_outer_tl
+        slices~outer =
           {
             \__wheelchart_slices_arrow:nnnnn
               {#1}
@@ -2035,17 +2181,17 @@
               {#2}
               { outer~start }
               { outer~end }
-              { -- ( \fp_use:c { l__wheelchart_outer~end_x_fp } , \fp_use:c { l__wheelchart_outer~end_y_fp } ) }
+              { -- ( g__wheelchart_slice_\WCcount _outer~end_coordinate ) }
           }
       } ,
     slices~outer~end~angle~shift /. initial = 0 ,
     slices~outer~start~angle~shift /. initial = 0 ,
-    slices~outer~to /. code~2~args =
+    slices~outer~to /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_outer_tl
+        slices~outer =
           {
             \__wheelchart_slices_to:nn {#1} {#2}
-            ( \fp_use:c { l__wheelchart_outer~end_x_fp } , \fp_use:c { l__wheelchart_outer~end_y_fp } )
+            ( g__wheelchart_slice_\WCcount _outer~end_coordinate )
           }
       } ,
     slices~pos /. initial = 0.5 ,
@@ -2052,9 +2198,10 @@
     slices~scope /. style = { slices_scope /. style = {#1} } ,
     slices_scope /. style = {} ,
     slices~sep /. initial = 0 ,
-    slices~start~arc /. code~2~args =
+    slices~start /. initial = { -- cycle } ,
+    slices~start~arc /. style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_start_tl
+        slices~start =
           {
             \__wheelchart_slices_arc:nnnnnn
               {#1}
@@ -2065,9 +2212,9 @@
               {}
           }
       } ,
-    slices~start~arrow/.code~2~args =
+    slices~start~arrow/.style~2~args =
       {
-        \tl_set:Nn \l__wheelchart_slices_start_tl
+        slices~start =
           {
             \__wheelchart_slices_arrow:nnnnn
               {#1}
@@ -2077,7 +2224,7 @@
               { -- cycle }
           }
       } ,
-    slices~start~to /. code~2~args = { \tl_set:Nn \l__wheelchart_slices_start_tl { \__wheelchart_slices_to:nn {#1} {#2} cycle } } ,
+    slices~start~to /. style~2~args = { slices~start = { \__wheelchart_slices_to:nn {#1} {#2} cycle } } ,
     slices~style /. style = { slices_style /. style = {#1} } ,
     slices_style /. style = {} ,
     slices~style = { \WCvarB } ,
@@ -2094,7 +2241,7 @@
             (#1) -
             \fp_eval:n
               {
-                \l__wheelchart_counter_or_clockwise_fp * \fp_use:c { l__wheelchart_value_1_fp } * 0.5
+                \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_1_fp\cs_end: * 0.5
                 * ( \l__wheelchart_total_angle_fp / \WCtotalnum )
               }
           }
@@ -2112,7 +2259,8 @@
     total~count /. code =
       {
         \tl_set:Nn \l__wheelchart_type_tl { totalcount }
-        \__wheelchart_def_macro:Nn \l__wheelchart_total_count_fp {#1}
+        \pgfmathparse {#1}
+        \fp_set:Nn \l__wheelchart_total_count_fp { \pgfmathresult }
       } ,
     triangle~proportional~area /. style~2~args =
       {
@@ -2134,7 +2282,7 @@
     WC_list /. code~2~args =
       {
         \cs_set:cpn {#1}
-          { \use:e { \clist_item:nn {#2} { \int_mod:nn { \WCcount-1 } { \clist_count:n {#2} } + 1 } } }
+          { \use:e { \clist_item:nn {#2} { \int_mod:nn { \WCcount - 1 } { \clist_count:n {#2} } + 1 } } }
           %note the \use:e such that \WClist<name> also works when given as an argument to pgfmath
           %if the list contains a macro, for example
           %\begin{tikzpicture}
@@ -2199,14 +2347,15 @@
               }
               {
                 \clist_gclear:N \g__wheelchart_slice_range_for_loop_clist
-                \foreach \l__wheelchart_slice_range_index_int [ parse = true ] in \l__wheelchart_key_range_tl
+                \foreach \l__wheelchart_slice_range_index_tl [ parse = true ] in \l__wheelchart_key_range_tl
                   {
                     \clist_gput_right:Ne \g__wheelchart_slice_range_for_loop_clist
-                      { \fp_eval:n { \l__wheelchart_slice_range_index_int } }
+                      { \fp_eval:n { \l__wheelchart_slice_range_index_tl } }
                   }
                 \clist_map_inline:Nn \g__wheelchart_slice_range_for_loop_clist
                   {
-                    \clist_put_right:Nn \l__wheelchart_slice_range_local_clist {##1}
+                    \clist_if_in:NnF \l__wheelchart_slice_range_local_clist {##1}
+                      { \clist_put_right:Nn \l__wheelchart_slice_range_local_clist {##1} }
                     \clist_if_exist:cF { l__wheelchart_slice_##1_keys_clist }
                       { \clist_new:c { l__wheelchart_slice_##1_keys_clist } }
                     \str_if_eq:eeTF { \l__wheelchart_key_name_tl } { slice }
@@ -2226,13 +2375,27 @@
       }
   }%this gives an error message if a key of the form <unknown key for wheelchart>{<range>} is given
 
+%%> \subsection{Additional commands}
+
+\NewExpandableDocumentCommand \WCangle { O { \WCcount } m m m m }
+  { \__wheelchart_def_angle_plot_false:nnnnn { \__wheelchart_mod:n {#1} } {#2} {#3} {#4} {#5} }
+
+\NewExpandableDocumentCommand \WCcoordinate { O { \WCcount } m }
+  { g__wheelchart_slice_\__wheelchart_mod:n {#1}_#2_coordinate }
+
+\NewExpandableDocumentCommand \WCpoint { O { \WCcount } m m m m }
+  { \WCangle [#1] {#2} {#3} {#4} {#5} \c_colon_str \WCradius [#1] {#4} {#5} }
+
+\NewExpandableDocumentCommand \WCradius { O { \WCcount } m m }
+  { \__wheelchart_def_radius:nnn { \__wheelchart_mod:n {#1} } {#2} {#3} }
+
 %%> \subsection{The command \textbackslash wheelchart}
 
-\NewDocumentCommand { \wheelchart } { O{} m }
+\NewDocumentCommand \wheelchart { O {} m }
   {
-    {%note the double {{...}} such that the contents is in a group and such that & can be used in pgfmath in a tabular
+    {%note the double braces {{...}} such that the contents is in a group and such that & can be used in pgfmath in a tabular
       \pgfkeys { / wheelchart , #1 }
-      \@ifpackageloaded { siunitx }
+      \IfPackageLoadedTF { siunitx }
         { \cs_set:Npn \WCperc { \qty { \WCpercentagerounded } { \percent } } }
         { \cs_set:Npn \WCperc { \WCpercentagerounded \, \% } }%the definition of \WCperc is placed inside the command \wheelchart
         %such that \WCperc is not defined outside this command
@@ -2245,63 +2408,175 @@
         }
         {
           \fp_set:Nn \l__wheelchart_coord_determinant_fp { \pgf at yy * \pgf at xx - \pgf at yx * \pgf at xy }
-          \begin { scope } [ shift /. expanded = { \pgfkeysvalueof { / wheelchart / at } } ]
-            \begin { scope } [ local~bounding~box /. expanded = \g__wheelchart_name_tl ]
-              \__wheelchart_def_macros:n { total~angle }
-              \__wheelchart_initial:n {#2}
-              \__wheelchart_def_macros:n { start~angle }
-              \bool_if:NF \l__wheelchart_plot_bool
+          \__wheelchart_def_fp:nn { total_angle } { total~angle }
+          \__wheelchart_initial:n {#2}
+          \tl_gset:Ne \g__wheelchart_totalcount_tl { \WCtotalcount }%\WCtotalcount is local and \g__wheelchart_totalcount_tl is global
+          %because it is used in commands such as \WCangle thus must be available after the command \wheelchart
+          \__wheelchart_def_fp:nn { start_angle } { start~angle }
+          \fp_gset_eq:NN \g__wheelchart_angle_fp \l__wheelchart_start_angle_fp
+          \__wheelchart_for_loop_initial:n
+            {
+              \__wheelchart_def_slice_keys:n
                 {
-                  \bool_set_false:N \l__wheelchart_def_inner_contour_bool
-                  \bool_if:NTF \l__wheelchart_contour_bool
+                  \cs_set_eq:Nc \WCpercentage { l__wheelchart_WCpercentage_\WCcount }
+                  \cs_set_eq:Nc \WCpercentagerounded { l__wheelchart_WCpercentagerounded_\WCcount }
+                  \fp_compare:nNnTF { \WCcount } = { \WCtotalcount }
                     {
-                      \bool_set_true:N \l__wheelchart_def_inner_contour_bool
-                      \tl_build_gbegin:N \g__wheelchart_outer_contour_tl
-                        \__wheelchart_for_loop:n
-                          {
-                            \tl_build_gput_left:Ne \g__wheelchart_outer_contour_tl
-                              {
-                                ( \fp_use:N \g__wheelchart_new_angle_fp \c_colon_str \fp_use:N \l__wheelchart_outer_radius_fp )
-                                arc
-                                  [
-                                    start~angle = \fp_use:N \g__wheelchart_new_angle_fp ,
-                                    end~angle = \fp_use:N \g__wheelchart_angle_fp ,
-                                    radius = \fp_use:N \l__wheelchart_outer_radius_fp
-                                  ]
-                                --
-                              }
-                          }
-                      \tl_build_gend:N \g__wheelchart_outer_contour_tl
+                      \fp_gset:Nn \g__wheelchart_new_angle_fp
+                        { \l__wheelchart_start_angle_fp + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp }
                     }
                     {
-                      \bool_if:NT \l__wheelchart_middle_fill_bool
-                        { \bool_set_true:N \l__wheelchart_def_inner_contour_bool }
+                      \fp_gset:Nn \g__wheelchart_new_angle_fp
+                        {
+                          \g__wheelchart_angle_fp +
+                            (
+                              \l__wheelchart_counter_or_clockwise_fp * \cs:w g__wheelchart_value_\WCcount _fp\cs_end:
+                              * ( \l__wheelchart_total_angle_fp / \WCtotalnum )
+                            )
+                        }
                     }
-                  \bool_if:NT \l__wheelchart_def_inner_contour_bool
+                  \__wheelchart_gdef_count_fp:nn { data_angle_pos } { data~angle~pos }
+                  \__wheelchart_def_fp:nn { gap } { gap }
+                  \__wheelchart_def_fp:nn { gap_max_angle } { gap~max~angle }
+                  \__wheelchart_def_fp:nn { gap_polar } { gap~polar }
+                  \__wheelchart_def_fp:nn { gap_radius } { gap~radius }
+                  \__wheelchart_gdef_count_fp:nn { samples } { samples }
+                  \__wheelchart_def_fp:nn { slices_inner_start_angle_shift } { slices~inner~start~angle~shift }
+                  \__wheelchart_def_fp:nn { slices_inner_end_angle_shift } { slices~inner~end~angle~shift }
+                  \__wheelchart_def_fp:nn { slices_outer_end_angle_shift } { slices~outer~end~angle~shift }
+                  \__wheelchart_def_fp:nn { slices_outer_start_angle_shift } { slices~outer~start~angle~shift }
+                  \__wheelchart_def_outer_radius:
+                  \__wheelchart_def_inner_radius:
+                  \fp_gzero_new:c { g__wheelchart_inner_radius_\WCcount _fp }
+                  \fp_gset_eq:cN { g__wheelchart_inner_radius_\WCcount _fp } \l__wheelchart_inner_radius_fp
+                  \fp_gzero_new:c { g__wheelchart_outer_radius_\WCcount _fp }
+                  \fp_gset_eq:cN { g__wheelchart_outer_radius_\WCcount _fp } \l__wheelchart_outer_radius_fp
+                  \fp_gzero_new:c { g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp }
+                  \fp_gset:cn { g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp }
+                    { abs ( \g__wheelchart_angle_fp - \g__wheelchart_new_angle_fp ) / 2 }
+                  \fp_set:Nn \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp
+                    { \cs:w g__wheelchart_abs_half_angle_minus_new_angle_\WCcount _fp\cs_end: - \l__wheelchart_gap_polar_fp }
+                  \fp_gzero_new:c { g__wheelchart_outer_gap_\WCcount _fp }
+                  \fp_gzero_new:c { g__wheelchart_inner_gap_\WCcount _fp }
+                  \bool_if:NTF \l__wheelchart_plot_bool
                     {
-                      \tl_build_gbegin:N \g__wheelchart_inner_contour_tl
-                        \__wheelchart_for_loop:n
-                          {
-                            \tl_build_gput_right:Ne \g__wheelchart_inner_contour_tl
-                              {
-                                ( \fp_use:N \g__wheelchart_angle_fp \c_colon_str \fp_use:N \l__wheelchart_inner_radius_fp )
-                                arc
-                                  [
-                                    start~angle = \fp_use:N \g__wheelchart_angle_fp ,
-                                    end~angle = \fp_use:N \g__wheelchart_new_angle_fp ,
-                                    radius = \fp_use:N \l__wheelchart_inner_radius_fp
-                                  ]
-                                --
-                              }
-                          }
-                      \tl_build_gend:N \g__wheelchart_inner_contour_tl
+                      \fp_gset_eq:cN { g__wheelchart_outer_gap_\WCcount _fp } \l__wheelchart_gap_polar_fp
+                      \fp_gset_eq:cN { g__wheelchart_inner_gap_\WCcount _fp } \l__wheelchart_gap_polar_fp
                     }
-                  \bool_if:NT \l__wheelchart_middle_fill_bool
                     {
+                      \fp_set:Nn \l__wheelchart_gap_max_angle_def_fp
+                        {
+                          \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: > 0
+                          ?
+                          90
+                          :
+                          (
+                            sind ( \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp ) < 0.001
+                            ?
+                            (
+                              90 < \l__wheelchart_gap_max_angle_fp && \l__wheelchart_gap_max_angle_fp < 180
+                              ?
+                              \l__wheelchart_gap_max_angle_fp
+                              :
+                              90
+                            )
+                            :
+                            (
+                              \l__wheelchart_gap_max_angle_fp < 90 || \l__wheelchart_gap_max_angle_fp > 180
+                              ?
+                              180
+                              :
+                              \l__wheelchart_gap_max_angle_fp
+                            )
+                          )
+                        }
+                      \__wheelchart_def_gap:nn { outer } { \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end: }
+                      \__wheelchart_def_gap:nn { inner } { \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end: }
+                      \fp_compare:nNnT { \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp } > { 0.01 }
+                        {
+                          \fp_gset:cn { g__wheelchart_inner_radius_\WCcount _fp }
+                            {
+                              max
+                                (
+                                  \l__wheelchart_gap_fp
+                                  / sind
+                                    (
+                                      min
+                                        (
+                                          \l__wheelchart_abs_half_angle_minus_new_angle_minus_gap_polar_fp ,
+                                          \l__wheelchart_gap_max_angle_def_fp
+                                        )
+                                    )
+                                  ,
+                                  \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end:
+                                )
+                            }
+                        }
+                    }
+                  \__wheelchart_def_slice_angle:nnnn { inner } { end } { new_ } { -1 }
+                  \__wheelchart_def_slice_angle:nnnn { inner } { start } {} { 1 }
+                  \__wheelchart_def_slice_angle:nnnn { outer } { end } { new_ } { -1 }
+                  \__wheelchart_def_slice_angle:nnnn { outer } { start } {} { 1 }
+                  \__wheelchart_def_angle:nnnn { 0.5 } { 0 } { 0.5 } { 0 }
+                  \cs_set:Npe \WCmidangle { \pgfmathresult }
+                  \__wheelchart_gdef_count_fp:nn { data_angle_shift } { data~angle~shift }
+                  \__wheelchart_gdef_count_fp:nn { data_pos } { data~pos }
+                  \__wheelchart_gdef_count_fp:nn { data_sep } { data~sep }
+                  \__wheelchart_def_angle:nnnn
+                    { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: }
+                    { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: }
+                    { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: }
+                    { \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end: }
+                  \cs_set:Npe \WCdataangle { \pgfmathresult }
+                  \__wheelchart_gdef_count_fp:nn { explode } { explode }
+                  \pgfkeysvalueof { / wheelchart / for~loop~start }%this must be placed after the definition of macros such as
+                  %\WCpercentage such that these macros can be used in the key for loop start
+                  \int_compare:nNnT { \WCcount } = { 1 }
+                    {
+                      \begin { scope }
+                        [
+                          shift = { ( \WCmidangle \c_colon_str \fp_use:c { g__wheelchart_explode_\WCcount _fp } ) } ,
+                          / wheelchart / slices_scope
+                        ]
+                        \__wheelchart_def_orientation:
+                      \end { scope }
+                    }
+                  \fp_gzero_new:c { g__wheelchart_WCdataangle_\WCcount _fp }
+                  \fp_gset:cn { g__wheelchart_WCdataangle_\WCcount _fp } { \WCdataangle }
+                  \fp_gzero_new:c { g__wheelchart_WCmidangle_\WCcount _fp }
+                  \fp_gset:cn { g__wheelchart_WCmidangle_\WCcount _fp } { \WCmidangle }
+                  \fp_gset_eq:NN \g__wheelchart_angle_fp \g__wheelchart_new_angle_fp
+                  \pgfkeysvalueof { / wheelchart / for~loop~end }
+                }
+            }
+          \begin { scope } [ shift /. expanded = { \pgfkeysvalueof { / wheelchart / at } } ]
+            \begin { scope } [ local~bounding~box /. expanded = \g__wheelchart_name_tl ]
+              \bool_if:NT \l__wheelchart_middle_fill_bool
+                {
+                  \bool_if:NF \l__wheelchart_plot_bool
+                    {
+                      \__wheelchart_def_inner_radius:
                       \fill [ / wheelchart / middle_fill ]
-                        \fp_compare:nNnF { \l__wheelchart_total_angle_fp } = { 360 }
-                          { ( 0 , 0 ) -- }
-                        \g__wheelchart_inner_contour_tl cycle ;
+                        \fp_compare:nNnTF { \l__wheelchart_total_angle_fp } = { 360 }
+                          { ( 0 , 0 ) circle [ radius = \fp_use:N \l__wheelchart_inner_radius_fp ] }
+                          {
+                            ( 0 , 0 )
+                            -- ( \fp_use:N \l__wheelchart_start_angle_fp \c_colon_str \fp_use:N \l__wheelchart_inner_radius_fp )
+                            arc
+                              [
+                                start~angle = \fp_use:N \l__wheelchart_start_angle_fp ,
+                                end~angle =
+                                  \fp_eval:n
+                                    {
+                                      \l__wheelchart_start_angle_fp
+                                      + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
+                                    }
+                                  ,
+                                radius = \fp_use:N \l__wheelchart_inner_radius_fp
+                              ]
+                            -- cycle
+                          }
+                        ;
                     }
                 }
               \bool_if:NTF \l__wheelchart_discrete_bool
@@ -2309,116 +2584,53 @@
                 {
                   \__wheelchart_for_loop:n
                     {
-                      \int_compare:nNnT { \WCcount } = { 1 }
-                        {
-                          %determine the orientation, this is necessary even if no plot is used, for example if
-                          %inner radius > outer radius then \g__wheelchart_slices_orientation_fp is different from
-                          %\l__wheelchart_counter_or_clockwise_fp
-                          \fp_set:Nn \l__wheelchart_slices_orientation_new_angle_fp
-                            {
-                              \g__wheelchart_angle_fp +
-                              (
-                                \g__wheelchart_new_angle_fp == \g__wheelchart_angle_fp
-                                ?
-                                \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
-                                :
-                                \g__wheelchart_new_angle_fp - \g__wheelchart_angle_fp
-                              )
-                              / \l__wheelchart_samples_fp
-                            }
-                          \path let
-                            \p { l__wheelchart_slices_orientation_1 } =
-                              (
-                                \__wheelchart_outer_plot:nn
-                                  { \fp_use:N \g__wheelchart_angle_fp }
-                                  { \fp_use:N \l__wheelchart_outer_radius_fp }
-                              ) ,
-                            \p { l__wheelchart_slices_orientation_2 } =
-                              (
-                                \__wheelchart_outer_plot:nn
-                                  { \fp_use:N \l__wheelchart_slices_orientation_new_angle_fp }
-                                  { \fp_use:N \l__wheelchart_outer_radius_fp }
-                              ) ,
-                            \p { l__wheelchart_slices_orientation_3 } =
-                              (
-                                \__wheelchart_inner_plot:nn
-                                  { \fp_use:N \l__wheelchart_slices_orientation_new_angle_fp }
-                                  { \fp_use:N \l__wheelchart_inner_radius_fp }
-                              ) ,
-                            \p { l__wheelchart_slices_orientation_4 } =
-                              (
-                                \__wheelchart_inner_plot:nn
-                                  { \fp_use:N \g__wheelchart_angle_fp }
-                                  { \fp_use:N \l__wheelchart_inner_radius_fp }
-                              )
-                            in
-                              [
-                                / utils / exec =
-                                  {
-                                    \fp_gset:Nn \g__wheelchart_slices_orientation_fp
-                                      {
-                                        sign
-                                          (
-                                            0.1 * \y { l__wheelchart_slices_orientation_1 }
-                                            * ( \x { l__wheelchart_slices_orientation_4 } - \x { l__wheelchart_slices_orientation_2 } )
-                                            + 0.1 * \y { l__wheelchart_slices_orientation_2 }
-                                            * ( \x { l__wheelchart_slices_orientation_1 } - \x { l__wheelchart_slices_orientation_3 } )
-                                            + 0.1 * \y { l__wheelchart_slices_orientation_3 }
-                                            * ( \x { l__wheelchart_slices_orientation_2 } - \x { l__wheelchart_slices_orientation_4 } )
-                                            + 0.1 * \y { l__wheelchart_slices_orientation_4 }
-                                            * ( \x { l__wheelchart_slices_orientation_3 } - \x { l__wheelchart_slices_orientation_1 } )
-                                          )
-                                        * sign ( \l__wheelchart_coord_determinant_fp )
-                                      }
-                                  }
-                              ]
-                          ;%the terms are multiplied with 0.1 to try to avoid an overflow
-                          \fp_compare:nNnT { \g__wheelchart_slices_orientation_fp } = { 0 }
-                            { \fp_gset_eq:NN \g__wheelchart_slices_orientation_fp \l__wheelchart_counter_or_clockwise_fp }
-                        }
                       \pgfkeysvalueof { / wheelchart / before~slices }
                       \bool_if:NTF \l__wheelchart_slices_bool
                         {
-                          \__wheelchart_def_macros:n { slices~angle~pos , slices~angle~shift , slices~pos , slices~sep }
-                          \__wheelchart_def_angle:nnnN
+                          \__wheelchart_def_fp:nn { slices_angle_pos } { slices~angle~pos }
+                          \__wheelchart_def_fp:nn { slices_angle_shift } { slices~angle~shift }
+                          \__wheelchart_def_fp:nn { slices_pos } { slices~pos }
+                          \__wheelchart_def_fp:nn { slices_sep } { slices~sep }
+                          \__wheelchart_def_angle:nnnn
                             { \l__wheelchart_slices_angle_pos_fp }
                             { \l__wheelchart_slices_angle_shift_fp }
+                            { \l__wheelchart_slices_pos_fp }
                             { \l__wheelchart_slices_sep_fp }
-                            \l__wheelchart_slices_angle_fp
+                          \fp_set:Nn \l__wheelchart_slices_angle_fp { \pgfmathresult }
                           \begin { scope }
                             [
                               shift /. expanded =
                                 {
-                                  \__wheelchart_convex_comb_coord:nnnn
+                                  \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end:
+                                    { \WCcount }
                                     { \l__wheelchart_slices_angle_pos_fp }
                                     { \l__wheelchart_slices_angle_shift_fp }
                                     { \l__wheelchart_slices_pos_fp }
                                     { \l__wheelchart_slices_sep_fp }
                                 } ,
-                              rotate = \l__wheelchart_slices_angle_fp
+                              rotate = \fp_use:N \l__wheelchart_slices_angle_fp
                             ]
                             \fill [ / wheelchart / slices_style ] \l__wheelchart_slices_tl
                           \end { scope }
                         }
                         {
-                          %Below we define x and y coordinates of the 4 points of the slice.
                           %We do not use the let operation in the path \fill[/wheelchart/slices_style] ... because then
                           %\n, \p, \x and \y can not be used as macro names inside the argument of a key which is applied
                           %on this path such as the key slices inner arc.
-                          %First it is necessary to define \g__wheelchart_x_coord_fp and \g__wheelchart_y_coord_fp globally. Then we
-                          %define local macros taking these values with an expanded definition. These are defined locally such that
-                          %these macros do not interfere with values of another wheelchart, for example if wheelcharts would be nested.
-                          %We do not use a \coordinate definition because this would be global which is not suited as explained above.
-                          \__wheelchart_def_coord:nn { inner } { end }
-                          \__wheelchart_def_coord:nn { inner } { start }
-                          \__wheelchart_def_coord:nn { outer } { end }
-                          \__wheelchart_def_coord:nn { outer } { start }
+                          \__wheelchart_def_coord:nnnn { inner~end } { inner } { end }
+                            { \fp_use:c { g__wheelchart_slice_inner_end_angle_\WCcount _fp } }
+                          \__wheelchart_def_coord:nnnn { inner~start } { inner } { start }
+                            { \fp_use:c { g__wheelchart_slice_inner_start_angle_\WCcount _fp } }
+                          \__wheelchart_def_coord:nnnn { outer~end } { outer } { end }
+                            { \fp_use:c { g__wheelchart_slice_outer_end_angle_\WCcount _fp } }
+                          \__wheelchart_def_coord:nnnn { outer~start } { outer } { start }
+                            { \fp_use:c { g__wheelchart_slice_outer_start_angle_\WCcount _fp } }
                           \fill [ / wheelchart / slices_style ]
-                            ( \fp_use:c { l__wheelchart_outer~start_x_fp } , \fp_use:c { l__wheelchart_outer~start_y_fp } )
-                            \l__wheelchart_slices_outer_tl
-                            \l__wheelchart_slices_end_tl
-                            \l__wheelchart_slices_inner_tl
-                            \l__wheelchart_slices_start_tl
+                            ( g__wheelchart_slice_\WCcount _outer~start_coordinate )
+                            \pgfkeysvalueof { / wheelchart / slices~outer }
+                            \pgfkeysvalueof { / wheelchart / slices~end }
+                            \pgfkeysvalueof { / wheelchart / slices~inner }
+                            \pgfkeysvalueof { / wheelchart / slices~start }
                             ;
                         }
                       \pgfkeysvalueof { / wheelchart / after~slices }
@@ -2429,53 +2641,110 @@
                   \bool_if:NT \l__wheelchart_wheel_lines_bool
                   %this is placed inside \__wheelchart_for_loop:n such that wheel lines can be applied for specific slices
                     {
-                      \int_step_inline:nnn { 0 } { \fp_eval:n { round ( \l__wheelchart_value_fp ) } }
+                      \int_step_inline:nnn { 0 } { \fp_eval:n { round ( \cs:w g__wheelchart_value_\WCcount _fp\cs_end: ) } }
                       %note the \fp_eval:n { round ( ... ) } to avoid the messages Missing character: There is no ... in font nullfont!
                         {
-                          \fp_set:Nn \l__wheelchart_angle_wheel_lines_fp
+                          \bool_if:NTF \l__wheelchart_plot_bool
                             {
-                              \g__wheelchart_angle_fp
-                              + ( \l__wheelchart_counter_or_clockwise_fp * (####1) * ( \l__wheelchart_total_angle_fp / \WCtotalnum ) )
+                              \draw [ / wheelchart / wheel_lines ]
+                                (
+                                  \__wheelchart_inner_plot:nn
+                                    { \__wheelchart_wheel_lines_aux:nn {####1} { inner } }
+                                    { \fp_use:c { g__wheelchart_inner_radius_\WCcount _fp } }
+                                )
+                                --
+                                (
+                                  \__wheelchart_outer_plot:nn
+                                    { \__wheelchart_wheel_lines_aux:nn {####1} { outer } }
+                                    { \fp_use:c { g__wheelchart_outer_radius_\WCcount _fp } }
+                                )
+                                ;
                             }
-                          \draw [ / wheelchart / wheel_lines ]
-                            (
-                              \__wheelchart_inner_plot:nn
-                                { \fp_use:N \l__wheelchart_angle_wheel_lines_fp }
-                                { \fp_use:N \l__wheelchart_inner_radius_fp }
-                            )
-                            --
-                            (
-                              \__wheelchart_outer_plot:nn
-                                { \fp_use:N \l__wheelchart_angle_wheel_lines_fp }
-                                { \fp_use:N \l__wheelchart_outer_radius_fp }
-                            )
-                            ;
+                            {
+                              \draw [ / wheelchart / wheel_lines ]
+                                (
+                                  \__wheelchart_wheel_lines_aux:nn {####1} { inner }
+                                  \c_colon_str
+                                  \fp_use:c { g__wheelchart_inner_radius_\WCcount _fp }
+                                )
+                                --
+                                (
+                                  \__wheelchart_wheel_lines_aux:nn {####1} { outer }
+                                  \c_colon_str
+                                  \fp_use:c { g__wheelchart_outer_radius_\WCcount _fp }
+                                )
+                                ;
+                            }
                         }
                     }
                 }
-              \bool_if:NF \l__wheelchart_plot_bool
+              \bool_if:NT \l__wheelchart_contour_bool
                 {
-                  \bool_if:NT \l__wheelchart_contour_bool
+                  \bool_if:NF \l__wheelchart_plot_bool
                     {
+                      \__wheelchart_def_outer_radius:
+                      \__wheelchart_def_inner_radius:
                       \fp_compare:nNnTF { \l__wheelchart_total_angle_fp } = { 360 }
                         {
-                          \draw [ / wheelchart / contour_style ] \g__wheelchart_inner_contour_tl cycle ;
-                          \draw [ / wheelchart / contour_style ] \g__wheelchart_outer_contour_tl cycle ;
+                          \draw [ / wheelchart / contour_style ]
+                            ( 0 , 0 ) circle [ radius = \fp_use:N \l__wheelchart_inner_radius_fp ] ;
+                          \draw [ / wheelchart / contour_style ]
+                            ( 0 , 0 ) circle [ radius = \fp_use:N \l__wheelchart_outer_radius_fp ] ;
                         }
                         {
-                          \draw [ / wheelchart / contour_style ] \g__wheelchart_inner_contour_tl \g__wheelchart_outer_contour_tl cycle ;
+                          \draw [ / wheelchart / contour_style ]
+                            ( \fp_use:N \l__wheelchart_start_angle_fp \c_colon_str \fp_use:N \l__wheelchart_inner_radius_fp )
+                            arc
+                              [
+                                start~angle = \fp_use:N \l__wheelchart_start_angle_fp ,
+                                end~angle =
+                                  \fp_eval:n
+                                    {
+                                      \l__wheelchart_start_angle_fp
+                                      + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
+                                    }
+                                  ,
+                                radius = \fp_use:N \l__wheelchart_inner_radius_fp
+                              ]
+                            --
+                              (
+                                \fp_eval:n
+                                  {
+                                    \l__wheelchart_start_angle_fp
+                                    + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
+                                  }
+                                \c_colon_str
+                                \fp_use:N \l__wheelchart_outer_radius_fp
+                              )
+                            arc
+                              [
+                                start~angle =
+                                  \fp_eval:n
+                                    {
+                                      \l__wheelchart_start_angle_fp
+                                      + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_total_angle_fp
+                                    }
+                                  ,
+                                end~angle = \fp_use:N \l__wheelchart_start_angle_fp ,
+                                radius = \fp_use:N \l__wheelchart_outer_radius_fp
+                              ]
+                            -- cycle ;
                         }
                     }
                 }
               \__wheelchart_for_loop:n
                 {
-                  \__wheelchart_def_macros:n
-                    { data~pos , lines , lines~angle~pos , lines~angle~shift , lines~ext , lines~pos , lines~sep }
+                  \__wheelchart_def_fp:nn { lines } { lines }
+                  \__wheelchart_def_fp:nn { lines_angle_pos } { lines~angle~pos }
+                  \__wheelchart_def_fp:nn { lines_angle_shift } { lines~angle~shift }
+                  \__wheelchart_def_fp:nn { lines_ext } { lines~ext }
+                  \__wheelchart_def_fp:nn { lines_pos } { lines~pos }
+                  \__wheelchart_def_fp:nn { lines_sep } { lines~sep }
                   \fp_compare:nNnF { \l__wheelchart_lines_ext_fp } = { 0 }
                     {
                       \bool_if:NF \l__wheelchart_lines_ext_dir_bool
                         {
-                          \__wheelchart_def_macros:n { lines~ext~dirsep }
+                          \__wheelchart_def_fp:nn { lines_ext_dirsep } { lines~ext~dirsep }
                           \int_set:Nn \l__wheelchart_lines_ext_dir_int
                             {
                               \fp_eval:n
@@ -2508,18 +2777,21 @@
                                 }
                             }
                         }
-                      \__wheelchart_def_macros:n { lines~ext~fixed~left , lines~ext~fixed~right }
+                      \__wheelchart_def_fp:nn { lines_ext_fixed_left } { lines~ext~fixed~left }
+                      \__wheelchart_def_fp:nn { lines_ext_fixed_right } { lines~ext~fixed~right }
                     }
                   \fp_compare:nF { \l__wheelchart_lines_fp == 0 && \l__wheelchart_lines_ext_fp == 0 }
                     {
                       \draw [ / wheelchart / lines_style ] let \p { l__wheelchart_lines_1 } =
-                        \__wheelchart_convex_comb_coord:nnnn
-                          { \l__wheelchart_data_angle_pos_fp }
-                          { \l__wheelchart_data_angle_shift_fp }
-                          { \l__wheelchart_data_pos_fp }
+                        \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end:
+                          { \WCcount }
+                          { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: }
+                          { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: }
+                          { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: }
                           { \l__wheelchart_lines_sep_fp + \l__wheelchart_lines_fp }
                         in
-                          \__wheelchart_convex_comb_coord:nnnn
+                          \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end:
+                            { \WCcount }
                             { \l__wheelchart_lines_angle_pos_fp }
                             { \l__wheelchart_lines_angle_shift_fp }
                             { \l__wheelchart_lines_pos_fp }
@@ -2559,7 +2831,20 @@
                                 }
                             }
                           coordinate
-                            [ shift = { ( { \fp_eval:n { \l__wheelchart_lines_ext_dir_int * \l__wheelchart_data_sep_fp } } , 0 ) } ]
+                            [
+                              shift =
+                                {
+                                  (
+                                    {
+                                      \fp_eval:n
+                                        {
+                                          \l__wheelchart_lines_ext_dir_int * \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end:
+                                        }
+                                    } ,
+                                    0
+                                  )
+                                }
+                            ]
                             ( g__wheelchart_data_coordinate )
                         }
                       ;
@@ -2568,7 +2853,8 @@
                     {
                       \fp_compare:nNnTF { \l__wheelchart_lines_ext_fp } = { 0 }
                         {
-                          \__wheelchart_def_macros:n { anchor~xsep , anchor~ysep }
+                          \__wheelchart_def_fp:nn { anchor_xsep } { anchor~xsep }
+                          \__wheelchart_def_fp:nn { anchor_ysep } { anchor~ysep }
                           \pgfmathparse
                             {
                               ( \WCdataangle == 0 ? "west" \c_colon_str
@@ -2590,12 +2876,13 @@
                           \coordinate
                             [
                               at =
-                                \__wheelchart_convex_comb_coord:nnnn
-                                  { \l__wheelchart_data_angle_pos_fp }
-                                  { \l__wheelchart_data_angle_shift_fp }
-                                  { \l__wheelchart_data_pos_fp }
+                                \cs:w __wheelchart_point_plot_\bool_to_str:N \l__wheelchart_plot_bool :nnnnn\cs_end:
+                                  { \WCcount }
+                                  { \cs:w g__wheelchart_data_angle_pos_\WCcount _fp\cs_end: }
+                                  { \cs:w g__wheelchart_data_angle_shift_\WCcount _fp\cs_end: }
+                                  { \cs:w g__wheelchart_data_pos_\WCcount _fp\cs_end: }
                                   {
-                                    \l__wheelchart_data_sep_fp +
+                                    \cs:w g__wheelchart_data_sep_\WCcount _fp\cs_end: +
                                     (
                                       \l__wheelchart_lines_fp == 0
                                       ?
@@ -2617,106 +2904,273 @@
                         { \pgfkeysvalueof { / wheelchart / data } } ;%a separate \node and not at the end of the \draw with lines_style
                         %such that the key lines style is not passed to this \node
                     }
-                  \__wheelchart_def_macros:n { arc~data~angle~pos , arc~data~dir }%these are needed for arc data and arc
+                  \__wheelchart_def_fp:nn { arc_around_line } { arc~around~line }
+                  \__wheelchart_def_fp:nn { arc_data_angle_pos } { arc~data~angle~pos }
+                  \__wheelchart_def_fp:nn { arc_data_angle_shift } { arc~data~angle~shift }
+                  \__wheelchart_def_fp:nn { arc_data_dir } { arc~data~dir }
+                  %these are needed for arc data and arc
                   \pgfinterruptpicture%
                     \fp_gset:Nn \g__wheelchart_half_ex_over_one_cm_fp { 0.5 ex / 1 cm }%
                   \endpgfinterruptpicture%
-                  \fp_gset:Nn \g__wheelchart_arc_data_factor_fp { 0 }
+                  \fp_gset:Nn \g__wheelchart_arc_data_aux_ii_fp { 0 }
                   \__wheelchart_if_text:nn { arc~data }
                     {
-                      \__wheelchart_def_macros:n { arc~data~angle~shift , arc~data~pos , arc~data~sep }
-                      \hbox_set:Nn \l__wheelchart_arc_data_box
-                        { \pgfinterruptpicture { \pgfkeysvalueof { / wheelchart / arc~data } } \endpgfinterruptpicture }
-                      \fp_gset:Nn \g__wheelchart_arc_data_slice_length_fp { 1 }%this is necessary if the value is 0
-                      \__wheelchart_convex_comb_coord_plot:nnnnnnn
+                      \cs_set:Npn \WCperc { \WCpercentagerounded { \, } { \% } }%such that \WCperc follows the arc if used in arc data
+                      %this redefinition of \WCperc is local to the group of arc data
+                      \__wheelchart_def_fp:nn { arc_data_pos } { arc~data~pos }
+                      \__wheelchart_def_fp:nn { arc_data_sep } { arc~data~sep }
+                      \__wheelchart_def_fp:nn { arc_data_line_sep_factor } { arc~data~line~sep~factor }
+                      \cs:w seq_set_split:Nn\pgfkeysvalueof { / wheelchart / arc~data~expand }\cs_end:
+                        \l__wheelchart_arc_data_seq
+                        { \\ }
+                        { \pgfkeysvalueof { / wheelchart / arc~data } }
+                      \seq_map_indexed_inline:Nn \l__wheelchart_arc_data_seq
                         {
-                          overlay ,
-                          decorate ,
-                          decoration =
+                          \fp_set:Nn \l__wheelchart_arc_data_text_pos_fp
                             {
-                              text~along~path ,
-                              text = { {} { \fp_gset:Nn \g__wheelchart_arc_data_slice_length_fp { \pgfdecoratedpathlength } } } ,
-                              raise = -0.5 ex ,
-                              text~align = \l__wheelchart_arc_data_align_tl ,
-                              / wheelchart / arc_data_style
+                              \l__wheelchart_arc_data_pos_fp + 2 * \g__wheelchart_slices_orientation_fp
+                                * ( 2 * ####1 - \seq_count:N \l__wheelchart_arc_data_seq - 1 ) * sign ( \l__wheelchart_arc_data_dir_fp )
+                                * \l__wheelchart_arc_data_line_sep_factor_fp * \g__wheelchart_half_ex_over_one_cm_fp
+                                /
+                                (
+                                  \cs:w g__wheelchart_outer_radius_\WCcount _fp\cs_end:
+                                  - \cs:w g__wheelchart_inner_radius_\WCcount _fp\cs_end:
+                                  + 2 * \l__wheelchart_arc_data_sep_fp
+                                )
+                            }%the sign is needed because \l__wheelchart_arc_data_dir_fp is not necessarily 1 or -1
+                          \hbox_set:Nn \l__wheelchart_arc_data_box
+                            { \pgfinterruptpicture {####2} \endpgfinterruptpicture }
+                          \fp_gset:Nn \g__wheelchart_arc_data_slice_length_fp { 1 }%this is necessary if the value is 0
+                          \bool_if:NTF \l__wheelchart_plot_bool
+                            {
+                              \__wheelchart_convex_comb_coord_plot:nnnnnnn
+                                {
+                                  overlay ,
+                                  decorate ,
+                                  decoration =
+                                    {
+                                      text~along~path ,
+                                      text =
+                                        { {} { \fp_gset:Nn \g__wheelchart_arc_data_slice_length_fp { \pgfdecoratedpathlength } } } ,
+                                      raise = -0.5 ex ,
+                                      text~align = \l__wheelchart_arc_data_align_tl ,
+                                      / wheelchart / arc_data_style
+                                    }
+                                }%get the length of the path
+                                %note the option overlay such that this does not increase the bounding box
+                                %note the {} at the start of text and the braces around \fp_gset:Nn ...
+                                %such that the compilation does not stall
+                                { 0 }
+                                { 1 }
+                                { \l__wheelchart_plot_variable_tl }
+                                { 0 }
+                                { \l__wheelchart_arc_data_text_pos_fp }
+                                { \l__wheelchart_arc_data_sep_fp }
+                              \__wheelchart_convex_comb_coord_plot:nnnnnnn
+                                {
+                                  decorate ,
+                                  decoration =
+                                    {
+                                      text~along~path ,
+                                      text =
+                                        {
+                                          { { \fp_gset:Nn \g__wheelchart_arc_data_aux_i_fp { \the \pgfdecoratedcompleteddistance } } }
+                                          ####2
+                                          {
+                                            {
+                                              \fp_gset:Nn \g__wheelchart_arc_data_aux_i_fp
+                                                {
+                                                  ( \the \pgfdecoratedcompleteddistance - \g__wheelchart_arc_data_aux_i_fp )
+                                                  / \g__wheelchart_arc_data_slice_length_fp
+                                                }
+                                            }
+                                          }
+                                        } ,
+                                      raise = -0.5 ex ,
+                                      text~align = \l__wheelchart_arc_data_align_tl ,
+                                      / wheelchart / arc_data_style
+                                    }
+                                }%note the double braces around \fp_gset:Nn ...
+                                %so that for example arc data=text {\qty{5}{\percent}} is allowed
+                                %note that \def\mytext{}\path[decorate,decoration={text along path,text={\mytext}}] (0,0)--(1,1);
+                                %gives the message Missing character: There is no ... in font nullfont!, then
+                                %text={\pgfkeysvalueof { / wheelchart / arc~data }{}} can be used
+                                %if the \fp_gset:Nn ... would not be present
+                                { \fp_use:c { c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp } }
+                                { \fp_use:c { c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp } }
+                                {
+                                  \l__wheelchart_plot_variable_tl * \l__wheelchart_arc_data_dir_fp * 1.1
+                                  * ( \dim_to_fp:n { \box_wd:N \l__wheelchart_arc_data_box } / \g__wheelchart_arc_data_slice_length_fp )
+                                  + \l__wheelchart_arc_data_angle_pos_fp
+                                }
+                                { \l__wheelchart_arc_data_angle_shift_fp }
+                                { \l__wheelchart_arc_data_text_pos_fp }
+                                { \l__wheelchart_arc_data_sep_fp }
                             }
-                        }%get the length of the path
-                        %note the option overlay such that this does not increase the bounding box
-                        %note the {} at the start of text and the braces around \fp_gset:Nn ... such that the compilation does not stall
-                        { 0 }
-                        { 1 }
-                        { \l__wheelchart_plot_variable_fp }
-                        { 0 }
-                        { \l__wheelchart_arc_data_pos_fp }
-                        { \l__wheelchart_arc_data_sep_fp }
-                      \__wheelchart_convex_comb_coord_plot:nnnnnnn
-                        {
-                          decorate ,
-                          decoration =
                             {
-                              text~along~path ,
-                              text =
+                              \fp_set:Nn \l__wheelchart_arc_data_radius_plot_false_fp
                                 {
-                                  { { \fp_gset:Nn \g__wheelchart_arc_data_factor_fp { \the \pgfdecoratedcompleteddistance } } }
-                                  \pgfkeysvalueof { / wheelchart / arc~data }
-                                  {
+                                  \__wheelchart_def_radius:nnn
+                                    { \WCcount }
+                                    { \l__wheelchart_arc_data_text_pos_fp }
+                                    { \l__wheelchart_arc_data_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+                                }
+                              \fp_set:Nn \l__wheelchart_arc_data_total_angle_plot_false_fp
+                                {
+                                  \box_wd:N \l__wheelchart_arc_data_box * 1.1 /
+                                    (
+                                      sqrt ( abs ( \l__wheelchart_coord_determinant_fp ) )%this is necessary if an option such as
+                                      %[x={(-0.5,0)},y={(0,0.5)}] is given to the tikzpicture
+                                      * \l__wheelchart_arc_data_radius_plot_false_fp * deg
+                                    )
+                                }
+                              \fp_set:Nn \l__wheelchart_arc_data_start_angle_plot_false_fp
+                                {
+                                  \__wheelchart_def_angle_plot_false:nnnnn
+                                    { \WCcount }
+                                    { \l__wheelchart_arc_data_angle_pos_fp }
+                                    { \l__wheelchart_arc_data_angle_shift_fp }
+                                    { \l__wheelchart_arc_data_text_pos_fp }
+                                    { \l__wheelchart_arc_data_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+                                  + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_arc_data_dir_fp
+                                    * \cs:w c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp\cs_end:
+                                    * \l__wheelchart_arc_data_total_angle_plot_false_fp
+                                }
+                              \path
+                                [
+                                  decorate ,
+                                  decoration =
                                     {
-                                      \fp_gset:Nn \g__wheelchart_arc_data_factor_fp
+                                      text~along~path ,
+                                      text =
                                         {
-                                          ( \the \pgfdecoratedcompleteddistance - \g__wheelchart_arc_data_factor_fp )
-                                          / \g__wheelchart_arc_data_slice_length_fp
+                                          { { \fp_gset:Nn \g__wheelchart_arc_data_aux_i_fp { \the \pgfdecoratedcompleteddistance } } }
+                                          ####2
+                                          {
+                                            {
+                                              \fp_gset:Nn \g__wheelchart_arc_data_aux_i_fp
+                                                {
+                                                  ( \the \pgfdecoratedcompleteddistance - \g__wheelchart_arc_data_aux_i_fp )
+                                                  / \l__wheelchart_arc_data_radius_plot_false_fp
+                                                }
+                                            }
+                                          }
+                                        } ,
+                                      raise = -0.5 ex ,
+                                      text~align = \l__wheelchart_arc_data_align_tl ,
+                                      / wheelchart / arc_data_style
+                                    }
+                                ]
+                                (
+                                  \fp_use:N \l__wheelchart_arc_data_start_angle_plot_false_fp
+                                  \c_colon_str
+                                  \fp_use:N \l__wheelchart_arc_data_radius_plot_false_fp
+                                )
+                                arc
+                                  [
+                                    start~angle = \fp_use:N \l__wheelchart_arc_data_start_angle_plot_false_fp ,
+                                    end~angle =
+                                      \fp_eval:n
+                                        {
+                                          \l__wheelchart_arc_data_start_angle_plot_false_fp
+                                          + \l__wheelchart_counter_or_clockwise_fp * \l__wheelchart_arc_data_dir_fp
+                                          * \l__wheelchart_arc_data_total_angle_plot_false_fp
                                         }
-                                    }
-                                  }
-                                } ,
-                              raise = -0.5 ex ,
-                              text~align = \l__wheelchart_arc_data_align_tl ,
-                              / wheelchart / arc_data_style
+                                      ,
+                                    radius = \fp_use:N \l__wheelchart_arc_data_radius_plot_false_fp
+                                  ]
+                                ;
                             }
-                        }%note the double braces around \fp_gset:Nn ... so that for example arc data=text {\qty{5}{\percent}} is allowed
-                        %note that \def\mytext{}\path[decorate,decoration={text along path,text={\mytext}}] (0,0)--(1,1);
-                        %gives the message Missing character: There is no ... in font nullfont!, then
-                        %text={\pgfkeysvalueof { / wheelchart / arc~data }{}} can be used if the \fp_gset:Nn ... would not be present
-                        { \fp_use:c { c__wheelchart_arc_data_start_factor_\l__wheelchart_arc_data_align_tl _fp } }
-                        { \fp_use:c { c__wheelchart_arc_data_end_factor_\l__wheelchart_arc_data_align_tl _fp } }
-                        {
-                          \l__wheelchart_plot_variable_fp * \l__wheelchart_arc_data_dir_fp * 1.1
-                          * ( \dim_to_fp:n { \box_wd:N \l__wheelchart_arc_data_box } / \g__wheelchart_arc_data_slice_length_fp )
-                          + \l__wheelchart_arc_data_angle_pos_fp
-                        }
-                        { \l__wheelchart_arc_data_angle_shift_fp }
-                        { \l__wheelchart_arc_data_pos_fp }
-                        { \l__wheelchart_arc_data_sep_fp }
-                      \fp_compare:nNnT { \g__wheelchart_arc_data_factor_fp } < { 0 }
-                        {
-                          \PackageWarning { wheelchart }
+                          \fp_compare:nNnF { \g__wheelchart_arc_data_aux_i_fp } > { 0 }
                             {
-                              The~arc~data~in~slice~\WCcount \c_space_tl did~(possibly)~not~fit.~
-                              Increase~the~absolute~value~of~arc~data~dir.
-                            }%refer to \WCcount and not to \pgfkeysvalueof { / wheelchart / arc~data }
-                            %because the latter is not necessarily unique
+                              \PackageWarning { wheelchart }
+                                {
+                                  The~arc~data~in~slice~\WCcount \c_space_tl did~(possibly)~not~fit.~
+                                  Increase~the~absolute~value~of~arc~data~dir.
+                                }%refer to \WCcount and not to \pgfkeysvalueof { / wheelchart / arc~data }
+                                %because the latter is not necessarily unique
+                            }
+                          \int_compare:nNnT {####1} = { \fp_use:N \l__wheelchart_arc_around_line_fp }
+                            { \fp_gset_eq:NN \g__wheelchart_arc_data_aux_ii_fp \g__wheelchart_arc_data_aux_i_fp }
                         }
                     }
                   \bool_if:NT \l__wheelchart_arc_bool
                     {
-                      \__wheelchart_def_macros:n { arc~pos , arc~sep }
+                      \__wheelchart_def_fp:nn { arc_pos } { arc~pos }
+                      \__wheelchart_def_fp:nn { arc_sep } { arc~sep }
                       \str_case:enF { \pgfkeysvalueof { / wheelchart / arc~around~text } }
                         {
                           { true }
                             {
-                              \__wheelchart_arc_around_text:nnn { first } { -1 } { 0 }
-                              \__wheelchart_arc_around_text:nnn { second } { 1 } { 1 }
+                              \bool_if:NTF \l__wheelchart_plot_bool
+                                {
+                                  \__wheelchart_arc_around_text_plot_true:nnn { first } { -1 } { 0 }
+                                  \__wheelchart_arc_around_text_plot_true:nnn { second } { 1 } { 1 }
+                                }
+                                {
+                                  \fp_gset:Nn \g__wheelchart_arc_data_aux_ii_fp
+                                    {
+                                      \g__wheelchart_arc_data_aux_ii_fp
+                                      / ( sqrt ( abs ( \l__wheelchart_coord_determinant_fp ) ) * deg )
+                                    }
+                                  \fp_set:Nn \l__wheelchart_arc_radius_fp
+                                    {
+                                      \__wheelchart_def_radius:nnn
+                                        { \WCcount }
+                                        { \l__wheelchart_arc_pos_fp }
+                                        { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+                                    }
+                                  \__wheelchart_arc_around_text_plot_false:nn { first } { 0 }
+                                  \__wheelchart_arc_around_text_plot_false:nn { second } { 1 }
+                                }
                             }
                           { false }
                             {
-                              \__wheelchart_convex_comb_coord_plot:nnnnnnn
-                                { draw , / wheelchart / arc_style }
-                                { 0 }
-                                { 1 }
-                                { \l__wheelchart_plot_variable_fp }
-                                { 0 }
-                                { \l__wheelchart_arc_pos_fp }
-                                { \l__wheelchart_arc_sep_fp }
+                              \bool_if:NTF \l__wheelchart_plot_bool
+                                {
+                                  \__wheelchart_convex_comb_coord_plot:nnnnnnn
+                                    { draw , / wheelchart / arc_style }
+                                    { 0 }
+                                    { 1 }
+                                    { \l__wheelchart_plot_variable_tl }
+                                    { 0 }
+                                    { \l__wheelchart_arc_pos_fp }
+                                    { \l__wheelchart_arc_sep_fp }
+                                }
+                                {
+                                  \fp_set:Nn \l__wheelchart_arc_radius_fp
+                                    {
+                                      \__wheelchart_def_radius:nnn
+                                        { \WCcount }
+                                        { \l__wheelchart_arc_pos_fp }
+                                        { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+                                    }
+                                  \fp_set:Nn \l__wheelchart_arc_start_angle_fp
+                                    {
+                                      \__wheelchart_def_angle_plot_false:nnnnn
+                                        { \WCcount }
+                                        { 0 }
+                                        { 0 }
+                                        { \l__wheelchart_arc_pos_fp }
+                                        { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp }
+                                    }
+                                  \path
+                                    [ draw , / wheelchart / arc_style ]
+                                    ( \fp_use:N \l__wheelchart_arc_start_angle_fp \c_colon_str \fp_use:N \l__wheelchart_arc_radius_fp )
+                                    arc
+                                      [
+                                        start~angle = \fp_use:N \l__wheelchart_arc_start_angle_fp ,
+                                        end~angle =
+                                          \__wheelchart_def_angle_plot_false:nnnnn
+                                            { \WCcount }
+                                            { 1 }
+                                            { 0 }
+                                            { \l__wheelchart_arc_pos_fp }
+                                            { \l__wheelchart_arc_sep_fp + \g__wheelchart_half_ex_over_one_cm_fp } ,
+                                        radius = \fp_use:N \l__wheelchart_arc_radius_fp
+                                      ]
+                                    ;
+                                }
                             }
                         }
                         {
@@ -2728,28 +3182,8 @@
                             }
                         }
                     }
-                  \__wheelchart_if_text:nn { inner~data }
-                    {
-                      \__wheelchart_def_macros:n { inner~data~angle~pos , inner~data~angle~shift , inner~data~pos , inner~data~sep }
-                      \node [ align = left , / wheelchart / inner_data_style ] at
-                        \__wheelchart_convex_comb_coord:nnnn
-                          { \l__wheelchart_inner_data_angle_pos_fp }
-                          { \l__wheelchart_inner_data_angle_shift_fp }
-                          { \l__wheelchart_inner_data_pos_fp }
-                          { \l__wheelchart_inner_data_sep_fp }
-                        { \pgfkeysvalueof { / wheelchart / inner~data } } ;
-                    }
-                  \__wheelchart_if_text:nn { wheel~data }
-                    {
-                      \__wheelchart_def_macros:n { wheel~data~angle~pos , wheel~data~angle~shift , wheel~data~pos , wheel~data~sep }
-                      \node [ align = left , / wheelchart / wheel_data_style ] at
-                        \__wheelchart_convex_comb_coord:nnnn
-                          { \l__wheelchart_wheel_data_angle_pos_fp }
-                          { \l__wheelchart_wheel_data_angle_shift_fp }
-                          { \l__wheelchart_wheel_data_pos_fp }
-                          { \l__wheelchart_wheel_data_sep_fp }
-                        { \pgfkeysvalueof { / wheelchart / wheel~data } } ;
-                    }
+                  \__wheelchart_inner_and_wheel_data:n { inner }
+                  \__wheelchart_inner_and_wheel_data:n { wheel }
                   \pgfkeysvalueof { / wheelchart / legend~entry }
                 }
               \bool_if:NT \l__wheelchart_legend_row_bool



More information about the tex-live-commits mailing list.