# Creating Donut chart [closed]

I have seen a donut chart, but it does not look like a ring, rather the portions of the ring are disjoint.

2D version

3D version

How to create them?

Related Questions: 1. How to design a 3D donut pie chart with pgf-plot? 2. How can I produce a 'ring (or wheel) chart' like that on page 88 of the PGF manual? 3. How to draw a coffee cup (thanks to @PrzemysławScherwentke) 4. Create a ring diagram in TeX

For the 2D part, I tried to do some tweak on the following code, which is shamelessly copied from the answer of the 4th question, but found no such obvious way:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}

% Adjusts the size of the wheel:

% The main macro
\newcommand{\wheelchart}[1]{
% Calculate total
\pgfmathsetmacro{\totalnum}{0}
\foreach \value/\colour/\name in {#1} {
\pgfmathparse{\value+\totalnum}
\global\let\totalnum=\pgfmathresult
}

\begin{tikzpicture}

% Calculate the thickness and the middle line of the wheel

% Rotate so we start from the top
\begin{scope}[rotate=90]

% Loop through each value set. \cumnum keeps track of where we are in the wheel
\pgfmathsetmacro{\cumnum}{0}
\foreach \value/\colour in {#1} {
\pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}

% Calculate the percent value
\pgfmathsetmacro{\percentage}{\value/\totalnum*100}
% Calculate the mid angle of the colour segments to place the labels
\pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}

% This is necessary for the labels to align nicely
\pgfmathparse{
(-\midangle<180?"west":"east")
} \edef\textanchor{\pgfmathresult}
\pgfmathsetmacro\labelshiftdir{1-1*(-\midangle>180)}

% Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...

% Set the old cumulated angle to the new value
\global\let\cumnum=\newcumnum
}

\end{scope}
\end{tikzpicture}
}
\wheelchart{26/cyan,  28/orange, 33.5/yellow, 12/blue!50!red}

\end{document}

• possible duplicate of Package for pie charts – m0nhawk Aug 9 '14 at 13:22
• Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – cfr Aug 9 '14 at 13:32
• Given that you link that question, how have you adapted it so far? What specific issue do you need help with? – cfr Aug 9 '14 at 13:35
• To people voting for closing: the effects on the red part of 3D chart seem to be really difficult to obtain. – Przemysław Scherwentke Aug 9 '14 at 13:55
• @PrzemysławScherwentke That's why the OP really needs to improve the question. I don't think it is a duplicate and I didn't vote to close. But it is a very poor question. If the OP could post some code up to the point where they hit problems applying the ideas in those other questions, then the question would be (1) more manageable (more reasonable) (2) better focused (3) obviously not a duplicate. – cfr Aug 9 '14 at 14:01