{"id":16766,"date":"2023-08-01T12:35:26","date_gmt":"2023-08-01T12:35:26","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=16766"},"modified":"2023-08-10T11:29:29","modified_gmt":"2023-08-10T11:29:29","slug":"bubble-chart-js","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/","title":{"rendered":"Building Bubble Chart with JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png\" alt=\"Bubble Chart in JavaScript\" width=\"100%\" class=\"alignnone size-full wp-image-16772\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png 1600w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-300x169.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-768x432.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-1024x576.png 1024w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/a>Do you want to turn that data chaos into a comprehensible data show? Look no further than <a href=\"https:\/\/www.anychart.com\/blog\/2018\/11\/20\/data-visualization-definition-history-examples\/\">data visualization<\/a>! And let me tell you, one chart to rule them all is the <strong>bubble chart<\/strong>. It&#39;s like blowing bubbles at your data and watching them pop into understanding! And the best part? With JavaScript, you can easily create an interactive bubble chart, and I will show you how!<\/p>\n<p>Bubble charts are versatile data visualizations that display data points in the form of bubbles, where the bubbles&#39; size, color, and position represent different variables. In this tutorial, I&#39;ll walk you through building these graphics step by step, making the process a breeze. For illustration, we&#39;ll take data on the popularity of various YouTube videos and use JavaScript to create an interactive bubble chart showcasing the <strong>top 30 most-liked videos<\/strong> of all time, categorized by year of release, views, and likes.<\/p>\n<p>By the end of this tutorial, you&#39;ll be able to create visually-stunning JS-based bubble charts without any hassle. So let&#39;s dive into the world of data bubbles and turn numbers into a visual feast for the eyes!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2 id=\"bubble-chart-that-will-be-created\">Bubble Chart That Will Be Created<\/h2>\n<p>Take a quick look at the JS bubble chart we will build together in this tutorial, and follow along!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-8.png\" alt=\"JS Bubble Chart Example Preview\" width=\"100%\" class=\"alignnone size-full wp-image-16774\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-8.png 1243w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-8-300x156.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-8-768x400.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-8-1024x533.png 1024w\" sizes=\"(max-width: 1243px) 100vw, 1243px\" \/><\/p>\n<h2 id=\"a-creating-a-basic-js-bubble-chart\">A. Creating a Basic JS Bubble Chart<\/h2>\n<p>Don&#39;t be intimidated if you&#39;re new to creating JS charts \u2014 it&#39;s easier than you might think! In fact, all you need to do is follow these four steps to make it happen:<\/p>\n<ol>\n<li>Create a web page in HTML.<\/li>\n<li>Include the required JavaScript files.<\/li>\n<li>Add the data.<\/li>\n<li>Write some JS charting code.<\/li>\n<\/ol>\n<h3 id=\"1-create-a-web-page-in-html\">1. Create a web page in HTML<\/h3>\n<p>The first step is a breeze \u2014 just create a basic HTML web page! From there, we&#39;ll add a <code>&lt;div&gt;<\/code> element and give it a unique ID like &quot;container\u201d to create the space for the bubble chart. To ensure that the graph takes up the entire page, we\u2019ll use CSS code within the <code>&lt;style&gt;<\/code> tag to set the width and height to 100%; of course, this can be completely customized to fit your exact needs and preferences.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Bubble Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">      \r\n   <span class=\"hljs-selector-tag\">html<\/span>, <span class=\"hljs-selector-tag\">body<\/span>, <span class=\"hljs-selector-id\">#container<\/span> {\r\n     <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n     <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n     <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n     <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n   }\r\n <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h3 id=\"2-include-the-required-javascript-files\">2. Include the required JavaScript files<\/h3>\n<p>After setting up a basic HTML page, the next step is to include the necessary JavaScript files in the <code>&lt;head&gt;<\/code> section. There are numerous charting libraries available. In this tutorial, we&#39;ll be using <a href=\"https:\/\/www.anychart.com\/\">AnyChart<\/a>. This library supports bubble charts and offers comprehensive documentation. But no matter which library you choose, the basic steps for creating a chart are similar.<\/p>\n<p>To create a bubble chart, we\u2019ll use the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#base\" target=\"_blank\" rel=\"nofollow\">Base<\/a> module. The data will be in a JSON file, so we\u2019ll need the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#data_adapter\" target=\"_blank\" rel=\"nofollow\">Data Adapter<\/a> module to load it.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Bubble Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-base.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-data-adapter.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">      \r\n      <span class=\"hljs-selector-tag\">html<\/span>, <span class=\"hljs-selector-tag\">body<\/span>, <span class=\"hljs-selector-id\">#container<\/span> {\r\n        <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n        <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      }\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n      <span class=\"hljs-comment\">\/\/ All the code for the bubble chart will come here.<\/span>\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h3 id=\"3-add-the-data\">3. Add the data<\/h3>\n<p>I compiled the data about the top 30 most liked YouTube videos from <a href=\"https:\/\/app.buzzguru.com\/youtube\/top\/100-most-liked-videos\" target=\"_blank\" rel=\"nofollow\">BuzzGuru<\/a> and <a href=\"https:\/\/www.youtube.com\/\" target=\"_blank\" rel=\"nofollow\">YouTube<\/a> and saved it in a JSON file, which you can find <a href=\"https:\/\/gist.githubusercontent.com\/awanshrestha\/8df51b9b1c44b2d1bd3ebeb0757b5fb0\/raw\/28ee08902d393e02278a7ef7e3461b33e34c6c90\/Top-liked-YouTube-Videos.json\" target=\"_blank\" rel=\"nofollow\">here<\/a>.<\/p>\n<p>Each object in the dataset represents a YouTube video and is to be visualized as a single bubble. The objects have five properties: &quot;x&quot; for the year of upload to YouTube, &quot;value&quot; for the number of YouTube views, &quot;size&quot; for the number of YouTube likes, as well as &quot;title&quot; and &quot;genre&quot;.<\/p>\n<p>To load the data into a bubble plot, we\u2019ll use the <code>anychart.data.loadJsonFile()<\/code> function.<\/p>\n<pre><code class=\"lang-javascript\">anychart.data.loadJsonFile(<span class=\"hljs-string\">\"https:\/\/gist.githubusercontent.com\/awanshrestha\/8df51b9b1c44b2d1bd3ebeb0757b5fb0\/raw\/28ee08902d393e02278a7ef7e3461b33e34c6c90\/Top-liked-YouTube-Videos.json\"<\/span>,\r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">(data)<\/span> <\/span>{});\r\n<\/code><\/pre>\n<p>You will find out where to put this code in a few moments.<\/p>\n<h3 id=\"4-write-some-js-charting-code\">4. Write some JS charting code<\/h3>\n<p>It\u2019s time for a few lines of JavaScript code that will construct the visualization!<\/p>\n<p>To begin, wrap the code in an <code>anychart.onDocumentReady()<\/code> function ensuring that it only executes once the page is fully loaded.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n  anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\r\n    <span class=\"hljs-comment\">\/\/ The bubble chart data and code will be in this section.<\/span>\r\n  });\r\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<p>Add the data from Step 3.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n  anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\r\n    anychart.data.loadJsonFile(<span class=\"hljs-string\">\"https:\/\/gist.githubusercontent.com\/awanshrestha\/8df51b9b1c44b2d1bd3ebeb0757b5fb0\/raw\/28ee08902d393e02278a7ef7e3461b33e34c6c90\/Top-liked-YouTube-Videos.json\"<\/span>,\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">(data)<\/span> <\/span>{\r\n      <span class=\"hljs-comment\">\/\/ The upcoming JS code will be here.<\/span>\r\n    });\r\n  });\r\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<p>Pass the data to the <code>anychart.bubble()<\/code> function to create a bubble chart object.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-attribute\">chart<\/span> = anychart.bubble(data)<span class=\"hljs-comment\">;<\/span>\r\n<\/code><\/pre>\n<p>It&#39;s possible to set the minimum and maximum bubble sizes using the <code>minBubblesize()<\/code> and <code>maxBubblesize()<\/code> functions respectively. <\/p>\n<pre><code class=\"lang-javascript\">chart.minBubbleSize(<span class=\"hljs-string\">\"3%\"<\/span>)<span class=\"hljs-comment\">;<\/span>\r\nchart.maxBubbleSize(<span class=\"hljs-string\">\"12%\"<\/span>)<span class=\"hljs-comment\">;<\/span>\r\n<\/code><\/pre>\n<p>Finally, let\u2019s give the bubble chart a title and insert it into the designated <code>&lt;div&gt;<\/code> container. Once this is done, we can use the <code>draw()<\/code> function to render the visualization on the web page.<\/p>\n<pre><code class=\"lang-javascript\">chart.title(<span class=\"hljs-string\">\"Top 30 Most Liked YouTube Videos\"<\/span>)<span class=\"hljs-comment\">;<\/span>\r\nchart.container(<span class=\"hljs-string\">\"container\"<\/span>)<span class=\"hljs-comment\">;<\/span>\r\nchart.draw()<span class=\"hljs-comment\">;<\/span>\r\n<\/code><\/pre>\n<p>It&#39;s here! Our first JavaScript bubble chart is ready. Its interactive version with the full code can be found on <a href=\"https:\/\/playground.anychart.com\/EzsEZceM\" target=\"_blank\" rel=\"nofollow\">Playground<\/a>. The code is also provided below for your convenience.<\/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-EzsEZceM\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/EzsEZceM\/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-EzsEZceM{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Bubble Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-base.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-data-adapter.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">      \r\n      <span class=\"hljs-selector-tag\">html<\/span>, <span class=\"hljs-selector-tag\">body<\/span>, <span class=\"hljs-selector-id\">#container<\/span> {\r\n        <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n        <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      }\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n      anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">()<\/span> <\/span>{\r\n        <span class=\"hljs-comment\">\/\/ load data<\/span>\r\n        anychart.data.loadJsonFile(<span class=\"hljs-string\">\"https:\/\/gist.githubusercontent.com\/awanshrestha\/8df51b9b1c44b2d1bd3ebeb0757b5fb0\/raw\/28ee08902d393e02278a7ef7e3461b33e34c6c90\/Top-liked-YouTube-Videos.json\"<\/span>,\r\n        <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">(data)<\/span> <\/span>{\r\n          <span class=\"hljs-comment\">\/\/ create a bubble chart    <\/span>\r\n          chart =  anychart.bubble(data);   \r\n          <span class=\"hljs-comment\">\/\/ set the minimum and maximum bubble sizes<\/span>\r\n          chart.minBubbleSize(<span class=\"hljs-string\">\"3%\"<\/span>);\r\n          chart.maxBubbleSize(<span class=\"hljs-string\">\"12%\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ add a chart title<\/span>\r\n          chart.title(<span class=\"hljs-string\">\"Top 30 Most Liked YouTube Videos\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ set the container<\/span>\r\n          chart.container(<span class=\"hljs-string\">\"container\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ initiate the chart drawing<\/span>\r\n          chart.draw();\r\n        })\r\n      });\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h2 id=\"b-customizing-js-bubble-chart\">B. Customizing JS Bubble Chart<\/h2>\n<p>Let&#39;s take our JavaScript bubble chart to the next level by adding some exciting customizations that will make it look even more visually appealing! We can transform our chart from good to great with just a few tweaks. Let\u2019s do it!<\/p>\n<h3 id=\"1-name-the-axes\">1. Name the axes<\/h3>\n<p>First, we&#39;ll make it all easier to understand by adding titles to the X and Y axes.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.xAxis<\/span>()<span class=\"hljs-selector-class\">.title<\/span>(<span class=\"hljs-string\">\"Year\"<\/span>);\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.yAxis<\/span>()<span class=\"hljs-selector-class\">.title<\/span>(<span class=\"hljs-string\">\"Views\"<\/span>);\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-XTS9VsHZ\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/XTS9VsHZ\/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-XTS9VsHZ{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"2-arrange-the-ticks\">2. Arrange the ticks<\/h3>\n<p>Next, we&#39;ll set custom intervals for the tick marks.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.xScale<\/span>()<span class=\"hljs-selector-class\">.ticks<\/span>()<span class=\"hljs-selector-class\">.interval<\/span>(2);\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.yScale<\/span>()<span class=\"hljs-selector-class\">.ticks<\/span>()<span class=\"hljs-selector-class\">.interval<\/span>(2000000000);\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-TulgNJ17\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/TulgNJ17\/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-TulgNJ17{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"3-enable-the-grid\">3. Enable the grid<\/h3>\n<p>We&#39;ll add the grid to further enhance the bubble chart&#39;s appearance and functionality. By enabling major and minor gridlines for both axes, we&#39;ll make it easier to visually interpret the data displayed on the bubble chart.<\/p>\n<pre><code class=\"lang-javascript\">chart.yGrid(<span class=\"hljs-literal\">true<\/span>).xGrid(<span class=\"hljs-literal\">true<\/span>).xMinorGrid(<span class=\"hljs-literal\">true<\/span>).yMinorGrid(<span class=\"hljs-literal\">true<\/span>);\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-t8sGODkS\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/t8sGODkS\/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-t8sGODkS{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"4-paint-the-bubbles-by-genre\">4. Paint the bubbles by genre<\/h3>\n<p>To make our bubble chart really pop, we can generate a visual distinction between the videos of different genres using coloring.<\/p>\n<p>First, we&#39;ll separate the data into different series based on genre using the JavaScript <code>filter()<\/code> method. This chart categorizes the videos into four groups: Shorts, Music, Comedy, and Children.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-keyword\">var<\/span> videos_shorts = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n  <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Shorts\"<\/span>;\r\n});\r\n<span class=\"hljs-keyword\">var<\/span> videos_music= data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n  <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Music\"<\/span>;\r\n});\r\n<span class=\"hljs-keyword\">var<\/span> videos_comedy = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n  <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Comedy\"<\/span>;\r\n});\r\n<span class=\"hljs-keyword\">var<\/span> videos_children = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n  <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Children\"<\/span>;\r\n});\r\n<\/code><\/pre>\n<p>Next, we&#39;ll use the <code>normal()<\/code>, <code>hovered()<\/code>, and <code>selected()<\/code> methods to configure the appearance of these series in different states. With the <code>fill()<\/code> method, we can set the colors of the bubbles themselves, while the <code>stroke()<\/code> method controls their outlines.<\/p>\n<p>Unique colors are specified for the different categories of videos. Feel free to add your own choice of colors, and make the chart vibrant.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-comment\">\/\/ series 1<\/span>\r\nvar series1 = chart.bubble(videos_children).name(<span class=\"hljs-string\">\"Children\"<\/span>);\r\nseries1.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#A0EA63\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\nseries1.hovered().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#A0EA63\"<\/span>, <span class=\"hljs-number\">0.7<\/span>);\r\nseries1.selected().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#9EE57C\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\nseries1.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\nseries1.hovered().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\nseries1.selected().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">4<\/span>);\r\n\r\n<span class=\"hljs-comment\">\/\/ series 2<\/span>\r\nvar series2 = chart.bubble(videos_shorts).name(<span class=\"hljs-string\">\"Shorts\"<\/span>);\r\nseries2.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\nseries2.hovered().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">0.8<\/span>);\r\nseries2.selected().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\nseries2.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\nseries2.hovered().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\nseries2.selected().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">4<\/span>);\r\n\r\n<span class=\"hljs-comment\">\/\/ series 3<\/span>\r\nvar series3 = chart.bubble(videos_comedy).name(<span class=\"hljs-string\">\"Comedy\"<\/span>);\r\nseries3.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.5<\/span>);\r\nseries3.hovered().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\nseries3.selected().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\nseries3.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\nseries3.hovered().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\nseries3.selected().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n\r\n<span class=\"hljs-comment\">\/\/ series 4<\/span>\r\nvar series4 = chart.bubble(videos_music).name(<span class=\"hljs-string\">\"Music\"<\/span>);\r\nseries4.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#87C4F6\"<\/span>, <span class=\"hljs-number\">0.85<\/span>);\r\nseries4.hovered().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#87C4F6\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\nseries4.selected().<span class=\"hljs-built_in\">fill<\/span>(<span class=\"hljs-string\">\"#55A0E5\"<\/span>, <span class=\"hljs-number\">0.98<\/span>);\r\nseries4.<span class=\"hljs-built_in\">normal<\/span>().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\nseries4.hovered().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\nseries4.selected().<span class=\"hljs-built_in\">stroke<\/span>(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">4<\/span>);\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-v5f4qvyO\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/v5f4qvyO\/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-v5f4qvyO{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"5-prevent-clipping\">5. Prevent clipping<\/h3>\n<p>Let\u2019s also add a few lines of code to prevent any clipping of the bubbles, ensuring the chart looks as beautiful as possible. By setting the <code>clip()<\/code> function parameter to &quot;false&quot; for each data series, we provide that every bubble is fully visible and accounted for.<\/p>\n<pre><code>series1.clip(false)<span class=\"hljs-comment\">;<\/span>\r\nseries2.clip(false)<span class=\"hljs-comment\">;<\/span>\r\nseries3.clip(false)<span class=\"hljs-comment\">;<\/span>\r\nseries4.clip(false)<span class=\"hljs-comment\">;<\/span>\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-v5f4qvyO\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/WbFPHEYU\/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-v5f4qvyO{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"6-add-the-legend\">6. Add the legend<\/h3>\n<p>Adding a legend is a great idea, as it will help quickly realize which color means what. In addition to that, let\u2019s set the padding to 12 pixels for both the top and bottom of the bubble chart legend.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.legend<\/span>(<span class=\"hljs-selector-tag\">true<\/span>)<span class=\"hljs-selector-class\">.padding<\/span>({<span class=\"hljs-attribute\">bottom<\/span>: <span class=\"hljs-number\">12<\/span>, top: <span class=\"hljs-number\">12<\/span>});\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-WbFPHEYU\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/px02pO2O\/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-WbFPHEYU{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"7-enhance-the-tooltip\">7. Enhance the tooltip<\/h3>\n<p>The tooltip format can be customized to display any relevant data that helps better understand the bubble chart presentation.<\/p>\n<p>First, we\u2019ll create a tooltip variable and assign it to the chart&#39;s tooltip. After this, we\u2019ll format the tooltip title using the <code>titleFormat()<\/code> function. Next, we\u2019ll use the <code>format()<\/code> function to make the tooltip display the year, views, likes, and genre of the data point.<\/p>\n<pre><code class=\"lang-javascript\">var tooltip = chart.tooltip();\r\ntooltip.titleFormat(<span class=\"hljs-string\">\"Title: {%title}\"<\/span>);\r\ntooltip.format(<span class=\"hljs-string\">\"Year: {%x} \\nViews: {%value} \\nLikes: {%size} \\nGenre: {%genre}\"<\/span>);\r\n<\/code><\/pre>\n<p>Below is the final version of our JavaScript bubble chart that I am extremely satisfied with. The interactive visualization with its complete source code is available on <a href=\"https:\/\/playground.anychart.com\/3ZVQ31AQ\" target=\"_blank\" rel=\"nofollow\">Playground<\/a>, allowing you to modify colors, interactivity, and other elements according to your preferences. For your convenience, I have included the entire code of this bubble chart below.<\/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-3ZVQ31AQ\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/3ZVQ31AQ\/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-3ZVQ31AQ{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Bubble Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-base.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-data-adapter.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">      \r\n      <span class=\"hljs-selector-tag\">html<\/span>, <span class=\"hljs-selector-tag\">body<\/span>, <span class=\"hljs-selector-id\">#container<\/span> {\r\n        <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n        <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n        <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      }\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n      anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">()<\/span> <\/span>{\r\n        <span class=\"hljs-comment\">\/\/ load data<\/span>\r\n        anychart.data.loadJsonFile(<span class=\"hljs-string\">\"https:\/\/gist.githubusercontent.com\/awanshrestha\/8df51b9b1c44b2d1bd3ebeb0757b5fb0\/raw\/28ee08902d393e02278a7ef7e3461b33e34c6c90\/Top-liked-YouTube-Videos.json\"<\/span>,\r\n        <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">(data)<\/span> <\/span>{\r\n          <span class=\"hljs-comment\">\/\/ create a bubble chart    <\/span>\r\n          chart = anychart.bubble();\r\n          <span class=\"hljs-comment\">\/\/ set the minimum and maximum bubble sizes<\/span>\r\n          chart.minBubbleSize(<span class=\"hljs-string\">\"3%\"<\/span>);\r\n          chart.maxBubbleSize(<span class=\"hljs-string\">\"12%\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ name the axes<\/span>\r\n          chart.xAxis().title(<span class=\"hljs-string\">\"Year\"<\/span>);\r\n          chart.yAxis().title(<span class=\"hljs-string\">\"Views\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ set the intervals between the ticks<\/span>\r\n          chart.xScale().ticks().interval(<span class=\"hljs-number\">2<\/span>);\r\n          chart.yScale().ticks().interval(<span class=\"hljs-number\">2000000000<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ enable the grid<\/span>\r\n          chart.yGrid(<span class=\"hljs-literal\">true<\/span>).xGrid(<span class=\"hljs-literal\">true<\/span>).xMinorGrid(<span class=\"hljs-literal\">true<\/span>).yMinorGrid(<span class=\"hljs-literal\">true<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ separate the data into different series based on genre<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> videos_shorts = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n            <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Shorts\"<\/span>;\r\n          });\r\n          <span class=\"hljs-keyword\">var<\/span> videos_music= data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n            <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Music\"<\/span>;\r\n          });\r\n          <span class=\"hljs-keyword\">var<\/span> videos_comedy = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n            <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Comedy\"<\/span>;\r\n          });\r\n          <span class=\"hljs-keyword\">var<\/span> videos_children = data.filter(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span><span class=\"hljs-params\">(entry)<\/span> <\/span>{\r\n            <span class=\"hljs-keyword\">return<\/span> entry.genre === <span class=\"hljs-string\">\"Children\"<\/span>;\r\n          });\r\n          <span class=\"hljs-comment\">\/\/ customize the appearance of each series<\/span>\r\n          <span class=\"hljs-comment\">\/\/ series 1<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> series1 = chart.bubble(videos_children).name(<span class=\"hljs-string\">\"Children\"<\/span>);\r\n          series1.normal().fill(<span class=\"hljs-string\">\"#A0EA63\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\n          series1.hovered().fill(<span class=\"hljs-string\">\"#A0EA63\"<\/span>, <span class=\"hljs-number\">0.7<\/span>);\r\n          series1.selected().fill(<span class=\"hljs-string\">\"#9EE57C\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\n          series1.normal().stroke(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n          series1.hovered().stroke(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n          series1.selected().stroke(<span class=\"hljs-string\">\"#41a312\"<\/span>, <span class=\"hljs-number\">4<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ series 2<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> series2 = chart.bubble(videos_shorts).name(<span class=\"hljs-string\">\"Shorts\"<\/span>);\r\n          series2.normal().fill(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n          series2.hovered().fill(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">0.8<\/span>);\r\n          series2.selected().fill(<span class=\"hljs-string\">\"#FFFF00\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\n          series2.normal().stroke(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n          series2.hovered().stroke(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n          series2.selected().stroke(<span class=\"hljs-string\">\"#FFC000\"<\/span>, <span class=\"hljs-number\">4<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ series 3<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> series3 = chart.bubble(videos_comedy).name(<span class=\"hljs-string\">\"Comedy\"<\/span>);\r\n          series3.normal().fill(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.5<\/span>);\r\n          series3.hovered().fill(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\n          series3.selected().fill(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">0.3<\/span>);\r\n          series3.normal().stroke(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n          series3.hovered().stroke(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n          series3.selected().stroke(<span class=\"hljs-string\">\"#DE3163\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ series 4<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> series4 = chart.bubble(videos_music).name(<span class=\"hljs-string\">\"Music\"<\/span>);\r\n          series4.normal().fill(<span class=\"hljs-string\">\"#87C4F6\"<\/span>, <span class=\"hljs-number\">0.85<\/span>);\r\n          series4.hovered().fill(<span class=\"hljs-string\">\"#87C4F6\"<\/span>, <span class=\"hljs-number\">0.9<\/span>);\r\n          series4.selected().fill(<span class=\"hljs-string\">\"#55A0E5\"<\/span>, <span class=\"hljs-number\">0.98<\/span>);\r\n          series4.normal().stroke(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">1<\/span>);\r\n          series4.hovered().stroke(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">2<\/span>);\r\n          series4.selected().stroke(<span class=\"hljs-string\">\"#1069c2\"<\/span>, <span class=\"hljs-number\">4<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ prevent the bubbles from clipping<\/span>\r\n          series1.clip(<span class=\"hljs-literal\">false<\/span>);\r\n          series2.clip(<span class=\"hljs-literal\">false<\/span>);\r\n          series3.clip(<span class=\"hljs-literal\">false<\/span>);\r\n          series4.clip(<span class=\"hljs-literal\">false<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ add the legend  <\/span>\r\n          chart.legend(<span class=\"hljs-literal\">true<\/span>).padding({bottom: <span class=\"hljs-number\">12<\/span> , top: <span class=\"hljs-number\">12<\/span>});\r\n          <span class=\"hljs-comment\">\/\/ configure the tooltip<\/span>\r\n          <span class=\"hljs-keyword\">var<\/span> tooltip = chart.tooltip();\r\n          tooltip.titleFormat(<span class=\"hljs-string\">\"Title: {%title}\"<\/span>);\r\n          tooltip.format(<span class=\"hljs-string\">\"Year: {%x} \\nViews: {%value} \\nLikes: {%size} \\nGenre: {%genre}\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ add a chart title<\/span>\r\n          chart.title(<span class=\"hljs-string\">\"Top 30 Most Liked YouTube Videos\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ set the container<\/span>\r\n          chart.container(<span class=\"hljs-string\">\"container\"<\/span>);\r\n          <span class=\"hljs-comment\">\/\/ initiate the chart drawing<\/span>\r\n          chart.draw();\r\n        })\r\n      });\r\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>We have successfully generated a JavaScript-based (HTML5) bubble chart that presents the 30 most popular YouTube videos based on their number of likes. To help you create your data visualizations using this technique, I have provided a step-by-step tutorial that outlines each individual action taken to produce this chart. Simply follow these instructions, and you will be able to create interactive bubble charts that effectively represent your own data.<\/p>\n<p>If you have any queries regarding the process or the bubble chart as such, please feel free to ask me in the comments section. I would be delighted to clarify any doubts you may have. Moreover, I would love to see the bubble plots you produce using this guide. Feel free to show me what you&#39;ve created!<\/p>\n<hr \/>\n<p><strong><em>Published with the permission of Awan Shrestha. Originally appeared on <a href=\"https:\/\/www.codementor.io\/@awanshrestha\/creating-a-bubble-chart-with-javascript-274sh6uogv\" target=\"_blank\" rel=\"nofollow\">Codementor<\/a> with the title &#8220;Creating a Bubble Chart with JavaScript&#8221; on July 31, 2023.<\/p>\n<p>You&#8217;re more than welcome to check out the <a href=\"https:\/\/www.anychart.com\/blog\/2021\/02\/16\/pareto-chart-javascript\/\">JavaScript Bubble Chart Tutorial<\/a> by Wayde Herman originally published on our blog earlier.<\/p>\n<p>See other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a> to continue mastering interactive data visualization.<\/p>\n<p>Would you like to write some nice guest post? <a href=\"https:\/\/www.anychart.com\/support\/\">Let us know<\/a>.<\/strong><\/em><\/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>Do you want to turn that data chaos into a comprehensible data show? Look no further than data visualization! And let me tell you, one chart to rule them all is the bubble chart. It&#39;s like blowing bubbles at your data and watching them pop into understanding! And the best part? With JavaScript, you can [&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,263,8,23,13,279,4],"tags":[843,619,618,53,260,63,2730,254,284,166,258,471,266,620,1292,880,806,3352,509,2220,2838,461,1389,1760,2757,256,3377,1111,350,844,165,313,1370,133,774,775,1498,95,1762,2013,2014,32,55,1335,144,2979,2016,167,146,433,152,2949,151,36,907,141,249,81,57,169,170,1238,142,96,99,3586,58,65,56,101,3526,1937,2335,1938,1228,669,3099,172,1387,807,808,3100,1939,3494,2015,2816,1763,804,3406,3407,2400,2413,2414],"class_list":["post-16766","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-advanced-data-visualization","tag-analysis","tag-analytics","tag-anychart","tag-best-data-visualization-examples","tag-bubble-chart","tag-bubble-diagram","tag-chart","tag-chart-examples","tag-charting","tag-charts","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-chart","tag-data-charting","tag-data-charts","tag-data-graphic","tag-data-graphics","tag-data-visual","tag-data-visualisation","tag-data-visualization-101","tag-data-visualization-best-pracices","tag-data-visualization-design","tag-data-visualization-development","tag-data-visualization-examples","tag-data-visualization-guide","tag-data-visualization-practice","tag-data-visualization-projects","tag-data-visualization-tutorial","tag-data-visualizations","tag-data-visuals","tag-data-viz-examples","tag-dataviz","tag-dataviz-examples","tag-dataviz-projects","tag-example","tag-graphics-library","tag-guest-post","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographic","tag-infographics","tag-information-graphics","tag-information-visualization","tag-interactive-charts","tag-interactive-data-visualization","tag-interactive-graphics","tag-interactive-infographic","tag-interactive-infographics","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-drawing","tag-javascript-drawing-library","tag-javascript-graph","tag-javascript-graphics","tag-javascript-graphics-library","tag-javascript-library","tag-js","tag-js-chart","tag-js-charting","tag-js-charts","tag-js-graphics","tag-js-library","tag-json","tag-json-charts","tag-json-data-visualization","tag-movie-data","tag-movies","tag-storytelling-examples","tag-tutorial","tag-video","tag-visual-analysis","tag-visual-analytics","tag-visual-storytelling-examples","tag-visualizing-json-data","tag-web-chart","tag-web-charts","tag-web-design","tag-web-developers","tag-web-development","tag-website","tag-website-development","tag-youtube","tag-youtube-data","tag-youtube-data-visualization","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bubble Chart: How to Build This Data Viz Using JavaScript<\/title>\n<meta name=\"description\" content=\"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.\" \/>\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\/2023\/08\/01\/bubble-chart-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build a Bubble Chart Using JavaScript\" \/>\n<meta property=\"og:description\" content=\"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\" \/>\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=\"2023-08-01T12:35:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-10T11:29:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-soc.png\" \/>\n<meta name=\"author\" content=\"Awan Shrestha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Build a Bubble Chart Using JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-soc.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\/2023\/08\/01\/bubble-chart-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\"},\"author\":{\"name\":\"Awan Shrestha\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"headline\":\"Building Bubble Chart with JavaScript\",\"datePublished\":\"2023-08-01T12:35:26+00:00\",\"dateModified\":\"2023-08-10T11:29:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\"},\"wordCount\":1357,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png\",\"keywords\":[\"advanced data visualization\",\"analysis\",\"analytics\",\"AnyChart\",\"best data visualization examples\",\"bubble chart\",\"bubble diagram\",\"chart\",\"chart examples\",\"charting\",\"charts\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data chart\",\"data charting\",\"data charts\",\"data graphic\",\"data graphics\",\"data visual\",\"data visualisation\",\"data visualization 101\",\"data visualization best practices\",\"data visualization design\",\"data visualization development\",\"data visualization examples\",\"data visualization guide\",\"data visualization practice\",\"data visualization projects\",\"data visualization tutorial\",\"data visualizations\",\"data visuals\",\"data viz examples\",\"dataviz\",\"dataviz examples\",\"dataviz projects\",\"example\",\"graphics library\",\"guest post\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographic\",\"infographics\",\"information graphics\",\"information visualization\",\"interactive charts\",\"interactive data visualization\",\"interactive graphics\",\"interactive infographic\",\"interactive infographics\",\"interactive visualizations\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting library\",\"javascript charts\",\"javascript drawing\",\"javascript drawing library\",\"javascript graph\",\"javascript graphics\",\"JavaScript graphics library\",\"JavaScript library\",\"js\",\"js chart\",\"js charting\",\"js charts\",\"JS graphics\",\"js library\",\"JSON\",\"JSON charts\",\"JSON data visualization\",\"movie data\",\"movies\",\"storytelling examples\",\"tutorial\",\"video\",\"visual analysis\",\"visual analytics\",\"visual storytelling examples\",\"visualizing JSON data\",\"web chart\",\"web charts\",\"web design\",\"web developers\",\"web development\",\"website\",\"website development\",\"YouTube\",\"YouTube data\",\"YouTube data visualization\"],\"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\/2023\/08\/01\/bubble-chart-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\",\"name\":\"Bubble Chart: How to Build This Data Viz Using JavaScript\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png\",\"datePublished\":\"2023-08-01T12:35:26+00:00\",\"dateModified\":\"2023-08-10T11:29:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"description\":\"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png\",\"width\":1600,\"height\":900},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Bubble 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":"Bubble Chart: How to Build This Data Viz Using JavaScript","description":"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.","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\/2023\/08\/01\/bubble-chart-js\/","og_locale":"en_US","og_type":"article","og_title":"How to Build a Bubble Chart Using JavaScript","og_description":"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.","og_url":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2023-08-01T12:35:26+00:00","article_modified_time":"2023-08-10T11:29:29+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-soc.png","type":"","width":"","height":""}],"author":"Awan Shrestha","twitter_card":"summary_large_image","twitter_title":"How to Build a Bubble Chart Using JavaScript","twitter_description":"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js-soc.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\/2023\/08\/01\/bubble-chart-js\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/"},"author":{"name":"Awan Shrestha","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"headline":"Building Bubble Chart with JavaScript","datePublished":"2023-08-01T12:35:26+00:00","dateModified":"2023-08-10T11:29:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/"},"wordCount":1357,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png","keywords":["advanced data visualization","analysis","analytics","AnyChart","best data visualization examples","bubble chart","bubble diagram","chart","chart examples","charting","charts","data analysis","data analytics","data analytics examples","data chart","data charting","data charts","data graphic","data graphics","data visual","data visualisation","data visualization 101","data visualization best practices","data visualization design","data visualization development","data visualization examples","data visualization guide","data visualization practice","data visualization projects","data visualization tutorial","data visualizations","data visuals","data viz examples","dataviz","dataviz examples","dataviz projects","example","graphics library","guest post","HTML","HTML charts","HTML5","html5 charts","infographic","infographics","information graphics","information visualization","interactive charts","interactive data visualization","interactive graphics","interactive infographic","interactive infographics","interactive visualizations","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting library","javascript charts","javascript drawing","javascript drawing library","javascript graph","javascript graphics","JavaScript graphics library","JavaScript library","js","js chart","js charting","js charts","JS graphics","js library","JSON","JSON charts","JSON data visualization","movie data","movies","storytelling examples","tutorial","video","visual analysis","visual analytics","visual storytelling examples","visualizing JSON data","web chart","web charts","web design","web developers","web development","website","website development","YouTube","YouTube data","YouTube data visualization"],"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\/2023\/08\/01\/bubble-chart-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/","url":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/","name":"Bubble Chart: How to Build This Data Viz Using JavaScript","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png","datePublished":"2023-08-01T12:35:26+00:00","dateModified":"2023-08-10T11:29:29+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"description":"Learn how to create cool JS-based interactive bubble charts. Follow this illustrative tutorial visualizing data for the top 30 most-liked YouTube videos.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/07\/bubble-chart-js.png","width":1600,"height":900},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2023\/08\/01\/bubble-chart-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Building Bubble 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\/16766","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=16766"}],"version-history":[{"count":14,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/16766\/revisions"}],"predecessor-version":[{"id":16790,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/16766\/revisions\/16790"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=16766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=16766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=16766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}