custom.sty 1.24 KB
Newer Older
Alija Sabic's avatar
Alija Sabic committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Sliced Circular Progressbar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\slicedcircularprogressbar}[9]{% Syntax: \twprogressbar{\coordinate}{\oradius}{\iradius}{\oangle}{\total}{\number}{\basecol}{\fillcol}{\bgcol}
\begin{tikzpicture}[overlay]
    \def\ratio{#6/#5}

    \def\outerradius{#2}
    \def\innerradius{#3}

    \coordinate (centerprogressbar) at #1;

    \draw[draw=none,fill=#7] (centerprogressbar) circle (\outerradius);
    \draw[draw=none,fill=#8] (centerprogressbar) -- (centerprogressbar) ++(0,\outerradius) arc (90:90-360*\ratio:\outerradius) -- (centerprogressbar);
    \draw[draw=none,fill=#9] (centerprogressbar) circle (\innerradius);

    \pgfmathparse{#5-1}
    \pgfmathsetmacro{\nums}{\pgfmathresult}

    \foreach \x in {0,...,\nums} {
        \pgfmathparse{360/#5*\x}
        \pgfmathsetmacro{\angl}{\pgfmathresult}
        \def\slice{#4}
        \draw[draw=none,fill=#9,line width=0.1mm] (centerprogressbar) -- +(90-\angl+\slice:\outerradius+0.1) arc (90-\angl+\slice:90-\angl-\slice*2:\outerradius) -- cycle;
    }
\end{tikzpicture}
}