{"id":11795,"date":"2020-12-08T12:14:59","date_gmt":"2020-12-08T12:14:59","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=11795"},"modified":"2022-08-13T08:27:42","modified_gmt":"2022-08-13T08:27:42","slug":"sunburst-chart-javascript-to-visualize-covid-19-data","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/","title":{"rendered":"How I Created Sunburst Chart Using JavaScript to Visualize COVID-19 Data"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-11802\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\" alt=\"A tutorial on how to create a sunburst chart using JavaScript to visualize COVID-19 data\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png 1550w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid-300x172.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid-768x440.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid-1024x587.png 1024w\" sizes=\"(max-width: 1550px) 100vw, 1550px\" \/>Almost recovered from COVID-19 myself these days, I decided to explore how the world is currently doing, during the pandemic. So I created a sunburst chart to see at a glance what continents and countries are more (and less) affected by the coronavirus than others. The process was quick and I thought someone could be interested to learn about how such data visualizations can be built in a pretty straightforward way, even with very little technical skills. So I also made a tutorial. And here I am \u2014 (1) sharing my interactive <strong>sunburst chart of COVID cases<\/strong> and (2) describing <strong>how I created it using JavaScript<\/strong> in a matter of minutes, step by step!<\/p>\n<p>My JS sunburst chart provides an overview of the situation as of November 24, 2020, and also shows the global count, continent-wide data, and country-wise proportions for the current active COVID-19 cases and deaths. Scroll down to explore it by yourself and check out the tutorial along the way. Here is a sneak peek of the final chart to get you excited:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/1920\/1*UfcZ3O8HtGEYs88jRUAH9g.gif\" alt=\"JavaScript Sunburst Chart to be created\" width=\"100%\" \/><\/p>\n<p>This sunburst charting tutorial is mainly for beginners to data science. So before we get to business, let\u2019s make sure we\u2019re on the same page. I\u2019ll explain what a sunburst chart is and how it works, to start with. Then I\u2019ll show you how to create a cool and colorful interactive visualization like that with JavaScript (and you can do it even if you don\u2019t know it too well). That\u2019s the plan!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>What Is a Sunburst Chart?<\/h2>\n<p>A <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-types\/sunburst-chart\/\">sunburst chart<\/a> shows hierarchy through a series of rings. Each ring is segmented proportionally to represent its constituent details and corresponds to a level in the hierarchy, with the central circle representing the root node and the hierarchy moving outwards from it.<\/p>\n<blockquote><p><em><strong>A Sunburst is remarkably similar to a Treemap, except that it uses a radial rather than a rectangular layout.<\/strong><\/em><\/p><\/blockquote>\n<p>Sunburst charts are also called ring charts, multilevel pie charts, or treepies. They are best suited to represent part of whole relationships. The hierarchy of the categories is ideally represented by a uniform color palette, thereby giving a clear understanding of the lineage. Each level can be clicked to get a drilled-down view of that category.<\/p>\n<p>Without further ado, let\u2019s see how to make them with ease, illustrated by the example of COVID statistics as data and JavaScript (HTML5) as a technology.<\/p>\n<h2>Building a JS Sunburst Chart<\/h2>\n<p>When you\u2019re visualizing data for an online project like a web site, it is always an advantage to have at least some programming skills. But there are multiple solutions such as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JavaScript charting libraries<\/a> that can make it quite effortless to create beautiful charts at a fast pace \u2014 even graphics like sunburst diagrams that may look quite complicated \u2014 without too much technical knowledge and experience. Look.<\/p>\n<p>To start with, the entire process of making an interactive JS sunburst chart \u2014 or basically any JavaScript chart \u2014 can be logically split into <strong>four fundamental steps<\/strong>. They are as follows:<\/p>\n<ol>\n<li>Create a basic HTML page (if you don\u2019t have it yet).<\/li>\n<li>Include the necessary JavaScript files (such as the charting library scripts).<\/li>\n<li>Connect the data (what dataset are you going to visualize?).<\/li>\n<li>Add some simple JS code (depending on what kind of chart you want to get).<\/li>\n<\/ol>\n<h3>1. Create an HTML page<\/h3>\n<p>The first thing to do is make a basic HTML page with a head and a body to render the visualization. Here, it is also necessary to add a <code>div<\/code> element that will contain the chart and give it some id to easily reference this <code>div<\/code> in any other places within the code.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Sunburst&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 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<p>You see the <code>div<\/code> block element is given a width and height of 100% to render the chart full screen. But you can change that to fit your requirements, of course.<\/p>\n<h3>2. Include JavaScript files<\/h3>\n<p>Second, reference all the necessary JS files in the <code>&lt;head&gt;<\/code> section of the HTML page.<\/p>\n<p>Multiple <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JavaScript charting libraries<\/a> can be used to quickly visualize data. Not all of them have sunburst charts, though. For this particular visualization, I decided to go with the JS library of <a href=\"https:\/\/www.anychart.com\/\">AnyChart<\/a>. It supports a sunburst and many useful features out of the box, and also has detailed <a href=\"https:\/\/docs.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">documentation<\/a> with a lot of samples. The same basic steps usually apply if you use a different charting library, though, anyway.<\/p>\n<p>I will include the corresponding files from AnyChart\u2019s <a href=\"https:\/\/www.anychart.com\/download\/cdn\/?v=8.9.0\">CDN<\/a>; you can download these files locally if you wish. In particular, I need to add the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">core library module<\/a> that is necessary for all types of charts and a <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#sunburst\" target=\"_blank\" rel=\"nofollow\">specific module<\/a> for the sunburst chart.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Sunburst&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-sunburst.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 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\u00a0\u00a0&lt;script&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ All the JS code for the sunburst 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<p>You see I included a <code>script<\/code> tag in the body for adding the JavaScript code for the sunburst chart, which will be figured out in the last step.<\/p>\n<h3>3. Connect the COVID data<\/h3>\n<p>Since COVID-19 is a globally topical issue, there are tons of datasets available for it. I wanted to focus on the total number of confirmed cases and deaths due to COVID-19 across the various countries of the world. Finally, I decided to take the data from a trusted source \u2014 <a href=\"https:\/\/ourworldindata.org\/covid-cases\" target=\"_blank\" rel=\"nofollow\">Our World in Data<\/a>, a scientific online publication whose researchers are based at the University of Oxford.<\/p>\n<p>I downloaded the complete dataset in the JSON format and then filtered the data to keep only relevant information for the chart. Since the dataset is quite big, I store it in a separate <a href=\"https:\/\/gist.githubusercontent.com\/shacheeswadia\/3955e21fff7eddcc3862ec4797109cda\/raw\/209c22d8c607cf76b16ec18c7fd95c02e5fdbbe3\/sunburstData.json\" target=\"_blank\" rel=\"nofollow\">file<\/a> and will reference that file in my HTML page to apply it to the sunburst graphic type in this case.<\/p>\n<p>Loading the JSON file in AnyChart can be done with the help of the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#data_adapter\" target=\"_blank\" rel=\"nofollow\">Data Adapter<\/a> module, which needs to be referenced in the <code>&lt;head&gt;<\/code> section in addition to the library\u2019s scripts included in the previous step. Next, the <code>loadJsonFile<\/code> method is used inside the <code>&lt;script&gt;<\/code> tag in the body of the HTML page to load the data file.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Sunburst&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-sunburst.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 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\u00a0\u00a0&lt;script&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0anychart.data.loadJsonFile('{JSON data file location}',\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0function (data) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Sunburst chart's JS code will come here.\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/script&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>Now that the structure required to hold the chart and the data is ready, let\u2019s add just a handful of quick lines of JavaScript code and see a magnificent sunburst chart materialize!<\/p>\n<h3>4. Add JS code for the sunburst diagram<\/h3>\n<p>Before anything else, I\u2019ll add a function enclosing all the JavaScript code for my sunburst chart of the COVID data, which makes sure that the entire code inside of it will only execute once the page is ready.<\/p>\n<p>Since sunburst charts feature a tree structure, firstly it\u2019s necessary to create that structure from the data and then use it to make the chart. Next, I set the <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Sunburst_Chart#calculation_mode\" target=\"_blank\" rel=\"nofollow\">calculation mode<\/a> as \u201cparent-independent\u201d which is used to compare elements by their values. Also, I am dealing with numeric data and I will sort it in ascending order.<\/p>\n<p>Do not worry if all this sounds complicated or difficult to grasp. In fact, it is extremely easy here \u2014 look at how it\u2019s done in just 4 additional lines of code (I\u2019ll leave comments to each so you\u2019ll see):<\/p>\n<pre><code class=\"html\">&lt;script&gt;\r\n\u00a0\u00a0anychart.onDocumentReady(function() {\r\n\u00a0\u00a0anychart.data.loadJsonFile('{JSON data file location}',\r\n\u00a0\u00a0\u00a0\u00a0function (data) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ create a data tree from the dataset\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var dataTree = anychart.data.tree(data);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ create a sunburst chart\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0var chart = anychart.sunburst(dataTree);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ set the calculation mode\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0chart.calculationMode('parent-independent');\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ set the ascending sort order\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0chart.sort('asc');\r\n\u00a0\u00a0\u00a0\u00a0});\r\n\u00a0\u00a0});\r\n&lt;\/script&gt;<\/code><\/pre>\n<p>Now, I\u2019ll add a chart title and set the container referencing the id given to the HTML element in step 1. The final action is to draw the sunburst chart we\u2019ve just coded.<\/p>\n<pre><code class=\"javascript\">\/\/ set the chart title\r\nchart.title(\"COVID-19 Cases Across the World\");\r\n\/\/ set the chart container element id\r\nchart.container('container');\r\n\/\/ initiate chart drawing\r\nchart.draw();<\/code><\/pre>\n<p><strong>Voil\u00e0! A basic, yet already fully-functional and lovely-looking JavaScript-based sunburst chart is ready!<\/strong> Check it out below embedded from <strike>CodePen<\/strike> AnyChart Playground where you can play with the code. (But keep reading as this is just the beginning!)<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-i0jO8WMs\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/i0jO8WMs\/iframe\"><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-i0jO8WMs{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<p><a href=\"https:\/\/playground.anychart.com\/i0jO8WMs\/\" target=\"_blank\" rel=\"nofollow\">Playground link<\/a><br \/>\n<a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/VwjORGW\" target=\"_blank\" rel=\"nofollow\">CodePen link<\/a><\/p>\n<h2>Customizing the Sunburst Chart<\/h2>\n<p>The basic JS sunburst chart I\u2019ve created is already cool. But I decided to improve it a little bit in a few quick moves to make it more engaging. Join me on it.<\/p>\n<h3>A. Improve the tooltip format<\/h3>\n<p>Let\u2019s format the tooltip to add the thousands separator for better comprehensibility and include the number of deaths along with the number of cases for each region.<\/p>\n<pre><code class=\"javascript\">chart.tooltip().format('{%name}: \\n Total Cases: {%value}{groupsSeparator:\\\\,} \\n Total Deaths: {%total_deaths}');<\/code><\/pre>\n<h3>B. Change colors<\/h3>\n<p>It is always a good idea to fine-tune the colors for a touch of personalization. Instead of simply changing the palette from the defaults to some other pre-defined one, I decided to set colors in a custom way. Since I want the colors assigned according to the data, I can add the desired colors in the dataset itself by adding a fill property in the data for each continent. The updated data file is <a href=\"https:\/\/gist.githubusercontent.com\/shacheeswadia\/3bbe6eb041166e259f1712e6766fa5a2\/raw\/341d2796dd63e6e6defc1ec52dd4e73c7828c38c\/sunburstDataUpdated.json\" target=\"_blank\" rel=\"nofollow\">here<\/a>.<\/p>\n<pre><code>{\r\n\"name\": \"Asia\",\r\n\"fill\": \"#63c6c1\"\r\n}<\/code><\/pre>\n<p>Note that we do not even need to add any other code to our HTML file in this case!<\/p>\n<p>Check out my chart with these two quick modifications:<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-UK2HBMVZ\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/UK2HBMVZ\/iframe\"><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-UK2HBMVZ{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<p><a href=\"https:\/\/playground.anychart.com\/UK2HBMVZ\/\" target=\"_blank\" rel=\"nofollow\">Playground link<\/a><br \/>\n<a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/RwRzreE\" target=\"_blank\" rel=\"nofollow\">CodePen link<\/a><\/p>\n<h3>C. Labels and Tooltip Formatting<\/h3>\n<p>Then, I will modify the labels of the continent level to show only the names for a cleaner look. I\u2019ll also format the label and tooltip look some more to make it all appear a bit more refined in my sunburst chart.<\/p>\n<pre><code class=\"javascript\">\/\/ enable HTML in labels\r\nchart.labels().useHtml(true);\r\n\/\/ customize the format of the sunburst chart labels\r\nchart\r\n\u00a0\u00a0.level(1)\r\n\u00a0\u00a0.labels()\r\n\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0.format(\"&lt;span style='font-size:16px'&gt;{%name}&lt;\/span&gt;\");\r\nchart\r\n\u00a0\u00a0.level(0)\r\n\u00a0\u00a0.labels()\r\n\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0.fontWeight(500)\r\n\u00a0\u00a0.format(\"&lt;span style='font-size:16px'&gt;TOTAL CASES&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style='font-size:16px'&gt;{%value}{groupsSeparator:\\\\,}&lt;\/span&gt;\");\r\n\/\/ enable HTML in tooltips\r\nchart.tooltip().useHtml(true);\r\n\/\/ customize the format of the sunburst chart tooltip\r\nchart\r\n\u00a0\u00a0.tooltip()\r\n\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0.format(\"&lt;h5 style='font-size:14px; margin: 0.25rem 0;'&gt;{%name}&lt;\/h5&gt;&lt;h6 style='font-size:14px; font-weight:400; margin: 0.2rem 0;'&gt;Total Cases: &lt;b&gt;{%value}{groupsSeparator:\\\\,}&lt;\/b&gt;&lt;\/h6&gt;&lt;h6 style='font-size:14px; font-weight:400; margin: 0.2rem 0;'&gt;Total Deaths: &lt;b&gt;{%total_deaths}{groupsSeparator:\\\\,}&lt;\/b&gt;&lt;\/h6&gt;\");<\/code><\/pre>\n<p>Check out the new look and the updated code for these formatting changes:<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-6GU748uM\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/6GU748uM\/iframe\"><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-6GU748uM{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p><a href=\"https:\/\/playground.anychart.com\/6GU748uM\/\" target=\"_blank\" rel=\"nofollow\">Playground link<\/a><br \/>\n<a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/bGeXXYQ\" target=\"_blank\" rel=\"nofollow\">CodePen link<\/a><\/p>\n<h3>D. Fill and Stroke Effect<\/h3>\n<p>The sunburst chart already looked great, but I decided to add a final set of finishing touches to make it look even cooler. I darkened the colors for the 2nd level and reduced the stroke for each region to give a look of depth to the entire visualization.<\/p>\n<pre><code class=\"javascript\">\/\/ configure the chart stroke\r\nchart.normal().stroke(\"#fff\", 0.2);\r\n\/\/ set the point fill\r\nchart.fill(function (d) {\r\n  return anychart.color.darken(this.parentColor, 0.15);\r\n});<\/code><\/pre>\n<p><strong>Here is my final interactive JavaScript sunburst chart ready and shining!<\/strong><\/p>\n<p>It provides a great way to explore the data about COVID-19 cases and deaths by continent and by country. (Click on a continent to drill down.)<\/p>\n<p><iframe class=\"anychart-embed anychart-embed-ORpp8UYK\" src=\"https:\/\/playground.anychart.com\/ORpp8UYK\/iframe\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\" style=\"width:100%;height:600px;\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">\nac_add_style(\".anychart-embed-ORpp8UYK{width:100%;height:600px;}\");\n<\/script><\/p>\n<p><a href=\"https:\/\/playground.anychart.com\/ORpp8UYK\/\" target=\"_blank\" rel=\"nofollow\">Playground link<\/a><br \/>\n<a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/NWrZxJq\" target=\"_blank\" rel=\"nofollow\">CodePen link<\/a><\/p>\n<p>For your convenience, just in case, you\u2019ve got an image and the complete HTML\/CSS\/JS code below too.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-11807\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/js-sunburst-final-chart.png\" alt=\"Final JS sunburst chart visualization of COVID data\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/js-sunburst-final-chart.png 1200w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/js-sunburst-final-chart-300x165.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/js-sunburst-final-chart-768x422.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/js-sunburst-final-chart-1024x563.png 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<pre><code class=\"html\">&lt;html&gt;\r\n&lt;head&gt;\r\n\u00a0\u00a0&lt;title&gt;JavaScript Sunburst&lt;\/title&gt;\r\n\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-sunburst.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 0;\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\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\nanychart.onDocumentReady(function () {\r\nanychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/shacheeswadia\/3bbe6eb041166e259f1712e6766fa5a2\/raw\/341d2796dd63e6e6defc1ec52dd4e73c7828c38c\/sunburstDataUpdated.json',\r\n\u00a0\u00a0function (data) {\r\n\u00a0\u00a0\u00a0\u00a0\/\/ create a data tree from the dataset\r\n\u00a0\u00a0\u00a0\u00a0var dataTree = anychart.data.tree(data);\r\n    \r\n\u00a0\u00a0\u00a0\u00a0\/\/ create a sunburst chart\r\n\u00a0\u00a0\u00a0\u00a0var chart = anychart.sunburst(dataTree);\r\n\u00a0\u00a0\u00a0\u00a0\/\/ set the calculation mode\r\n\u00a0\u00a0\u00a0\u00a0chart.calculationMode('parent-independent');\r\n\u00a0\u00a0\u00a0\u00a0\/\/ set the ascending sort order\r\n\u00a0\u00a0\u00a0\u00a0chart.sort('asc');\r\n\u00a0\u00a0\u00a0\u00a0\/\/ set the chart title\r\n\u00a0\u00a0\u00a0\u00a0chart.title(\"COVID-19 Cases Across the World\");\r\n  \r\n\u00a0\u00a0\u00a0\u00a0\/\/ enable HTML in labels\r\n\u00a0\u00a0\u00a0\u00a0chart.labels().useHtml(true);\r\n\u00a0\u00a0\u00a0\u00a0\/\/ customize the format of the sunburst chart labels\r\n\u00a0\u00a0\u00a0\u00a0chart\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.level(1)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.labels()\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.format(\"&lt;span style='font-size:16px'&gt;{%name}&lt;\/span&gt;\");\r\n\u00a0\u00a0\u00a0\u00a0chart\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.level(0)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.labels()\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.fontWeight(500)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.format(\"&lt;span style='font-size:16px'&gt;TOTAL CASES&lt;\/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style='font-size:16px'&gt;{%value}{groupsSeparator:\\\\,}&lt;\/span&gt;\");\r\n\u00a0\u00a0\u00a0\u00a0\/\/ enable HTML in tooltips\r\n\u00a0\u00a0\u00a0\u00a0chart.tooltip().useHtml(true);\r\n\u00a0\u00a0\u00a0\u00a0\/\/ customize the format of the sunburst chart tooltip\r\n\u00a0\u00a0\u00a0\u00a0chart\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.tooltip()\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.fontFamily(\"Verdana, sans-serif\")\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0.format(\"&lt;h5 style='font-size:14px; margin: 0.25rem 0;'&gt;{%name}&lt;\/h5&gt;&lt;h6 style='font-size:14px; font-weight:400; margin: 0.2rem 0;'&gt;Total Cases: &lt;b&gt;{%value}{groupsSeparator:\\\\,}&lt;\/b&gt;&lt;\/h6&gt;&lt;h6 style='font-size:14px; font-weight:400; margin: 0.2rem 0;'&gt;Total Deaths: &lt;b&gt;{%total_deaths}{groupsSeparator:\\\\,}&lt;\/b&gt;&lt;\/h6&gt;\");\r\n   \r\n\u00a0\u00a0\u00a0\u00a0\/\/ configure the chart stroke\r\n\u00a0\u00a0\u00a0\u00a0chart.normal().stroke(\"#fff\", 0.2);\r\n\u00a0\u00a0\u00a0\u00a0\/\/ set the point fill\r\n\u00a0\u00a0\u00a0\u00a0chart.fill(function (d) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return anychart.color.darken(this.parentColor, 0.15);\r\n\u00a0\u00a0\u00a0\u00a0});\r\n    \r\n\u00a0\u00a0\u00a0\u00a0\/\/ set the chart container element id\r\n\u00a0\u00a0\u00a0\u00a0chart.container('container');\r\n\u00a0\u00a0\u00a0\u00a0\/\/ initiate chart drawing\r\n\u00a0\u00a0\u00a0\u00a0chart.draw();\r\n  \r\n\u00a0\u00a0});\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>As you can see, this current period is difficult but building a JavaScript Sunburst Chart is not!<\/p>\n<p>By the way, I was also thinking of changing the way the last-level labels are positioned, from radial (default) to circular. But I decided to not do that. If you\u2019d like to give it a try, just add the following one line somewhere in the JS chart code:<\/p>\n<pre><code class=\"javascript\">chart.level(2).labels().position('circular');<\/code><\/pre>\n<p>Don\u2019t stop learning. Go on and use your newly acquired skill to create a JavaScript Sunburst Chart visualizing some other interesting hierarchical dataset. If you have any questions, I\u2019ll gladly do my best to be of help.<\/p>\n<p>Also, till the global situation improves, stay safe!<\/p>\n<hr \/>\n<p><em>Published with permission of Shachee Swadia. Originally appeared on <a href=\"https:\/\/towardsdatascience.com\/how-i-created-a-sunburst-chart-using-javascript-to-visualize-covid-19-data-4ef27b45af8a\" target=\"_blank\" rel=\"nofollow\">Towards Data Science<\/a> under the title &#8220;How I Created a Sunburst Chart Using JavaScript to Visualize Covid-19 Data: A step-by-step tutorial on building interactive JS sunburst charts with ease&#8221; on December 3, 2020.<\/em><\/p>\n<hr \/>\n<p><em>Check out other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a>.<\/em><\/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>Almost recovered from COVID-19 myself these days, I decided to explore how the world is currently doing, during the pandemic. So I created a sunburst chart to see at a glance what continents and countries are more (and less) affected by the coronavirus than others. The process was quick and I thought someone could be [&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,263,8,23,13,279,4],"tags":[53,284,127,258,1766,1823,1773,1771,1772,1819,1800,1801,1803,1804,1925,1977,2139,1769,1975,1936,1954,1824,1974,1935,156,282,471,266,620,916,1292,880,806,194,1759,509,1098,840,294,2220,54,1760,256,1111,350,842,744,844,165,1370,774,2223,2225,2226,805,1154,1762,2013,2014,32,55,144,2016,146,151,36,907,141,249,81,57,1238,99,58,65,56,101,1937,1938,1768,679,1817,1601,459,2221,2222,30,1369,2224,1221,190,172,1625,807,808,293,745,899,1939,2015,1763,804,1767],"class_list":["post-11795","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-big-data","category-business-intelligence","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-anychart","tag-chart-examples","tag-chart-types","tag-charts","tag-coronavirus","tag-coronavirus-cases","tag-coronavirus-charts","tag-coronavirus-data","tag-coronavirus-data-visualization","tag-coronavirus-outbreak","tag-coronavirus-pandemic","tag-coronavirus-pandemic-charts","tag-coronavirus-pandemic-data","tag-coronavirus-pandemic-data-visualization","tag-covid","tag-covid-charting-library","tag-covid-crisis","tag-covid-19","tag-covid-19-analytics","tag-covid-19-cases","tag-covid-19-charts","tag-covid-19-deaths","tag-covid-19-outbreak","tag-covid-19-statistics","tag-customizability","tag-data","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-api","tag-data-chart","tag-data-charting","tag-data-charts","tag-data-comparison","tag-data-design","tag-data-graphics","tag-data-is-beautiful","tag-data-presentations","tag-data-science","tag-data-visual","tag-data-visualization","tag-data-visualization-design","tag-data-visualization-examples","tag-data-visualization-practice","tag-data-visualization-projects","tag-data-visualization-task","tag-data-visualization-techniques","tag-data-visualization-tutorial","tag-data-visualizations","tag-data-viz-examples","tag-dataviz-examples","tag-diagrams","tag-drill-down","tag-drill-down-chart","tag-front-end-development","tag-good-data-visualization","tag-guest-post","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographics","tag-information-visualization","tag-interactive-data-visualization","tag-interactive-visualizations","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-api","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-graph","tag-javascript-library","tag-js-chart","tag-js-charting","tag-js-charts","tag-js-graphics","tag-json","tag-json-data-visualization","tag-novel-coronavirus","tag-our-world-in-data","tag-pandemic","tag-pandemics","tag-statistics","tag-sunburst-chart","tag-sunburst-diagram","tag-tips-and-tricks","tag-towards-data-science","tag-tree-data","tag-treemap","tag-treemap-chart","tag-tutorial","tag-visual","tag-visual-analysis","tag-visual-analytics","tag-visualization","tag-visualization-techniques","tag-visualizations","tag-visualizing-json-data","tag-web-charts","tag-web-developers","tag-web-development","tag-wuhan-coronavirus","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How I Created Sunburst Chart in JS to Visualize COVID-19 Data<\/title>\n<meta name=\"description\" content=\"A great tutorial on making JS Sunburst Charts. Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.\" \/>\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\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How I Created Sunburst Chart in JS to Visualize COVID-19 Data\" \/>\n<meta property=\"og:description\" content=\"A great tutorial: Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\" \/>\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=\"2020-12-08T12:14:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T08:27:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\" \/>\n<meta name=\"author\" content=\"Shachee Swadia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How I Created Sunburst Chart in JS to Visualize COVID-19 Data\" \/>\n<meta name=\"twitter:description\" content=\"A great tutorial: Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.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=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\"},\"author\":{\"name\":\"Shachee Swadia\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"headline\":\"How I Created Sunburst Chart Using JavaScript to Visualize COVID-19 Data\",\"datePublished\":\"2020-12-08T12:14:59+00:00\",\"dateModified\":\"2022-08-13T08:27:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\"},\"wordCount\":1759,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\",\"keywords\":[\"AnyChart\",\"chart examples\",\"chart types\",\"charts\",\"coronavirus\",\"coronavirus cases\",\"coronavirus charts\",\"coronavirus data\",\"coronavirus data visualization\",\"coronavirus outbreak\",\"coronavirus pandemic\",\"coronavirus pandemic charts\",\"coronavirus pandemic data\",\"coronavirus pandemic data visualization\",\"covid\",\"COVID charting library\",\"COVID crisis\",\"COVID-19\",\"COVID-19 analytics\",\"COVID-19 cases\",\"COVID-19 charts\",\"COVID-19 deaths\",\"COVID-19 outbreak\",\"COVID-19 statistics\",\"Customizability\",\"data\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data API\",\"data chart\",\"data charting\",\"data charts\",\"data comparison\",\"data design\",\"data graphics\",\"data is beautiful\",\"data presentations\",\"data science\",\"data visual\",\"Data Visualization\",\"data visualization design\",\"data visualization examples\",\"data visualization practice\",\"data visualization projects\",\"data visualization task\",\"data visualization techniques\",\"data visualization tutorial\",\"data visualizations\",\"data viz examples\",\"dataviz examples\",\"diagrams\",\"drill down\",\"drill down chart\",\"front-end development\",\"good data visualization\",\"guest post\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographics\",\"information visualization\",\"interactive data visualization\",\"interactive visualizations\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting library\",\"javascript charts\",\"javascript graph\",\"JavaScript library\",\"js chart\",\"js charting\",\"js charts\",\"JS graphics\",\"JSON\",\"JSON data visualization\",\"novel coronavirus\",\"Our World in Data\",\"pandemic\",\"pandemics\",\"statistics\",\"sunburst chart\",\"sunburst diagram\",\"Tips and tricks\",\"Towards Data Science\",\"tree data\",\"treemap\",\"treemap chart\",\"tutorial\",\"visual\",\"visual analysis\",\"visual analytics\",\"visualization\",\"visualization techniques\",\"visualizations\",\"visualizing JSON data\",\"web charts\",\"web developers\",\"web development\",\"Wuhan coronavirus\"],\"articleSection\":[\"AnyChart Charting Component\",\"Big Data\",\"Business Intelligence\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\",\"name\":\"How I Created Sunburst Chart in JS to Visualize COVID-19 Data\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\",\"datePublished\":\"2020-12-08T12:14:59+00:00\",\"dateModified\":\"2022-08-13T08:27:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"description\":\"A great tutorial on making JS Sunburst Charts. Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png\",\"width\":1550,\"height\":889},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How I Created Sunburst Chart Using JavaScript to Visualize COVID-19 Data\"}]},{\"@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":"How I Created Sunburst Chart in JS to Visualize COVID-19 Data","description":"A great tutorial on making JS Sunburst Charts. Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.","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\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/","og_locale":"en_US","og_type":"article","og_title":"How I Created Sunburst Chart in JS to Visualize COVID-19 Data","og_description":"A great tutorial: Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.","og_url":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2020-12-08T12:14:59+00:00","article_modified_time":"2022-08-13T08:27:42+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","type":"","width":"","height":""}],"author":"Shachee Swadia","twitter_card":"summary_large_image","twitter_title":"How I Created Sunburst Chart in JS to Visualize COVID-19 Data","twitter_description":"A great tutorial: Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Shachee Swadia","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/"},"author":{"name":"Shachee Swadia","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"headline":"How I Created Sunburst Chart Using JavaScript to Visualize COVID-19 Data","datePublished":"2020-12-08T12:14:59+00:00","dateModified":"2022-08-13T08:27:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/"},"wordCount":1759,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","keywords":["AnyChart","chart examples","chart types","charts","coronavirus","coronavirus cases","coronavirus charts","coronavirus data","coronavirus data visualization","coronavirus outbreak","coronavirus pandemic","coronavirus pandemic charts","coronavirus pandemic data","coronavirus pandemic data visualization","covid","COVID charting library","COVID crisis","COVID-19","COVID-19 analytics","COVID-19 cases","COVID-19 charts","COVID-19 deaths","COVID-19 outbreak","COVID-19 statistics","Customizability","data","data analysis","data analytics","data analytics examples","data API","data chart","data charting","data charts","data comparison","data design","data graphics","data is beautiful","data presentations","data science","data visual","Data Visualization","data visualization design","data visualization examples","data visualization practice","data visualization projects","data visualization task","data visualization techniques","data visualization tutorial","data visualizations","data viz examples","dataviz examples","diagrams","drill down","drill down chart","front-end development","good data visualization","guest post","HTML","HTML charts","HTML5","html5 charts","infographics","information visualization","interactive data visualization","interactive visualizations","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting library","javascript charts","javascript graph","JavaScript library","js chart","js charting","js charts","JS graphics","JSON","JSON data visualization","novel coronavirus","Our World in Data","pandemic","pandemics","statistics","sunburst chart","sunburst diagram","Tips and tricks","Towards Data Science","tree data","treemap","treemap chart","tutorial","visual","visual analysis","visual analytics","visualization","visualization techniques","visualizations","visualizing JSON data","web charts","web developers","web development","Wuhan coronavirus"],"articleSection":["AnyChart Charting Component","Big Data","Business Intelligence","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/","url":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/","name":"How I Created Sunburst Chart in JS to Visualize COVID-19 Data","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","datePublished":"2020-12-08T12:14:59+00:00","dateModified":"2022-08-13T08:27:42+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"description":"A great tutorial on making JS Sunburst Charts. Learn what a sunburst chart is and how to create it with ease using JavaScript. Illustrated on COVID-19 data.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/12\/sunburst-chart-js-covid.png","width":1550,"height":889},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2020\/12\/08\/sunburst-chart-javascript-to-visualize-covid-19-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How I Created Sunburst Chart Using JavaScript to Visualize COVID-19 Data"}]},{"@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\/11795","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=11795"}],"version-history":[{"count":28,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/11795\/revisions"}],"predecessor-version":[{"id":15475,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/11795\/revisions\/15475"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=11795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=11795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=11795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}