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 setting 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.

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

The center() method that provides the access to anychart.core.pie.Center object provide a very flexible way to place almost anything into the center of the Donut chart.

In this section we will provide several typical use cases along with the samples and all code you will need to create charts like in your application.

Center Label

To put some text in the center of a donut create a label and assign it to the center.

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

// Set center content.;



To put another chart in the center of the donut chart create a 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 the donut create a 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

You can put any kind of 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;