First, I started using LaTeX way too late! Thanks for all the hints on this site.
I looked at the answer of the following question. How to draw Bar & Pie Chart
This chart uses the value 100 as maxvalue. I want to change it a bit, it should sum up all parameters and use that as the new 100%
Example of a pie chart (sum of 922 as 100%)
\pie{Pie XYZ}
{337/div,196/drog,191/verm,118/gew,47/staa}
Here is the original script with my idea in the comment. To be frank I have never use tex-script before, but just with googling I couldn't manage to get what I want.
Any help for a LaTeX noob higly appreciated.
\newcommand{\pie}[3][]{
\begin{scope}[#1]
\pgfmathsetmacro{\curA}{90}
\pgfmathsetmacro{\r}{1}
\def\c{(0,0)}
\node[pie title] at (90:1.3) {#2};
% Sum all parameters for max value
% \newcounter{tmpSUM}
% \foreach \v / \s in{#3}{
% \setcounter{tmpSUM}{\v}
% }
\foreach \v/\s in{#3}{
% \pgfmathsetmacro{\deltaA}{\v / tmpSUM 360}
\pgfmathsetmacro{\deltaA}{\v / 100 360}
\pgfmathsetmacro{\nextA}{\curA + \deltaA}
\pgfmathsetmacro{\midA}{(\curA+\nextA)/2}
\path[slice,\s] \c
-- +(\curA:\r)
arc (\curA:\nextA:\r)
-- cycle;
\pgfmathsetmacro{\d}{max((\deltaA * -(.5/50) + 1) , .5)}
\begin{pgfonlayer}{foreground}
\path \c -- node[pos=\d,pie values,values of \s]{$\v\%$} +(\midA:\r);
\end{pgfonlayer}
\global\let\curA\nextA
}
\end{scope}
}


