Doughnut Chart


A doughnut (or donut) chart is a pie chart with a "hole" - a blank circular area in the center. The chart is divided into parts that show the percentage each value contributes to a total.

Like the regular pie chart, the doughnut chart is used with small sets of data to compare categories. It drives attention from the area taken by each part to emphasize the length of arcs. The blank space also allows displaying some additional information in the center: for example, labels, the name of a selected category, or the chart title.

The Doughnut chart is a modification of the Pie chart and shares almost all the settings with it, so this article explains just how to create a basic Doughnut chart and configure its labels. To learn about other settings, read the Pie Chart article. See also Chartopedia: Doughnut Chart.


The Doughnut chart requires adding the Core and Pie and Doughnut modules:

<script src=""></script>
<script src=""></script>

Alternatively, you can use the Base module, which includes, among other things, the two modules mentioned above:

<script src=""></script>

Learn more: Modules.

Quick Start

To create a Doughnut chart, use the anychart.pie() chart constructor and the innerRadius() method to set the inner radius. The radius is 0 by default and can be set either as a value or a percentage of the chart's bounds.

The following sample shows how to create a basic Doughnut chart:

// create data
var data = [
  {x: "A", value: 637166},
  {x: "B", value: 721630},
  {x: "C", value: 148662},
  {x: "D", value: 78662},
  {x: "E", value: 90000}

// create a pie chart and set the data
chart = anychart.pie(data);

/* set the inner radius
(to turn the pie chart into a doughnut chart)*/

// set the container id

// initiate drawing the chart



The Doughnut chart is a modification of the Pie chart, so these two types share almost all the settings. You can find more settings in this article: Pie Chart.

Also, in AnyChart there are many settings that are configured in the same way for all chart types, including the Doughnut chart (for example, legend and interactivity settings): General Settings.

In addition, see the full list of methods available for the Pie chart: anychart.charts.Pie

Special Settings


Outer Labels

By default, labels are placed on the Doughnut chart. However, you can place them outside of the chart by using the position() method with the "outside" parameter:

// set the position of labels

To configure connectors (the lines connecting labels with slices), call the connectorStroke() method:

// configure connectors
chart.connectorStroke({color: "#595959", thickness: 2, dash:"2 2"});

Another setting available for outer labels is outsideLabelsCriticalAngle().

In this sample, there are outside labels with customized connectors:


Inner Labels

To place labels into the blank area in the center of a Doughnut chart, call the position() method with the "inside" parameter. You can also configure the offset of the inner labels by using the isideLabelsOffset() method.

The sample below shows a Doughnut chart with inner labels, the offset is -75%:

// set the position of labels

// set the offset for the labels


Center Content

You can place almost anything in the center of a Doughnut chart: e.g., a text label, a chart, a map. Use the center() method, which provides the access to the anychart.core.ui.Center object.

Center Label

To put some text in the center of a Doughnut chart, create a label and assign it to the center:

// create and configure a label
var label = anychart.standalones.label();

// set the label as the center content;



To put a chart in the center of a Doughnut, create this chart and specify it as the center content:

// create and configure a pie chart
var chart1 = anychart.pie(data);

// create a bar chart
var chart2 =;

// set bar chart as the center content of a pie chart;



To put a map in the center of a Doughnut, create this map and specify it as the center content:

// create pie chart and configure it
var pie = anychart.pie(data);

// create a map and configure it
var map =;

// set map as the center of the chart;


Custom Drawing

Another thing you can place in the center is a custom drawing created with the Graphics engine. Here a basic sample with several simple shapes:

// create pie chart and configure it
var pie = anychart.pie(data);
// create a layer and put some shapes in it
var layer =;
// draw the square
layer.rect(25, 50, 350, 300);
// set layer as the center of the chart;