{"id":13005,"date":"2021-07-06T08:04:13","date_gmt":"2021-07-06T08:04:13","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=13005"},"modified":"2022-08-13T11:06:23","modified_gmt":"2022-08-13T11:06:23","slug":"donut-charts-javascript","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/","title":{"rendered":"How to Build JavaScript Donut Charts"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-13092\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png\" alt=\"Building JavaScript Donut Charts for Data Visualization in Web Apps and Sites Based on HTML5\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png 1500w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-300x169.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-768x433.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-1024x577.png 1024w\" sizes=\"(max-width: 1500px) 100vw, 1500px\" \/>Wondering\u00a0how\u00a0data designers and developers create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Then you&#8217;ve come to the right place at the right time.\u00a0Follow along and you\u00a0will learn\u00a0how to build an interactive JS donut\u00a0chart with great\u00a0ease even if you are a beginner!<\/p>\n<p>In\u00a0this tutorial, we will be visualizing\u00a0data about the global market share of the top online music streaming platforms. It is a good example of information that can be nicely represented in a donut chart.<\/p>\n<p>To make sure we are on the same page, let&#8217;s first see what a donut chart is and then get down to charting straight away!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>What Is Donut Chart?<\/h2>\n<p>Basically, <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/donut-chart\/\">donut charts<\/a> (or doughnut charts)\u00a0are\u00a0<a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/pie-chart\/\">pie charts<\/a>\u00a0with a\u00a0cut-out area of the center which can be filled with additional information.\u00a0They\u00a0are frequently used as a way to\u00a0visualize the proportions of categorical data.<\/p>\n<p>In a donut chart, the size of each slice (or piece)\u00a0depicts how much of the total each category represents. Consequently,\u00a0this type of data visualization\u00a0can help\u00a0you\u00a0quickly understand the proportional composition of a variable.<\/p>\n<p>As a rule of thumb, the number of categories visualized in a donut chart\u00a0graphic\u00a0should be limited to a few to keep the\u00a0representation uncluttered and avoid legibility issues.<\/p>\n<h2>JS Donut Chart Preview<\/h2>\n<p>Take a look at how the JS donut chart will turn out at the end of this tutorial. And it will be interactive!<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-13090\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/javascript-donut-chart-to-be-created.png\" alt=\"Interactive JavaScript-based donut chart which will be created along this tutorial on JS HTML5 data visualization\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/javascript-donut-chart-to-be-created.png 1200w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/javascript-donut-chart-to-be-created-300x183.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/javascript-donut-chart-to-be-created-768x469.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/javascript-donut-chart-to-be-created-1024x625.png 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<h2>Building Basic JavaScript Donut Chart<\/h2>\n<p>A beautiful JS donut chart can be built in just\u00a0four easy steps. Isn\u2019t that music to our ears?<\/p>\n<ol>\n<li>Create an HTML page.<\/li>\n<li>Include JavaScript files.<\/li>\n<li>Add the data.<\/li>\n<li>Write some JS charting code.<\/li>\n<\/ol>\n<h3>1. Create an HTML page<\/h3>\n<p>The first thing we do is create a basic HTML page with a block element designed to hold the donut chart.<\/p>\n<p>To identify this <code>&lt;div&gt;<\/code> later in the code, we give it an id attribute. Let it be just \u201ccontainer\u201d this time.<\/p>\n<p>We also specify the <code>width<\/code> and <code>height<\/code> parameters inside the <code>&lt;style&gt;<\/code> block as &#8220;100%&#8221; so the donut chart fills the whole page.<\/p>\n<pre><code>&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Donut Chart&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;      \r\n\u00a0\u00a0\u00a0\u00a0  html, body, #container { \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  width: 100%; height: 100%; margin: 0; padding: 0; \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} \r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>2. Include JavaScript files<\/h3>\n<p>There are many JavaScript charting libraries out there providing ready-made features that are of great help to quickly visualize data in graphs even without a lot of technical skills and experience. Some of them support donut charts out of the box.<\/p>\n<p>In this tutorial, we are using the <a href=\"https:\/\/www.anychart.com\">AnyChart JS library<\/a>. It is a lightweight, strong, and flexible solution for interactive data visualization. AnyChart is\u00a0also great for beginners because of extensive and detailed\u00a0<a href=\"https:\/\/docs.anychart.com\" target=\"_blank\" rel=\"nofollow\">documentation<\/a>\u00a0and a whole lot of <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/\">chart examples<\/a>\u00a0with the source code that can be\u00a0played with on the dedicated <a href=\"https:\/\/playground.anychart.com\" target=\"_blank\" rel=\"nofollow\">playground<\/a>.<\/p>\n<p>So, as step two, let&#8217;s\u00a0include the necessary JavaScript files from the\u00a0library&#8217;s\u00a0<a href=\"https:\/\/cdn.anychart.com\" target=\"_blank\" rel=\"nofollow\">CDN<\/a>\u00a0(or you can download them if you want).<\/p>\n<p>AnyChart&#8217;s JavaScript charting library features a modular system to ensure optimal performance. To create an interactive HTML5 donut chart using it, we need to add two scripts \u2014 the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">core module<\/a> and the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#pie_and_doughnut\" target=\"_blank\" rel=\"nofollow\">pie-and-donut module<\/a> \u2014 to the <code>&lt;head&gt;<\/code> section of the HTML page.<\/p>\n<pre><code>&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Donut Chart&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-pie.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;      \r\n\u00a0\u00a0\u00a0\u00a0  html, body, #container { \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  width: 100%; height: 100%; margin: 0; padding: 0; \r\n\u00a0\u00a0\u00a0\u00a0  } \r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;  \r\n\u00a0\u00a0\u00a0\u00a0&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ All the code for the JS donut chart will come here\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/script&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>3. Add the data<\/h3>\n<p>A donut chart is a simple chart type that requires a\u00a0straightforward and limited dataset. So, although AnyChart supports\u00a0<a href=\"https:\/\/docs.anychart.com\/Working_with_Data\/Supported_Data_Formats\" target=\"_blank\" rel=\"nofollow\">multiple ways to\u00a0load data<\/a>, we\u00a0will just pass\u00a0the data directly in a hassle-free manner.<\/p>\n<p>For this tutorial, I decided to take\u00a0data on the market share of the leading music streaming apps, which I collected from the <a href=\"https:\/\/www.businessofapps.com\/data\/spotify-statistics\/\" target=\"_blank\" rel=\"nofollow\">Business of Apps<\/a> website. So, I am just adding it as shown below:<\/p>\n<pre><code>var data = anychart.data.set([\r\n  ['Spotify', 34],\r\n  ['Apple Music', 21],\r\n  ['Amazon Music', 15],\r\n  ['Tencent apps', 11],\r\n  ['YouTube Music', 6],\r\n  ['Others', 13]\r\n]);<\/code><\/pre>\n<p>Now that we have everything all set, let\u2019s get ready to see the donut chart shape up by adding\u00a0some JavaScript code! Basically,\u00a0this is quite intuitive.<\/p>\n<h3>4. Write\u00a0the\u00a0JS charting code for our donut chart<\/h3>\n<p>The first thing we do is add a function enclosing all the code, which makes sure that the code inside it will only execute once the page is ready.<\/p>\n<p>Donut charts\u00a0are very\u00a0straightforward to create with an appropriate JS library and in this case, it will actually be just a couple of lines of code!<\/p>\n<p>As we have learned just above, a donut chart is fundamentally a pie chart with a hole, like a ring all in all.\u00a0So, we simply create a pie chart instance and give it an inner radius value to make it a donut chart.<\/p>\n<pre><code>\/\/ create a pie chart with the data\r\nvar chart = anychart.pie(data)\r\n\/\/ set the chart radius making a donut chart\r\nchart.innerRadius('55%');<\/code><\/pre>\n<p>Then we give our donut chart a title and set the container id before finally drawing\u00a0the resulting visualization.<\/p>\n<pre><code>chart.title('Music Streaming Apps Global Market Share')\r\nchart.container('container');\r\nchart.draw();<\/code><\/pre>\n<p>That\u2019s it \u2014 a fully functional interactive JavaScript-based donut chart is ready! Isn\u2019t this absolutely easy?<\/p>\n<p>Notice\u00a0that the legend was created automatically. Also, go ahead and click on its items or any piece to see the cool\u00a0interactive donut slicing behavior.<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-oGg0sx87\" src=\"https:\/\/playground.anychart.com\/oGg0sx87\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-oGg0sx87{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p><strong>The initial version of this basic JS donut chart with the full code is available on <a href=\"https:\/\/playground.anychart.com\/oGg0sx87\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a> and <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/eYvJxJQ\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/strong><\/p>\n<p>This donut chart distinctly shows that Spotify is the global leader\u00a0and that Spotify and\u00a0Apple Music\u00a0together hold more than half\u00a0of the market of\u00a0music streaming apps.<\/p>\n<p>Now, let\u2019s customize our donut chart to make it look even cooler and communicate the insights in a clearer manner.<\/p>\n<h2>Customizing JS Donut Chart<\/h2>\n<p>A great feature of AnyChart&#8217;s JavaScript library is that the initial donut chart is\u00a0built very quickly and then there are a ton of options to fine-tune the chart any way we want.<\/p>\n<p>Let&#8217;s see\u00a0some interesting ways to make our interactive donut chart more aesthetic and informative:<\/p>\n<ol>\n<li>Change the color palette.<\/li>\n<li>Add labels.<\/li>\n<li>Improve the tooltip.<\/li>\n<li>Add details to the center of the donut.<\/li>\n<\/ol>\n<h3>1. Change the color palette<\/h3>\n<p>Colors are the simplest yet most effective way to make a\u00a0chart look more personalized. Since we are representing brands here, we can\u00a0apply their colors to the visualization of\u00a0the corresponding data points.<\/p>\n<p>This is quite uncomplicated where we just define the color palette\u00a0to use\u00a0and pass\u00a0it as an argument when creating the donut chart.<\/p>\n<pre><code>\/\/ create a color palette\r\nvar palette = anychart.palettes.distinctColors();\r\n  \r\n\/\/ set the colors according to the brands\r\npalette.items([\r\n  { color: '#1dd05d' },\r\n  { color: '#000000' },\r\n  { color: '#00a3da' },\r\n  { color: '#156ef2' },\r\n  { color: '#f60000' },\r\n  { color: '#96a6a6' }\r\n]);\r\n\r\n\/\/ apply the donut chart color palette\r\nchart.palette(palette);\r\n<\/code><\/pre>\n<p>Look at how our donut chart looks with the brand colors!<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-G0CdHbBP\" src=\"https:\/\/playground.anychart.com\/G0CdHbBP\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-G0CdHbBP{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p><strong>This donut chart version is available with the code on <a href=\"https:\/\/playground.anychart.com\/G0CdHbBP\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a> and <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/BaWjbdv\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/strong><\/p>\n<h3>2. Add labels<\/h3>\n<p>Since we have a lesser number of segments and each is sufficiently large, we can add the name of the brand along with the percentage figure inside each slice of the donut chart. This would eliminate the need for a legend.<\/p>\n<p>Again, this is really simple and can be done with\u00a0just two additional\u00a0lines of JS code.<\/p>\n<pre><code>\/\/ set the position of labels\r\nchart.labels().format('{%x} \u2014 {%y}%').fontSize(16);\r\n  \r\n\/\/ disable the legend\r\nchart.legend(false);<\/code><\/pre>\n<h3>3. Improve the tooltip<\/h3>\n<p>It is always a good idea to make the tooltip clear and value-adding. In our donut chart, there are\u00a0only two points of information: the brand name and the percentage share. So, we can have a basic tooltip with that information without any clutter.<\/p>\n<pre><code>chart.tooltip().format('Market share: {%PercentValue}%');<\/code><\/pre>\n<h3>4.\u00a0Add details to the center of the donut<\/h3>\n<p>An important\u00a0aspect\u00a0of data visualization\u00a0lies in space utilization. Since the donut chart has a blank middle, we can use that to display the title and some other information.<\/p>\n<p>Let&#8217;s\u00a0define a standalone element and position it in the center. Along with the title, we also add a subtitle that represents our observation:<\/p>\n<pre><code>\/\/ create a standalone label\r\nvar label = anychart.standalones.label();\r\n\r\n\/\/ configure the label settings\r\nlabel\r\n  .useHtml(true)\r\n  .text(\r\n    '&lt;span style = \"color: #313136; font-size:20px;\"&gt;Global Market Share of &lt;br\/&gt; Music Streaming Apps&lt;\/span&gt;' +\r\n    '&lt;br\/&gt;&lt;br\/&gt;&lt;\/br&gt;&lt;span style=\"color:#444857; font-size: 14px;\"&gt;&lt;i&gt;Spotify and Apple Music have more &lt;br\/&gt;than 50% of the total market share&lt;\/i&gt;&lt;\/span&gt;'\r\n  )\r\n  .position('center')\r\n  .anchor('center')\r\n  .hAlign('center')\r\n  .vAlign('middle');\r\n\r\n\/\/ set the label as the center content\r\nchart.center().content(label);<\/code><\/pre>\n<p>The result is below!<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-vDHOcQQZ\" src=\"https:\/\/playground.anychart.com\/vDHOcQQZ\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-vDHOcQQZ{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>There it is \u2014 a cool and funky donut chart built with JavaScript!<\/p>\n<p><strong>You can find the final code for this donut chart here below, or on <a href=\"https:\/\/playground.anychart.com\/vDHOcQQZ\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>, or on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/VwpeRBx\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/strong><\/p>\n<pre><code>&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Donut Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.10.0\/js\/anychart-pie.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;      \r\n\u00a0     html, body, #container { \r\n        width: 100%; height: 100%; margin: 0; padding: 0; \r\n      } \r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n\r\nanychart.onDocumentReady(function () {\r\n  \r\n\u00a0\u00a0\/\/ add data\r\n\u00a0\u00a0var data = anychart.data.set([\r\n\u00a0\u00a0\u00a0\u00a0['Spotify', 34],\r\n\u00a0\u00a0\u00a0\u00a0['Apple Music', 21],\r\n\u00a0\u00a0\u00a0\u00a0['Amazon Music', 15],\r\n\u00a0\u00a0\u00a0\u00a0['Tencent apps', 11],\r\n\u00a0\u00a0\u00a0\u00a0['YouTube Music', 6],\r\n\u00a0\u00a0\u00a0\u00a0['Others', 13]\r\n\u00a0\u00a0]);\r\n  \r\n\u00a0\u00a0\/\/ create a pie chart with the data\r\n\u00a0\u00a0var chart = anychart.pie(data);\r\n  \r\n  \/\/ set the chart radius making a donut chart\r\n\u00a0\u00a0chart.innerRadius('55%')\r\n\r\n\u00a0 \/\/ create a color palette\r\n  var palette = anychart.palettes.distinctColors();\r\n \r\n  \/\/ set the colors according to the brands\r\n  palette.items([\r\n    { color: '#1dd05d' },\r\n    { color: '#000000' },\r\n    { color: '#00a3da' },\r\n    { color: '#156ef2' },\r\n    { color: '#f60000' },\r\n    { color: '#96a6a6' }\r\n  ]);\r\n\r\n  \/\/ apply the donut chart color palette\r\n  chart.palette(palette);\r\n  \r\n\u00a0\u00a0\/\/ set the position of labels\r\n\u00a0\u00a0chart.labels().format('{%x} \u2014 {%y}%').fontSize(16);\r\n  \r\n\u00a0\u00a0\/\/ disable the legend\r\n\u00a0\u00a0chart.legend(false);\r\n  \r\n\u00a0\u00a0\/\/ format the donut chart tooltip\r\n\u00a0\u00a0chart.tooltip().format('Market share: {%PercentValue}%');\r\n\r\n\u00a0\u00a0\/\/ create a standalone label\r\n\u00a0\u00a0var label = anychart.standalones.label();\r\n\r\n\u00a0\u00a0\/\/ configure the label settings\r\n  label\r\n\u00a0\u00a0  .useHtml(true)\r\n\u00a0\u00a0  .text(\r\n\u00a0\u00a0    '&lt;span style = \"color: #313136; font-size:20px;\"&gt;Global Market Share of &lt;br\/&gt; Music Streaming Apps&lt;\/span&gt;' +\r\n\u00a0\u00a0    '&lt;br\/&gt;&lt;br\/&gt;&lt;\/br&gt;&lt;span style=\"color:#444857; font-size: 14px;\"&gt;&lt;i&gt;Spotify and Apple Music have more &lt;br\/&gt;than 50% of the total market share&lt;\/i&gt;&lt;\/span&gt;'\r\n\u00a0\u00a0  )\r\n\u00a0\u00a0\u00a0\u00a0.position('center')\r\n\u00a0\u00a0\u00a0\u00a0.anchor('center')\r\n\u00a0\u00a0\u00a0\u00a0.hAlign('center')\r\n\u00a0\u00a0\u00a0\u00a0.vAlign('middle');\r\n  \r\n\u00a0\u00a0\/\/ set the label as the center content\r\n\u00a0\u00a0chart.center().content(label);\r\n  \r\n\u00a0\u00a0\/\/ set container id for the chart\r\n\u00a0\u00a0chart.container('container');\r\n  \r\n\u00a0\u00a0\/\/ initiate chart drawing\r\n\u00a0\u00a0chart.draw();\r\n\r\n});\r\n\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>In this tutorial, we&#8217;ve seen how fast and easy it is to create and customize an interactive JS donut chart.\u00a0It is one of the simplest charts to build and therefore a great option when one is starting to learn data visualization for the web.<\/p>\n<p>If you want to further improve the donut chart we&#8217;ve just made or create a completely different one for your own needs,\u00a0check out the <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Doughnut_Chart\" target=\"_blank\" rel=\"nofollow\">donut chart documentation<\/a>\u00a0and don&#8217;t miss out on the <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/Pie_and_Donut_Charts\/\">donut chart examples<\/a> for inspiration. You are also welcome to look into other\u00a0<a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Supported_Charts_Types\" target=\"_blank\" rel=\"nofollow\">chart types<\/a>\u00a0supported in the AnyChart JavaScript data visualization library.<\/p>\n<p>Please let me know if you have any questions about\u00a0building or using donut charts or anything related to data visualization and I will do my best to respond and be of help.<\/p>\n<p>Go on then, start creating different charts and keep listening to music \u2014 both are good for creativity!<\/p>\n<hr \/>\n<p><strong><em>We at AnyChart would like to thank Shachee Swadia for producing this amazing JS Donut Chart tutorial.<\/em><\/p>\n<p><em>If you would like to create a cool guest post for our blog, please\u00a0<a href=\"https:\/\/www.anychart.com\/support\/\">get in touch<\/a> with us and let&#8217;s discuss it.<\/em><\/strong><\/p>\n<hr \/>\n<p><strong><em>See other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a>.<\/em><\/strong><\/p>\n<p><!-- SyntaxHighlighter --><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/default.min.css\"><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/atom-one-light.min.css\"><script src=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/highlight.min.js\"><\/script><script>hljs.initHighlightingOnLoad();<\/script><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Wondering\u00a0how\u00a0data designers and developers create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Then you&#8217;ve come to the right place at the right time.\u00a0Follow along and you\u00a0will learn\u00a0how to build an interactive JS donut\u00a0chart with great\u00a0ease even if you are a beginner! In\u00a0this tutorial, we will be visualizing\u00a0data about the global market share of the top online music streaming platforms. It [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,23,13,279,4],"tags":[843,2206,2207,2208,2608,53,2381,2606,260,561,284,127,258,471,266,193,2171,2220,54,461,1389,1760,256,1111,744,1379,844,165,313,1370,177,1155,103,2611,2013,2014,32,55,61,144,167,146,433,152,151,247,36,907,141,249,81,57,169,170,1238,142,96,60,58,65,56,101,59,2387,2388,318,2605,2604,64,84,2599,2600,2601,2602,459,2603,2609,2610,30,172,293,745,899,2607],"class_list":["post-13005","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-advanced-data-visualization","tag-amazon","tag-amazon-data","tag-amazon-data-visualization","tag-amazon-music","tag-anychart","tag-apple","tag-apple-music","tag-best-data-visualization-examples","tag-best-data-visualizations","tag-chart-examples","tag-chart-types","tag-charts","tag-data-analysis","tag-data-analytics","tag-data-composition","tag-data-vis","tag-data-visual","tag-data-visualization","tag-data-visualization-101","tag-data-visualization-best-pracices","tag-data-visualization-design","tag-data-visualization-examples","tag-data-visualization-practice","tag-data-visualization-techniques","tag-data-visualization-tool","tag-data-visualization-tutorial","tag-data-visualizations","tag-data-visuals","tag-data-viz-examples","tag-donut-chart","tag-donut-chart-example","tag-donut-charts","tag-doughnut-chart","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-html5-pie","tag-infographics","tag-interactive-charts","tag-interactive-data-visualization","tag-interactive-graphics","tag-interactive-infographic","tag-interactive-visualizations","tag-interactivity","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-api","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-drawing","tag-javascript-drawing-library","tag-javascript-graph","tag-javascript-graphics","tag-javascript-graphics-library","tag-javascript-pie-chart","tag-js-chart","tag-js-charting","tag-js-charts","tag-js-graphics","tag-js-pie-chart","tag-market-data","tag-market-data-visualization","tag-music","tag-music-apps","tag-music-streaming-apps","tag-pie-chart","tag-pie-charts","tag-spotify","tag-spotify-data","tag-spotify-data-visualization","tag-spotify-statistics","tag-statistics","tag-streaming","tag-tencent","tag-tencent-apps","tag-tips-and-tricks","tag-tutorial","tag-visualization","tag-visualization-techniques","tag-visualizations","tag-youtube-music","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Donut Charts and How to Build Them Using JavaScript (HTML5)<\/title>\n<meta name=\"description\" content=\"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build JavaScript Donut Chart\" \/>\n<meta property=\"og:description\" content=\"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"AnyChart News\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AnyCharts\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-06T08:04:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T11:06:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-social.png\" \/>\n<meta name=\"author\" content=\"Shachee Swadia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Build JavaScript Donut Chart\" \/>\n<meta name=\"twitter:description\" content=\"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shachee Swadia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\"},\"author\":{\"name\":\"Shachee Swadia\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"headline\":\"How to Build JavaScript Donut Charts\",\"datePublished\":\"2021-07-06T08:04:13+00:00\",\"dateModified\":\"2022-08-13T11:06:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\"},\"wordCount\":1425,\"commentCount\":2,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png\",\"keywords\":[\"advanced data visualization\",\"Amazon\",\"Amazon data\",\"Amazon data visualization\",\"Amazon Music\",\"AnyChart\",\"Apple\",\"Apple Music\",\"best data visualization examples\",\"best data visualizations\",\"chart examples\",\"chart types\",\"charts\",\"data analysis\",\"data analytics\",\"data composition\",\"data vis\",\"data visual\",\"Data Visualization\",\"data visualization 101\",\"data visualization best practices\",\"data visualization design\",\"data visualization examples\",\"data visualization practice\",\"data visualization techniques\",\"data visualization tool\",\"data visualization tutorial\",\"data visualizations\",\"data visuals\",\"data viz examples\",\"donut chart\",\"donut chart example\",\"donut charts\",\"doughnut chart\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"html5 pie\",\"infographics\",\"interactive charts\",\"interactive data visualization\",\"interactive graphics\",\"interactive infographic\",\"interactive visualizations\",\"interactivity\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting library\",\"javascript charts\",\"javascript drawing\",\"javascript drawing library\",\"javascript graph\",\"javascript graphics\",\"JavaScript graphics library\",\"javascript pie chart\",\"js chart\",\"js charting\",\"js charts\",\"JS graphics\",\"js pie chart\",\"market data\",\"market data visualization\",\"music\",\"music apps\",\"music streaming apps\",\"pie chart\",\"pie charts\",\"Spotify\",\"Spotify data\",\"Spotify data visualization\",\"Spotify statistics\",\"statistics\",\"streaming\",\"Tencent\",\"Tencent apps\",\"Tips and tricks\",\"tutorial\",\"visualization\",\"visualization techniques\",\"visualizations\",\"YouTube Music\"],\"articleSection\":[\"AnyChart Charting Component\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\",\"name\":\"Donut Charts and How to Build Them Using JavaScript (HTML5)\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png\",\"datePublished\":\"2021-07-06T08:04:13+00:00\",\"dateModified\":\"2022-08-13T11:06:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"description\":\"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png\",\"width\":1500,\"height\":845},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build JavaScript Donut Charts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\",\"url\":\"https:\/\/www.anychart.com\/blog\/\",\"name\":\"AnyChart News\",\"description\":\"AnyChart JS Charts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.anychart.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\",\"name\":\"Shachee Swadia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"caption\":\"Shachee Swadia\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Donut Charts and How to Build Them Using JavaScript (HTML5)","description":"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Build JavaScript Donut Chart","og_description":"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.","og_url":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2021-07-06T08:04:13+00:00","article_modified_time":"2022-08-13T11:06:23+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-social.png","type":"","width":"","height":""}],"author":"Shachee Swadia","twitter_card":"summary_large_image","twitter_title":"How to Build JavaScript Donut Chart","twitter_description":"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Shachee Swadia","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/"},"author":{"name":"Shachee Swadia","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"headline":"How to Build JavaScript Donut Charts","datePublished":"2021-07-06T08:04:13+00:00","dateModified":"2022-08-13T11:06:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/"},"wordCount":1425,"commentCount":2,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png","keywords":["advanced data visualization","Amazon","Amazon data","Amazon data visualization","Amazon Music","AnyChart","Apple","Apple Music","best data visualization examples","best data visualizations","chart examples","chart types","charts","data analysis","data analytics","data composition","data vis","data visual","Data Visualization","data visualization 101","data visualization best practices","data visualization design","data visualization examples","data visualization practice","data visualization techniques","data visualization tool","data visualization tutorial","data visualizations","data visuals","data viz examples","donut chart","donut chart example","donut charts","doughnut chart","HTML","HTML charts","HTML5","html5 charts","html5 pie","infographics","interactive charts","interactive data visualization","interactive graphics","interactive infographic","interactive visualizations","interactivity","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting library","javascript charts","javascript drawing","javascript drawing library","javascript graph","javascript graphics","JavaScript graphics library","javascript pie chart","js chart","js charting","js charts","JS graphics","js pie chart","market data","market data visualization","music","music apps","music streaming apps","pie chart","pie charts","Spotify","Spotify data","Spotify data visualization","Spotify statistics","statistics","streaming","Tencent","Tencent apps","Tips and tricks","tutorial","visualization","visualization techniques","visualizations","YouTube Music"],"articleSection":["AnyChart Charting Component","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/","url":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/","name":"Donut Charts and How to Build Them Using JavaScript (HTML5)","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png","datePublished":"2021-07-06T08:04:13+00:00","dateModified":"2022-08-13T11:06:23+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"description":"Wondering\u00a0how\u00a0they create\u00a0compelling\u00a0donut charts using JavaScript?\u00a0Follow along to find out! The tutorial shows how to build a JS donut chart step by step.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/07\/donut-chart-js.png","width":1500,"height":845},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2021\/07\/06\/donut-charts-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Build JavaScript Donut Charts"}]},{"@type":"WebSite","@id":"https:\/\/www.anychart.com\/blog\/#website","url":"https:\/\/www.anychart.com\/blog\/","name":"AnyChart News","description":"AnyChart JS Charts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.anychart.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51","name":"Shachee Swadia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","caption":"Shachee Swadia"},"url":"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/13005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=13005"}],"version-history":[{"count":45,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/13005\/revisions"}],"predecessor-version":[{"id":15511,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/13005\/revisions\/15511"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=13005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=13005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=13005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}