{"id":15629,"date":"2022-09-08T13:50:40","date_gmt":"2022-09-08T13:50:40","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=15629"},"modified":"2022-09-08T16:33:22","modified_gmt":"2022-09-08T16:33:22","slug":"circle-packing-chart","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/","title":{"rendered":"Creating Circle Packing Chart with JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png\" alt=\"Circle Packing Chart on a web page\" width=\"100%\" class=\"alignnone size-full wp-image-15635\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png 1200w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-300x169.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-768x432.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-1024x576.png 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a>A <strong>circle packing chart<\/strong> is a common data visualization technique for representing hierarchically organized data through nested circles. Due to the similarity to a <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/treemap\/\">treemap<\/a>, which uses nested rectangles for the same purpose, sometimes it is called a circular treemap. Introduced to data analysis by American mathematician <a href=\"https:\/\/en.wikipedia.org\/wiki\/William_Thurston\" target=\"_blank\" rel=\"nofollow\">William Thurston<\/a> in 1985, circle packings greatly reveal the hierarchical structure of data.<\/p>\n<p>I want to show how you can easily build an elegant interactive circle packing chart with the help of JavaScript! In this step-by-step tutorial, we will be representing the world&#8217;s 100 wealthiest people in 2022 by country and industry, according to Forbes&#8217; list of billionaires. So, get your packings done and get ready as your brain is going to get slightly richer!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>Circle Packing Chart That Will Be Created<\/h2>\n<p>Let me demonstrate what our JavaScript circle packing chart will look like when finished. And it will be interactive! Once you complete this tutorial, you will be fully capable of quickly visualizing your own data in your own circle packing chart.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/javascript-circle-packing-chart.png\" alt=\"JavaScript Circle Packing Chart Built in This Data Visualization Tutorial\" width=\"100%\" class=\"alignnone size-full wp-image-15633\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/javascript-circle-packing-chart.png 1280w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/javascript-circle-packing-chart-300x188.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/javascript-circle-packing-chart-768x480.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/javascript-circle-packing-chart-1024x640.png 1024w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>Now, let\u2019s proceed to make it!<\/p>\n<h2>Basic Circle Packing Chart with JavaScript<\/h2>\n<p>Even though it isn&#8217;t required, having some prior knowledge of HTML, CSS, and JavaScript would make it especially easier to grasp the concepts. However, even if you are a total newbie, there is no need to panic. By the time we are done, you will have learned how to make a circle packing chart by yourself as we will go over each step in depth.<\/p>\n<p>Any JavaScript chart, including our circle packing diagram, can be created in four general steps:<\/p>\n<ol>\n<li>Prepare a web page.<\/li>\n<li>Include all necessary JS files.<\/li>\n<li>Load your data.<\/li>\n<li>Write some JavaScript charting code.<\/li>\n<\/ol>\n<p>Let&#8217;s explore these steps in more detail to prepare an amazing interactive JS-based circle packing chart.<\/p>\n<h3>1. Prepare a web page<\/h3>\n<p>First of all, we need a place for the circle packing chart.<\/p>\n<p>Build a web page if you don\u2019t have it yet. There, create a container for the plot by adding an HTML block element with a unique ID. Also, specify some CSS rules for this element to define how the chart should be displayed.<\/p>\n<p>Here\u2019s how my HTML page looks:<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;meta charset=\"utf-8\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;Circle Packing Chart in JavaScript&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;      \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html, body, #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>In my example, the block element is <code>&lt;div&gt;<\/code>. Its ID is <code>container<\/code>. The <code>width<\/code> and <code>height<\/code> properties are set to 100%, while <code>margin<\/code> and <code>padding<\/code> are set to 0, which will make the circle packing chart appear throughout the entire page; but you are welcome to define all that however you see fit in your situation.<\/p>\n<h3>2. Include all necessary JS files<\/h3>\n<p>Next, we need all necessary JavaScript files to be referenced in the <code>&lt;head&gt;<\/code> section.<\/p>\n<p>When you <a href=\"https:\/\/www.anychart.com\/blog\/2017\/03\/05\/how-to-choose-the-right-javascript-charting-component-10-factors-you-have-to-consider\/\">utilize the right data visualization tool<\/a>, creating a circle packing chart won&#8217;t be as difficult or time-consuming as it might be. For this tutorial, I\u2019ve chosen to use <a href=\"https:\/\/www.anychart.com\/\">AnyChart JS Charts<\/a>. It is one of a few JavaScript charting libraries that support circle packing charts out of the box and is beginner-friendly because it offers a ton of <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/\">examples<\/a> that are ready to use and has thorough <a href=\"https:\/\/docs.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">documentation<\/a>.<\/p>\n<p>For adding the required JavaScript files, we have two options: download them locally or use them from a content delivery network (CDN). Let\u2019s opt for the second one. Add the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">Core<\/a> and <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#circle_packing\" target=\"_blank\" rel=\"nofollow\">Circle Packing<\/a> scripts for charting. Plus, if you are going to visualize data from a file, like me in this case, include the <a href=\"https:\/\/docs.anychart.com\/Working_with_Data\/Data_Adapter\/Overview\" target=\"_blank\" rel=\"nofollow\">Data Adapter<\/a> module to facilitate the data loading. The JS code itself will be put in the <code>&lt;script&gt;<\/code> tag in the <code>&lt;body&gt;<\/code> section (it can be set up in the <code>&lt;head&gt;<\/code> section, alternatively).<\/p>\n<p>Here\u2019s a look at my current HTML page:<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;meta charset=\"utf-8\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;Circle Packing Chart in JavaScript&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.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.11.0\/js\/anychart-circle-packing.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.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, body, #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      \/\/ The JS Circle Packing Chart\u2019s code will be written 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. Load your data<\/h3>\n<p>Now it\u2019s time to add data.<\/p>\n<p>I want to visualize data from Forbes\u2019 ranking of the richest people, <a href=\"https:\/\/www.forbes.com\/billionaires\/\" target=\"_blank\" rel=\"nofollow\">Forbes Billionaires 2022<\/a>, which includes information on their net worth, countries, sources of wealth, and industries. I have already taken the data from the above link on the 100 wealthiest of them and saved it in a <a href=\"https:\/\/gist.githubusercontent.com\/awanshrestha\/ff3ae5c08238b1f4f950f022aaad2f6f\/raw\/3766915befaeea7a32f3d41fdc2ece110e7543d7\/circle-packing-chart.json\" target=\"_blank\" rel=\"nofollow\">JSON file<\/a>. (Feel free to use other <a href=\"https:\/\/docs.anychart.com\/Working_with_Data\/Supported_Data_Formats\" target=\"_blank\" rel=\"nofollow\">supported data formats<\/a>, just make sure the way the data is set conforms to the <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Circle_Packing_Chart#data\" target=\"_blank\" rel=\"nofollow\">data instructions for circle packing charts<\/a>.)<\/p>\n<p>To appropriately load the data, get ready to use the <code>anychart.data.loadJsonFile()<\/code> function. Like this:<\/p>\n<pre><code class=\"javascript\">anychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/awanshrestha\/ff3ae5c08238b1f4f950f022aaad2f6f\/raw\/3766915befaeea7a32f3d41fdc2ece110e7543d7\/circle-packing-chart.json');\r\n<\/code><\/pre>\n<p>Now, only a few lines of JavaScript code remain to complete the circle packing chart!<\/p>\n<h3>4. Write some JavaScript charting code<\/h3>\n<p>Finally, we need some JavaScript code to create the circle packing chart.<\/p>\n<p>Add the <code>anychart.onDocumentReady()<\/code> function, which will include the entire chart&#8217;s JS code. It makes sure that the code won&#8217;t run until the page has completely loaded.<\/p>\n<pre><code class=\"html\">&lt;script&gt;\r\n\u00a0\u00a0\u00a0anychart.onDocumentReady(function () {\r\n  \u00a0\u00a0\u00a0\/\/ The JS Circle Packing Chart's code will be written here.\r\n&lt;\/script&gt;\r\n<\/code><\/pre>\n<p>Load the JSON data file as shown in Step 3 and add the data.<\/p>\n<pre><code class=\"html\">&lt;script&gt;\r\n \r\n  anychart.onDocumentReady(function () {\r\n  \r\n  \u00a0\u00a0\/\/ load a json data file\r\nanychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/awanshrestha\/ff3ae5c08238b1f4f950f022aaad2f6f\/raw\/3766915befaeea7a32f3d41fdc2ece110e7543d7\/circle-packing-chart.json',\r\n\u00a0\u00a0\u00a0\u00a0  function(data) {\r\n \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  \/\/ add the data\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0  var treeData = anychart.data.tree(data, 'as-table');\r\n \r\n\u00a0\u00a0\u00a0\u00a0  }\r\n\u00a0\u00a0  );\r\n\r\n});\r\n\r\n&lt;\/script&gt;<\/code><\/pre>\n<p>Use the <code>circlePacking()<\/code> function to create a circle packing chart instance, passing the data set into it.<\/p>\n<pre><code class=\"javascript\">\/\/ create a circle packing chart instance\r\nvar chart = anychart.circlePacking(treeData);<\/code><\/pre>\n<p>Lastly, give the chart a title, place it in the container that was previously specified, and display it by using the <code>draw()<\/code> command.<\/p>\n<pre><code class=\"javascript\">\/\/ add a chart title\r\nchart.title(\"Forbes Top 100 Richest people\");\r\n\/\/ specify the container element id\r\nchart.container('container')\r\n\/\/ initiate the drawing of the chart\r\nchart.draw();<\/code><\/pre>\n<p>Tada! The JavaScript-based circle packing chart is ready!<\/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-U15jLGZ6\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/U15jLGZ6\/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-U15jLGZ6{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>You can find the interactive version of this simple JavaScript circle packing chart on <a href=\"https:\/\/playground.anychart.com\/U15jLGZ6\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a> chart along with the source code. Feel free to experiment with it.<\/p>\n<p>I will also put the complete circle packing chart code below for your convenience.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;title&gt;Circle Packing Chart in JavaScript&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.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.11.0\/js\/anychart-circle-packing.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.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      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n\u00a0\u00a0\u00a0\u00a0&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\n      anychart.onDocumentReady(function () {\r\n  \r\n        \/\/ load a json data file\r\nanychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/awanshrestha\/ff3ae5c08238b1f4f950f022aaad2f6f\/raw\/3766915befaeea7a32f3d41fdc2ece110e7543d7\/circle-packing-chart.json',\r\n          function(data) {\r\n \r\n            \/\/ add the data\r\n            var treeData = anychart.data.tree(data, 'as-table');\r\n \r\n            \/\/ create a circle packing chart instance\r\n            var chart = anychart.circlePacking(treeData);\r\n    \r\n            \/\/ add a chart title\r\n            chart.title(\"Forbes Top 100 Richest people\");\r\n      \r\n            \/\/ specify the container element id\r\n            chart.container('container');\r\n    \r\n            \/\/ initiate the drawing of the chart\r\n            chart.draw();\r\n    \r\n          }\r\n        );\r\n\r\n      });\r\n \r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>We can immediately deduce from the circle packing chart that the majority of the top billionaires are from the United States, followed by China. Similar to that, we can also get insights regarding industries along with the net worth amounts.<\/p>\n<p>However, this is only a basic version of the JS circle packing chart. The graphic can be further customized to look much better (still without much hassle).<\/p>\n<h2>Advanced Circle Packing Chart with JavaScript<\/h2>\n<p>The circle packing diagram created with JS so far already looks pleasing to the eye. But occasionally, decent is insufficient. Additionally, there are instances when you may need to adjust the chart&#8217;s appearance and functionality.<\/p>\n<p>Fortunately, you can easily customize the circle packing charts to meet your needs and tastes. Now I will demonstrate some quick customizations you may also want to make to improve the visualization:<\/p>\n<ol type=\"A\">\n<li>Customize the tooltip.<\/li>\n<li>Customize the appearance.<\/li>\n<li>Customize the title.<\/li>\n<li>Customize the labels.<\/li>\n<\/ol>\n<h3>A. Customize the tooltip<\/h3>\n<p>When we hover over the circles, net worth values are shown. Let&#8217;s customize the tooltip so that it contains more information.<\/p>\n<pre><code class=\"javascript\">chart\r\n  .tooltip()\r\n  .useHtml(true)\r\n  .format(function () {\r\n    var src = this.item.get('industry');\r\n    if (src) {\r\n      return '&lt;div&gt;'\r\n        + '&lt;span&gt;Name: ' + this.name + '&lt;\/span&gt;&lt;br\/&gt;'\r\n        + '&lt;span&gt;Net worth in billions USD:' + this.value + '&lt;\/span&gt;&lt;br\/&gt;'\r\n        + '&lt;span&gt;Source: ' + this.item.get('source') + '&lt;\/span&gt;'\r\n        + '&lt;\/div&gt;'\r\n    }\r\n    return '&lt;span&gt;Total net worth: ' + this.value.toFixed(2) + ' billion USD&lt;\/span&gt;';\r\n  });<\/code><\/pre>\n<p>Now we can clearly see the names, net worth, and sources of wealth for the billionaires\u2019 circles, as well as total net worth values for industry and country groups.<\/p>\n<h3>B. Customize the appearance<\/h3>\n<p>The background color of the chart is white by default. Let\u2019s change it to gray. It can be easily done using the <code>background()<\/code> function.<\/p>\n<p>Let\u2019s also slightly increase the thickness of the circles\u2019 borders using the <code>stroke()<\/code> function.<\/p>\n<pre><code class=\"javascript\">\/\/ customize the background\r\nchart.background('#f6f6f6');\r\n\/\/ customize the stroke\r\nchart\r\n  .stroke(function () {\r\n    return {\r\n      thickness: 1,\r\n    };\r\n  });\r\n\/\/ customize the stroke in the hovered state\r\nchart\r\n  .hovered()\r\n  .stroke(function () {\r\n    return {\r\n      thickness: 2,\r\n    };\r\n  });<\/code><\/pre>\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-ZwCauFfE\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/ZwCauFfE\/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-ZwCauFfE{width:100%; height:600px;}\");\n})();<\/script><\/p>\n<p>This JS circle packing\u2019s interactive version is available on <a href=\"https:\/\/playground.anychart.com\/ZwCauFfE\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>. Change the colors as you prefer.<\/p>\n<h3>C. Customize the title<\/h3>\n<p>The chart title can be easily enhanced. Follow me as I simply enable HTML and change the font color, size, and weight:<\/p>\n<pre><code class=\"javascript\">chart\r\n  .title()\r\n  .enabled(true)\r\n  .useHtml(true)\r\n  .text(\r\n    '&lt;span style = \"color: #112B3C; font-weight: 600; font-size: 18px;\"&gt;100 Richest People, According to Forbes&lt;\/span&gt;'\r\n  );<\/code><\/pre>\n<p>This is how the circle packing plot looks after this title enhancement:<\/p>\n<h3>D. Customize the labels<\/h3>\n<p>At the time being, the names of the countries are displayed in the default format. Let\u2019s customize them to make them appear inside boxes in a more elegant manner:<\/p>\n<pre><code class=\"javascript\">chart\r\n  .labels()\r\n  .fontSize('14')\r\n  .fontColor('#696969')\r\n  .textShadow('none')\r\n  .anchor('center-top').offsetY('-3%');\r\n \r\nchart.labels()\r\n  .background()\r\n  .enabled(true)\r\n  .fill(\"#f6f6f6 0.8\")\r\n  .stroke(\"#888888\")\r\n  .corners(5);<\/code><\/pre>\n<p>The circle packing chart looks very classy and beautiful now. Why wouldn&#8217;t it? After all, it is being used to visualize people with billions of worth!<\/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-UFPukRgn\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/UFPukRgn\/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-UFPukRgn{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>The complete source code for this final JavaScript circle packing chart is available below, as well as on <a href=\"https:\/\/playground.anychart.com\/UFPukRgn\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;title&gt;Circle Packing Chart in JavaScript&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.0\/js\/anychart-circle-packing.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        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\n        anychart.onDocumentReady(function () {\r\n  \r\n        \/\/ load a json data file\r\nanychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/awanshrestha\/ff3ae5c08238b1f4f950f022aaad2f6f\/raw\/3766915befaeea7a32f3d41fdc2ece110e7543d7\/circle-packing-chart.json',\r\n          function(data) {\r\n \r\n            \/\/ add the data\r\n            var treeData = anychart.data.tree(data, 'as-table');\r\n \r\n            \/\/ create a circle packing chart instance\r\n            var chart = anychart.circlePacking(treeData);\r\n    \r\n            \/\/ customize the tooltip\r\n            chart\r\n              .tooltip()\r\n              .useHtml(true)\r\n              .format(function () {\r\n                var src = this.item.get('industry');\r\n                if (src) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      return '&lt;div&gt;'\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      + '&lt;span&gt;Name: ' + this.name + '&lt;\/span&gt; &lt;br\/&gt;'\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      + '&lt;span&gt;Net worth in Billions: ' + this.value + '&lt;\/span&gt; &lt;br\/&gt;'\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      + '&lt;span&gt;Source: ' + this.item.get('source') + '&lt;\/span&gt;'\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      + '&lt;\/div&gt;' \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0      return '&lt;span&gt;' + this.value.toFixed(2) + ' Billion Dollars &lt;\/span&gt;';\r\n              });\r\n \r\n            \/\/ add a chart title\r\n            chart\r\n              .title()\r\n              .enabled(true)\r\n              .useHtml(true)\r\n              .text(\r\n                '&lt;span style = \"color: #112B3C;font-weight:600;font-size:18px;\"&gt;Forbes Top 100 Richest People&lt;\/span&gt;'\r\n              );\r\n    \r\n            \/\/ customize the appearance\r\n            chart.background('#f6f6f6');\r\n            chart\r\n              .hovered()\r\n              .stroke(function () {\r\n                return {\r\n                  thickness: 2,\r\n                };\r\n              });\r\n            chart\r\n              .stroke(function () {\r\n                return {\r\n                  thickness: 1,\r\n                };\r\n              });\r\n    \r\n            \/\/ customize the labels (country names)\r\n            chart\r\n              .labels()\r\n              .fontSize('14')\r\n              .fontColor('#696969')\r\n              .textShadow('none')\r\n              .anchor('center-top').offsetY('-3%');\r\n \r\n            chart.labels()\r\n              .background()\r\n              .enabled(true)\r\n              .fill(\"#f6f6f6 0.8\")\r\n              .stroke(\"#888888\")\r\n              .corners(5);\t\r\n      \r\n            \/\/ specify the container element id\r\n            chart.container('container');\r\n    \r\n            \/\/ initiate the drawing of the chart\r\n            chart.draw();\r\n    \r\n          }\r\n        );\r\n\r\n      });\r\n \r\n\u00a0\u00a0\u00a0\u00a0&lt;\/body&gt;\r\n\u00a0\u00a0&lt;\/script&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>Fantastic! Our JavaScript circle packing chart has been constructed. And it&#8217;s been an easy process, right? Now, go ahead and create your own JavaScript circle packing chart visualization! The <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Circle_Packing_Chart\" target=\"_blank\" rel=\"nofollow\">circle packing chart documentation<\/a> and <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/Circle_Packing\/\">circle packing chart examples<\/a> are at your service for further instructions and inspiration, respectively.<\/p>\n<p>Additionally, there are a ton of additional <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Supported_Charts_Types\" target=\"_blank\" rel=\"nofollow\">chart types<\/a> available and don&#8217;t be afraid to look at them. You&#8217;ll be amazed you can also build them in JS with ease!<\/p>\n<p>Finally, please don&#8217;t hesitate to ask for queries or make suggestions. And I\u2019m looking forward to seeing the JavaScript circle packing charts you will create!<\/p>\n<hr \/>\n<p><strong><em>We are thankful to Awan Shrestha for contributing this awesome <strong>Circle Packing Chart<\/strong> tutorial!<\/p>\n<p>Don&#8217;t miss out on our <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a> for other chart types.<\/p>\n<p>Ready to write a cool guest post like this for our blog? Please <a href=\"https:\/\/www.anychart.com\/support\/\">get in touch<\/a> to tell us about your ideas!<\/em><\/strong><\/p>\n<hr \/>\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>A circle packing chart is a common data visualization technique for representing hierarchically organized data through nested circles. Due to the similarity to a treemap, which uses nested rectangles for the same purpose, sometimes it is called a circular treemap. Introduced to data analysis by American mathematician William Thurston in 1985, circle packings greatly reveal [&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":22,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,23,13,279,4],"tags":[53,260,284,127,258,2937,471,266,620,54,1389,256,1111,844,130,165,313,1370,774,145,1762,32,55,144,36,907,141,81,57,58,65,56,2744,459,30,172],"class_list":["post-15629","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-anychart","tag-best-data-visualization-examples","tag-chart-examples","tag-chart-types","tag-charts","tag-circle-packing","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-visualization","tag-data-visualization-best-pracices","tag-data-visualization-examples","tag-data-visualization-practice","tag-data-visualization-tutorial","tag-data-visualization-weekly","tag-data-visualizations","tag-data-visuals","tag-data-viz-examples","tag-dataviz-examples","tag-dataviz-weekly","tag-guest-post","tag-html5","tag-html5-charts","tag-infographics","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-library","tag-javascript-charts","tag-js-chart","tag-js-charting","tag-js-charts","tag-packed-circles","tag-statistics","tag-tips-and-tricks","tag-tutorial","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Circle Packing Chart | JavaScript Charting Tutorial (HTML5)<\/title>\n<meta name=\"description\" content=\"Circle packing charts use nested circles to visualize hierarchical data. Learn how to create these diagrams with JS and explore the top 100 billionaires!\" \/>\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\/2022\/09\/08\/circle-packing-chart\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Circle Packing Chart | JavaScript Charting Tutorial\" \/>\n<meta property=\"og:description\" content=\"Circle packing charts use nested circles to visualize hierarchical data. Learn how to quickly create them with JS &amp; see a cool example!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\" \/>\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=\"2022-09-08T13:50:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-08T16:33:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-social.png\" \/>\n<meta name=\"author\" content=\"Awan Shrestha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Circle Packing Chart | JavaScript Charting Tutorial\" \/>\n<meta name=\"twitter:description\" content=\"Circle packing charts use nested circles to visualize hierarchical data. Learn how to quickly create them with JS &amp; see a cool example!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-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=\"Awan Shrestha\" \/>\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\/2022\/09\/08\/circle-packing-chart\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\"},\"author\":{\"name\":\"Awan Shrestha\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"headline\":\"Creating Circle Packing Chart with JavaScript\",\"datePublished\":\"2022-09-08T13:50:40+00:00\",\"dateModified\":\"2022-09-08T16:33:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\"},\"wordCount\":1405,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png\",\"keywords\":[\"AnyChart\",\"best data visualization examples\",\"chart examples\",\"chart types\",\"charts\",\"circle packing\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"Data Visualization\",\"data visualization best practices\",\"data visualization examples\",\"data visualization practice\",\"data visualization tutorial\",\"data visualization weekly\",\"data visualizations\",\"data visuals\",\"data viz examples\",\"dataviz examples\",\"dataviz weekly\",\"guest post\",\"HTML5\",\"html5 charts\",\"infographics\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"JavaScript charting library\",\"javascript charts\",\"js chart\",\"js charting\",\"js charts\",\"packed circles\",\"statistics\",\"Tips and tricks\",\"tutorial\"],\"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\/2022\/09\/08\/circle-packing-chart\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\",\"name\":\"Circle Packing Chart | JavaScript Charting Tutorial (HTML5)\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png\",\"datePublished\":\"2022-09-08T13:50:40+00:00\",\"dateModified\":\"2022-09-08T16:33:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"description\":\"Circle packing charts use nested circles to visualize hierarchical data. Learn how to create these diagrams with JS and explore the top 100 billionaires!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating Circle Packing Chart with JavaScript\"}]},{\"@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\/3f107fdcb3fe326a63cd52812f5287c1\",\"name\":\"Awan Shrestha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/02ebd18c927547ca82372246dddcc3aebfa98928cb91405eef1a63ece7f17518?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/02ebd18c927547ca82372246dddcc3aebfa98928cb91405eef1a63ece7f17518?s=96&r=g\",\"caption\":\"Awan Shrestha\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/awan-shrestha\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Circle Packing Chart | JavaScript Charting Tutorial (HTML5)","description":"Circle packing charts use nested circles to visualize hierarchical data. Learn how to create these diagrams with JS and explore the top 100 billionaires!","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\/2022\/09\/08\/circle-packing-chart\/","og_locale":"en_US","og_type":"article","og_title":"Circle Packing Chart | JavaScript Charting Tutorial","og_description":"Circle packing charts use nested circles to visualize hierarchical data. Learn how to quickly create them with JS & see a cool example!","og_url":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2022-09-08T13:50:40+00:00","article_modified_time":"2022-09-08T16:33:22+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-social.png","type":"","width":"","height":""}],"author":"Awan Shrestha","twitter_card":"summary_large_image","twitter_title":"Circle Packing Chart | JavaScript Charting Tutorial","twitter_description":"Circle packing charts use nested circles to visualize hierarchical data. Learn how to quickly create them with JS & see a cool example!","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Awan Shrestha","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/"},"author":{"name":"Awan Shrestha","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"headline":"Creating Circle Packing Chart with JavaScript","datePublished":"2022-09-08T13:50:40+00:00","dateModified":"2022-09-08T16:33:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/"},"wordCount":1405,"commentCount":1,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png","keywords":["AnyChart","best data visualization examples","chart examples","chart types","charts","circle packing","data analysis","data analytics","data analytics examples","Data Visualization","data visualization best practices","data visualization examples","data visualization practice","data visualization tutorial","data visualization weekly","data visualizations","data visuals","data viz examples","dataviz examples","dataviz weekly","guest post","HTML5","html5 charts","infographics","JavaScript","javascript chart tutorial","javascript charting","JavaScript charting library","javascript charts","js chart","js charting","js charts","packed circles","statistics","Tips and tricks","tutorial"],"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\/2022\/09\/08\/circle-packing-chart\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/","url":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/","name":"Circle Packing Chart | JavaScript Charting Tutorial (HTML5)","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png","datePublished":"2022-09-08T13:50:40+00:00","dateModified":"2022-09-08T16:33:22+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"description":"Circle packing charts use nested circles to visualize hierarchical data. Learn how to create these diagrams with JS and explore the top 100 billionaires!","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2022\/09\/circle-packing-chart.png","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2022\/09\/08\/circle-packing-chart\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Creating Circle Packing Chart with JavaScript"}]},{"@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\/3f107fdcb3fe326a63cd52812f5287c1","name":"Awan Shrestha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/02ebd18c927547ca82372246dddcc3aebfa98928cb91405eef1a63ece7f17518?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/02ebd18c927547ca82372246dddcc3aebfa98928cb91405eef1a63ece7f17518?s=96&r=g","caption":"Awan Shrestha"},"url":"https:\/\/www.anychart.com\/blog\/author\/awan-shrestha\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/15629","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\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=15629"}],"version-history":[{"count":22,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/15629\/revisions"}],"predecessor-version":[{"id":15655,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/15629\/revisions\/15655"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=15629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=15629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=15629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}