{"id":16938,"date":"2023-10-03T13:48:49","date_gmt":"2023-10-03T13:48:49","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=16938"},"modified":"2023-10-03T13:53:46","modified_gmt":"2023-10-03T13:53:46","slug":"nobel-tag-cloud-js","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/","title":{"rendered":"Nobel Laureates&#8217; Countries, or Making Tag Cloud with JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\"><img decoding=\"async\" class=\"alignnone size-full wp-image-16944\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png\" alt=\"Tag Cloud (Word Cloud) in JavaScript\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png 1366w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-300x169.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-768x432.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-1024x576.png 1024w\" sizes=\"(max-width: 1366px) 100vw, 1366px\" \/><\/a>The <a href=\"https:\/\/www.nobelprize.org\/prizes\/about\/prize-announcement-dates\/\" target=\"_blank\" rel=\"nofollow\">Nobel Prize 2023 announcements<\/a> are just around the corner, scheduled from October 2 to 9. Recently, I stumbled upon this news, sparking my interest in Nobel laureates and their countries of origin.<\/p>\n<p>This curiosity led me to the comprehensive list of Nobel Prize winners on <a href=\"https:\/\/www.britannica.com\/topic\/Nobel-Prize-Winners-by-Year-1856946\" target=\"_blank\" rel=\"nofollow\">Britannica<\/a>, which I transformed into an interactive tag cloud (or <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/tag-cloud-chart\/\">word cloud<\/a>) using JavaScript, providing an elegant means to explore and uncover the countries with the highest number of Nobel laureates throughout history.<\/p>\n<p>During this process, it dawned on me that this visualization could serve as an excellent illustrative example for a tutorial on creating interactive JS-based tag clouds. So, if you share my curiosity about Nobel laureates by country, you&#8217;re in for a treat right below! and if you&#8217;re eager to learn how I brought this tag cloud to life \u2014 and, therefore, how you can create your own \u2014 read on!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>Tag Cloud of Nobel Laureates by Country<\/h2>\n<p><a href=\"https:\/\/playground.anychart.com\/X5keoorJ\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" class=\"alignnone size-full wp-image-16948\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/10\/nobel-tag-cloud-2.png\" alt=\"Nobel Laureates by Country in a Tag Cloud\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/10\/nobel-tag-cloud-2.png 1202w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/10\/nobel-tag-cloud-2-300x160.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/10\/nobel-tag-cloud-2-768x410.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/10\/nobel-tag-cloud-2-1024x546.png 1024w\" sizes=\"(max-width: 1202px) 100vw, 1202px\" \/><\/a><\/p>\n<p>Explore the interactive version on <a href=\"https:\/\/codepen.io\/awanshrestha\/pen\/PoBgKKQ\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [or on <a href=\"https:\/\/playground.anychart.com\/X5keoorJ\" target=\"_blank\" rel=\"nofollow\">Playground<\/a>].<\/p>\n<h3>A. Creating a Basic JS Tag Cloud<\/h3>\n<p>At first, I coded a basic JavaScript tag cloud. If you have experience creating JS charts, you already have an understanding of how it works. But in case this is your first time, let\u2019s start with the basics. The process could be divided into four fundamental steps:<\/p>\n<ol>\n<li>Creating a web container<\/li>\n<li>Including JavaScript files<\/li>\n<li>Adding data<\/li>\n<li>Writing some JS charting code<\/li>\n<\/ol>\n<h3>1. Creating a Web Container<\/h3>\n<p>I built a basic web page in HTML. There, I added a <code>&lt;div&gt;<\/code> element and gave it a unique ID \u2014 it\u2019s the place for the tag cloud to be drawn. I wanted the chart to fill the entire page, so I added the appropriate CSS code using the <code>&lt;style&gt;<\/code> tag; of course, you can set that to your liking.<\/p>\n<pre><code>&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;JavaScript Tag Cloud&lt;\/title&gt;\r\n    &lt;style type=\"text\/css\"&gt;      \r\n      html, body, #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;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>2. Including JavaScript Files<\/h3>\n<p>Once I completed a basic HTML page layout, I included the necessary JavaScript files in the <code>&lt;head&gt;<\/code> section.<\/p>\n<p>There are many JavaScript charting libraries out there that can help visualize data with fewer efforts than would be needed otherwise. I opted for <a href=\"https:\/\/www.anychart.com\">AnyChart<\/a>, which supports tag clouds out of the box, provides detailed docs, and is free for not-for-profit use; anyway, it\u2019s just an example and the basics remain the same with other libraries.<\/p>\n<p>So, I added the required scripts.<\/p>\n<pre><code>&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;JavaScript Tag Cloud&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-tag-cloud.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;      \r\n      html, body, #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      \/\/ All the code for the tag cloud will come here.\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>3. Adding Data<\/h3>\n<p>For this tag cloud, I took data from <a href=\"https:\/\/www.britannica.com\/topic\/Nobel-Prize-Winners-by-Year-1856946\" target=\"_blank\" rel=\"nofollow\">Britannica<\/a>. Four people won the Nobel Prize several times: Frederick Sanger, Linus Pauling, John Bardeen, and Marie Curie; I counted them only once. Some laureates belong to two countries; I counted them for both.<\/p>\n<p>The data needed some modifications before I could feed it into the word cloud. I converted it into an array of objects with four properties:<\/p>\n<ul>\n<li><strong>x<\/strong> \u2014 for the name of the country<\/li>\n<li><strong>value<\/strong> \u2014 for the number of Nobel laureates from that country<\/li>\n<li><strong>category<\/strong> \u2014 for the continent<\/li>\n<li><strong>URL<\/strong> \u2014 containing a link to Wikipedia for further information. (Note: Some countries that existed in the early 20th century are now other countries; Britannica stores the original country names, which is not always the case on Wikipedia, so total counts by country are a little different.)<\/li>\n<\/ul>\n<pre><code>var data = [\r\n  { \"x\": \"Alsace\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n  { \"x\": \"Austria\", \"value\": 12, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n  { \"x\": \"Austria-Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n  { \"x\": \"Australia\", \"value\": 8, \"category\": \"Australia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Australia\"},\r\n  { \"x\": \"Argentina\", \"value\": 5, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Argentina\"},\r\n  { \"x\": \"Bangladesh\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bangladesh\"},\r\n  { \"x\": \"Belarus\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belarus\"},\r\n  { \"x\": \"Belgium\", \"value\": 9, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belgium\"},\r\n  { \"x\": \"Bulgaria\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bulgaria\"},\r\n  { \"x\": \"Canada\", \"value\": 15, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Canada\"},\r\n  { \"x\": \"Chile\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Chile\"},\r\n  { \"x\": \"China\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#China,_(People's_Republic_of_China)\"},\r\n  { \"x\": \"Colombia\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Colombia\"},\r\n  { \"x\": \"Costa Rica\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Costa_Rica\"},\r\n  { \"x\": \"Cyprus\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Cyprus\"},\r\n  { \"x\": \"Czechoslovakia\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Czech_Republic\"},\r\n  { \"x\": \"Democratic Republic of the Congo\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Congo,_Democratic_Republic\"},\r\n  { \"x\": \"Denmark\", \"value\": 13, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Denmark\"},\r\n  { \"x\": \"Egypt\", \"value\": 4, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Egypt\"},\r\n  { \"x\": \"Ethiopia\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ethiopia\"},\r\n  { \"x\": \"Finland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Finland\"},\r\n  { \"x\": \"France\", \"value\": 60, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#France\"},\r\n  { \"x\": \"Germany\", \"value\": 61, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n  { \"x\": \"Ghana\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ghana\"},\r\n  { \"x\": \"Greece\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Greece\"},\r\n  { \"x\": \"Guatemala\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Guatemala\"},\r\n  { \"x\": \"Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Hungary\"},\r\n  { \"x\": \"Iceland\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iceland\"},\r\n  { \"x\": \"India\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#India\"},\r\n  { \"x\": \"Iran\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iran\"},\r\n  { \"x\": \"Iraq\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iraq\"},\r\n  { \"x\": \"Ireland\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n  { \"x\": \"Israel\", \"value\": 13, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Israel\"},\r\n  { \"x\": \"Italy\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Italy\"},\r\n  { \"x\": \"Japan\", \"value\": 25, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Japan\"},\r\n  { \"x\": \"Kenya\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Kenya\"},\r\n  { \"x\": \"Liberia\", \"value\": 2, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Liberia\"},\r\n  { \"x\": \"Luxembourg\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Luxembourg\"},\r\n  { \"x\": \"Mexico\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Mexico\"},\r\n  { \"x\": \"Myanmar\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Myanmar\"},\r\n  { \"x\": \"Netherlands\", \"value\": 19, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Netherlands\"},\r\n  { \"x\": \"Nigeria\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Nigeria\"},\r\n  { \"x\": \"Norway\", \"value\": 11, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Norway\"},\r\n  { \"x\": \"Northern Ireland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n  { \"x\": \"Pakistan\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Pakistan\"},    \r\n  { \"x\": \"Peru\", \"value\": 1, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Peru\"},\r\n  { \"x\": \"Philippines\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Philippines\"},\r\n  { \"x\": \"Poland\", \"value\": 5, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Poland\"},\r\n  { \"x\": \"Portugal\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Portugal\"},\r\n  { \"x\": \"Russia\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n  { \"x\": \"Spain\", \"value\": 6, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Spain\"},\r\n  { \"x\": \"South Africa\", \"value\": 7, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Africa\"},\r\n  { \"x\": \"South Korea\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Korea\"},\r\n  { \"x\": \"St. Lucia\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Saint_Lucia\"},\r\n  { \"x\": \"Sweden\", \"value\": 34, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Sweden\"},\r\n  { \"x\": \"Switzerland\", \"value\": 24, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Switzerland\"},\r\n  { \"x\": \"Tanzania\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tanzania\"},\r\n  { \"x\": \"Tibet\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tibet\"},\r\n  { \"x\": \"Timorese\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#East_Timor\"},\r\n  { \"x\": \"Trinidad\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Trinidad_and_Tobago\"},\r\n  { \"x\": \"Turkey\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Turkey\"},\r\n  { \"x\": \"Ukraine\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ukraine\"},\r\n  { \"x\": \"United Kingdom\", \"value\": 119, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_Kingdom\"},\r\n  { \"x\": \"United States\", \"value\": 393, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_States\"},\r\n  { \"x\": \"U.S.S.R.\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n  { \"x\": \"Vietnam\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Vietnam\"},\r\n  { \"x\": \"West Germany\", \"value\": 23, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n  { \"x\": \"Yemen\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yemen\"},\r\n  { \"x\": \"Yugoslavia\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yugoslavia\"}\r\n];<\/code><\/pre>\n<p>Yup, that\u2019s a lot of countries!<\/p>\n<h3>4. Writing Some JS Charting Code<\/h3>\n<p>Finally, I added a few lines of JavaScript code to draw the tag cloud itself. It was fairly straightforward.<\/p>\n<p>I started writing the anychart.onDocumentReady() function.<\/p>\n<pre><code>&lt;script&gt;\r\n  anychart.onDocumentReady(function () {\r\n    \/\/ The tag cloud data and code will be in this section.\r\n  });\r\n&lt;\/script&gt;<\/code><\/pre>\n<p>Inside it, I added the data from the previous step, created a tag cloud instance, set the chart title, referenced the container element ID, and drew the resulting tag cloud.<\/p>\n<pre><code>anychart.onDocumentReady(function () {\r\n\r\n  \/\/ add data (copying from step 3)\r\n  ...\r\n\r\n  \/\/ create a tag cloud with the added data\r\n  var chart = anychart.tagCloud(data);\r\n\r\n  \/\/ set the chart title\r\n  chart.title(\"Nobel Laureates by Country\");\r\n\r\n  \/\/ set 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});<\/code><\/pre>\n<p>Here is how the initial tag cloud looked \u2014 the interactive version can be found on <a href=\"https:\/\/codepen.io\/awanshrestha\/pen\/JjBVyJX\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [and on <a href=\"https:\/\/playground.anychart.com\/xc1LvqKj\" target=\"_blank\" rel=\"nofollow\">Playground<\/a>]. Also, I have put the entire code below.<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-xc1LvqKj\" src=\"https:\/\/playground.anychart.com\/xc1LvqKj\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-xc1LvqKj{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<pre><code>&lt;html lang=\"en\"&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;title&gt;JavaScript Tag Cloud&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-tag-cloud.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;      \r\n      html, body, #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      anychart.onDocumentReady(function () {\r\n        \/\/ add data\r\n        var data = [\r\n          { \"x\": \"Alsace\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Austria\", \"value\": 12, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n          { \"x\": \"Austria-Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n          { \"x\": \"Australia\", \"value\": 8, \"category\": \"Australia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Australia\"},\r\n          { \"x\": \"Argentina\", \"value\": 5, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Argentina\"},\r\n          { \"x\": \"Bangladesh\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bangladesh\"},\r\n          { \"x\": \"Belarus\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belarus\"},\r\n          { \"x\": \"Belgium\", \"value\": 9, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belgium\"},\r\n          { \"x\": \"Bulgaria\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bulgaria\"},\r\n          { \"x\": \"Canada\", \"value\": 15, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Canada\"},\r\n          { \"x\": \"Chile\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Chile\"},\r\n          { \"x\": \"China\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#China,_(People's_Republic_of_China)\"},\r\n          { \"x\": \"Colombia\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Colombia\"},\r\n          { \"x\": \"Costa Rica\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Costa_Rica\"},\r\n          { \"x\": \"Cyprus\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Cyprus\"},\r\n          { \"x\": \"Czechoslovakia\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Czech_Republic\"},\r\n          { \"x\": \"Democratic Republic of the Congo\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Congo,_Democratic_Republic\"},\r\n          { \"x\": \"Denmark\", \"value\": 13, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Denmark\"},\r\n          { \"x\": \"Egypt\", \"value\": 4, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Egypt\"},\r\n          { \"x\": \"Ethiopia\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ethiopia\"},\r\n          { \"x\": \"Finland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Finland\"},\r\n          { \"x\": \"France\", \"value\": 60, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#France\"},\r\n          { \"x\": \"Germany\", \"value\": 61, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Ghana\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ghana\"},\r\n          { \"x\": \"Greece\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Greece\"},\r\n          { \"x\": \"Guatemala\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Guatemala\"},\r\n          { \"x\": \"Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Hungary\"},\r\n          { \"x\": \"Iceland\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iceland\"},\r\n          { \"x\": \"India\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#India\"},\r\n          { \"x\": \"Iran\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iran\"},\r\n          { \"x\": \"Iraq\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iraq\"},\r\n          { \"x\": \"Ireland\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n          { \"x\": \"Israel\", \"value\": 13, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Israel\"},\r\n          { \"x\": \"Italy\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Italy\"},\r\n          { \"x\": \"Japan\", \"value\": 25, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Japan\"},\r\n          { \"x\": \"Kenya\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Kenya\"},\r\n          { \"x\": \"Liberia\", \"value\": 2, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Liberia\"},\r\n          { \"x\": \"Luxembourg\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Luxembourg\"},\r\n          { \"x\": \"Mexico\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Mexico\"},\r\n          { \"x\": \"Myanmar\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Myanmar\"},\r\n          { \"x\": \"Netherlands\", \"value\": 19, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Netherlands\"},\r\n          { \"x\": \"Nigeria\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Nigeria\"},\r\n          { \"x\": \"Norway\", \"value\": 11, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Norway\"},\r\n          { \"x\": \"Northern Ireland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n          { \"x\": \"Pakistan\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Pakistan\"},    \r\n          { \"x\": \"Peru\", \"value\": 1, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Peru\"},\r\n          { \"x\": \"Philippines\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Philippines\"},\r\n          { \"x\": \"Poland\", \"value\": 5, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Poland\"},\r\n          { \"x\": \"Portugal\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Portugal\"},\r\n          { \"x\": \"Russia\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n          { \"x\": \"Spain\", \"value\": 6, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Spain\"},\r\n          { \"x\": \"South Africa\", \"value\": 7, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Africa\"},\r\n          { \"x\": \"South Korea\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Korea\"},\r\n          { \"x\": \"St. Lucia\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Saint_Lucia\"},\r\n          { \"x\": \"Sweden\", \"value\": 34, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Sweden\"},\r\n          { \"x\": \"Switzerland\", \"value\": 24, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Switzerland\"},\r\n          { \"x\": \"Tanzania\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tanzania\"},\r\n          { \"x\": \"Tibet\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tibet\"},\r\n          { \"x\": \"Timorese\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#East_Timor\"},\r\n          { \"x\": \"Trinidad\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Trinidad_and_Tobago\"},\r\n          { \"x\": \"Turkey\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Turkey\"},\r\n          { \"x\": \"Ukraine\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ukraine\"},\r\n          { \"x\": \"United Kingdom\", \"value\": 119, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_Kingdom\"},\r\n          { \"x\": \"United States\", \"value\": 393, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_States\"},\r\n          { \"x\": \"U.S.S.R.\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n          { \"x\": \"Vietnam\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Vietnam\"},\r\n          { \"x\": \"West Germany\", \"value\": 23, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Yemen\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yemen\"},\r\n          { \"x\": \"Yugoslavia\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yugoslavia\"}\r\n        ];\r\n        \/\/ create a tag cloud with the added data\r\n        var chart = anychart.tagCloud(data);\r\n        \/\/ set the chart title\r\n        chart.title(\"Nobel Laureates by Country\");\r\n        \/\/ set the container element id\r\n        chart.container(\"container\");\r\n        \/\/ initiate the drawing of the chart\r\n        chart.draw();\r\n      });\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>B. Customizing JS Tag Cloud<\/h2>\n<p>After getting that basic JavaScript tag cloud, I decided to add some customizations to improve the chart\u2019s view.<\/p>\n<h3>1. Modifying the Font<\/h3>\n<p>First, I changed the font. For the title customization, I used HTML.<\/p>\n<pre><code>chart\r\n  .title()\r\n  .enabled(true)\r\n  .useHtml(true)\r\n  .text(\r\n    '&lt;span style=\"font-size: 20px;\"&gt;Nobel Laureates by Country&lt;\/span&gt;'\r\n  );<\/code><\/pre>\n<p>I also adjusted the tags.<\/p>\n<pre><code>chart\r\n  .normal()\r\n  .fontWeight(600)\r\n  .fontVariant('small-caps');<\/code><\/pre>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-lb7hpyM9\" src=\"https:\/\/playground.anychart.com\/lb7hpyM9\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-lb7hpyM9{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3>2. Changing the Angle<\/h3>\n<p>Second, I changed the way the tags are oriented by setting the angle to zero to make them all displayed horizontally.<\/p>\n<pre><code>chart.angles([0]);<\/code><\/pre>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-TswsL4eR\" src=\"https:\/\/playground.anychart.com\/TswsL4eR\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-TswsL4eR{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3>3. Improving the Visual Appearance<\/h3>\n<p>Third, I changed the colors and added a color range.<\/p>\n<p>I created a color scale using the <code>anychart.scales.ordinalColor()<\/code> function and passed an array of colors to it. Then I set the color scale to the tag cloud chart and added a color range.<\/p>\n<pre><code>\/\/ create and configure a color scale\r\nlet customColorScale = anychart.scales.ordinalColor();\r\ncustomColorScale.colors(['#077fe8', '#1c9447', '#970fff',  '#c47900', '#e80707','#323238']);\r\n\r\n\/\/ set the color scale as the color scale of the chart\r\nchart.colorScale(customColorScale);\r\n  \r\n\/\/ get the color range\r\nlet colorRange = chart.colorRange();\r\n\/\/ enable the color range\r\ncolorRange\r\n  .enabled(true)\r\n  .colorLineSize(15);<\/code><\/pre>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-o2ao0byi\" src=\"https:\/\/playground.anychart.com\/o2ao0byi\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-o2ao0byi{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3>4. Enhancing the Tooltip<\/h3>\n<p>Fourth, I improved the tooltip, a hint that shows up when you hover over the words in an interactive tag cloud.<\/p>\n<p>I accessed the <code>tooltip()<\/code> function and used the <code>format()<\/code> function to change the tooltip content.<\/p>\n<pre><code>chart\r\n  .tooltip()\r\n  .format('Total Nobel Laureates: {%value}\\n Continent: {%category}');<\/code><\/pre>\n<h3>5. Adding interactivity With Link Opening<\/h3>\n<p>Finally, I decided to add an event listener so that a new page opens up to provide more information when a country is clicked.<\/p>\n<p>I used the <code>listen()<\/code> function to &#8220;listen&#8221; when one clicks on a country\u2019s tag. When I could access the URL property in the data array and add the <code>window.open()<\/code> function to open the web page with that URL. I also passed the _blank property to make the URL open in a new tab.<\/p>\n<pre><code>chart.listen(\"pointClick\", function(e){\r\n  var url = e.point.get(\"url\").toString();\r\n  window.open(url, \"_blank\");\r\n});<\/code><\/pre>\n<p>After all these customizations, I ended up getting a cool, interactive, JavaScript-based tag cloud demonstrated below.<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-QF9SiuW6\" src=\"https:\/\/playground.anychart.com\/X5keoorJ\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-QF9SiuW6{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>It&#8217;s the final version of the tag cloud I was satisfied with. Check it out with the full source code on <a href=\"https:\/\/codepen.io\/awanshrestha\/pen\/PoBgKKQ\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [and on <a href=\"https:\/\/playground.anychart.com\/X5keoorJ\" target=\"_blank\" rel=\"nofollow\">Playground<\/a>] and feel free to play around with colors, interactivity, and so on \u2014 use all your creativity, and I am sure you will enjoy the process.<\/p>\n<p>For your convenience, I am also putting the final JS tag cloud code below.<\/p>\n<pre><code>&lt;html lang=\"en\"&gt;\r\n  &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;title&gt;JavaScript Tag Cloud&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-tag-cloud.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;      \r\n      html, body, #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      anychart.onDocumentReady(function () {\r\n        \/\/ add data\r\n        var data = [\r\n          { \"x\": \"Alsace\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Austria\", \"value\": 12, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n          { \"x\": \"Austria-Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Austria\"},\r\n          { \"x\": \"Australia\", \"value\": 8, \"category\": \"Australia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Australia\"},\r\n          { \"x\": \"Argentina\", \"value\": 5, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Argentina\"},\r\n          { \"x\": \"Bangladesh\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bangladesh\"},\r\n          { \"x\": \"Belarus\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belarus\"},\r\n          { \"x\": \"Belgium\", \"value\": 9, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Belgium\"},\r\n          { \"x\": \"Bulgaria\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Bulgaria\"},\r\n          { \"x\": \"Canada\", \"value\": 15, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Canada\"},\r\n          { \"x\": \"Chile\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Chile\"},\r\n          { \"x\": \"China\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#China,_(People's_Republic_of_China)\"},\r\n          { \"x\": \"Colombia\", \"value\": 2, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Colombia\"},\r\n          { \"x\": \"Costa Rica\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Costa_Rica\"},\r\n          { \"x\": \"Cyprus\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Cyprus\"},\r\n          { \"x\": \"Czechoslovakia\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Czech_Republic\"},\r\n          { \"x\": \"Democratic Republic of the Congo\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Congo,_Democratic_Republic\"},\r\n          { \"x\": \"Denmark\", \"value\": 13, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Denmark\"},\r\n          { \"x\": \"Egypt\", \"value\": 4, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Egypt\"},\r\n          { \"x\": \"Ethiopia\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ethiopia\"},\r\n          { \"x\": \"Finland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Finland\"},\r\n          { \"x\": \"France\", \"value\": 60, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#France\"},\r\n          { \"x\": \"Germany\", \"value\": 61, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Ghana\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ghana\"},\r\n          { \"x\": \"Greece\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Greece\"},\r\n          { \"x\": \"Guatemala\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Guatemala\"},\r\n          { \"x\": \"Hungary\", \"value\": 3, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Hungary\"},\r\n          { \"x\": \"Iceland\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iceland\"},\r\n          { \"x\": \"India\", \"value\": 5, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#India\"},\r\n          { \"x\": \"Iran\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iran\"},\r\n          { \"x\": \"Iraq\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Iraq\"},\r\n          { \"x\": \"Ireland\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n          { \"x\": \"Israel\", \"value\": 13, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Israel\"},\r\n          { \"x\": \"Italy\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Italy\"},\r\n          { \"x\": \"Japan\", \"value\": 25, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Japan\"},\r\n          { \"x\": \"Kenya\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Kenya\"},\r\n          { \"x\": \"Liberia\", \"value\": 2, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Liberia\"},\r\n          { \"x\": \"Luxembourg\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Luxembourg\"},\r\n          { \"x\": \"Mexico\", \"value\": 2, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Mexico\"},\r\n          { \"x\": \"Myanmar\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Myanmar\"},\r\n          { \"x\": \"Netherlands\", \"value\": 19, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Netherlands\"},\r\n          { \"x\": \"Nigeria\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Nigeria\"},\r\n          { \"x\": \"Norway\", \"value\": 11, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Norway\"},\r\n          { \"x\": \"Northern Ireland\", \"value\": 4, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ireland\"},\r\n          { \"x\": \"Pakistan\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Pakistan\"},    \r\n          { \"x\": \"Peru\", \"value\": 1, \"category\": \"South America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Peru\"},\r\n          { \"x\": \"Philippines\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Philippines\"},\r\n          { \"x\": \"Poland\", \"value\": 5, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Poland\"},\r\n          { \"x\": \"Portugal\", \"value\": 2, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Portugal\"},\r\n          { \"x\": \"Russia\", \"value\": 7, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n          { \"x\": \"Spain\", \"value\": 6, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Spain\"},\r\n          { \"x\": \"South Africa\", \"value\": 7, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Africa\"},\r\n          { \"x\": \"South Korea\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#South_Korea\"},\r\n          { \"x\": \"St. Lucia\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Saint_Lucia\"},\r\n          { \"x\": \"Sweden\", \"value\": 34, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Sweden\"},\r\n          { \"x\": \"Switzerland\", \"value\": 24, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Switzerland\"},\r\n          { \"x\": \"Tanzania\", \"value\": 1, \"category\": \"Africa\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tanzania\"},\r\n          { \"x\": \"Tibet\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Tibet\"},\r\n          { \"x\": \"Timorese\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#East_Timor\"},\r\n          { \"x\": \"Trinidad\", \"value\": 1, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Trinidad_and_Tobago\"},\r\n          { \"x\": \"Turkey\", \"value\": 2, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Turkey\"},\r\n          { \"x\": \"Ukraine\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Ukraine\"},\r\n          { \"x\": \"United Kingdom\", \"value\": 119, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_Kingdom\"},\r\n          { \"x\": \"United States\", \"value\": 393, \"category\": \"North America\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#United_States\"},\r\n          { \"x\": \"U.S.S.R.\", \"value\": 15, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Russia_and_Soviet_Union\"},\r\n          { \"x\": \"Vietnam\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Vietnam\"},\r\n          { \"x\": \"West Germany\", \"value\": 23, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Germany\"},\r\n          { \"x\": \"Yemen\", \"value\": 1, \"category\": \"Asia\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yemen\"},\r\n          { \"x\": \"Yugoslavia\", \"value\": 1, \"category\": \"Europe\", \"url\": \"https:\/\/en.wikipedia.org\/wiki\/List_of_Nobel_laureates_by_country#Yugoslavia\"}\r\n        ];\r\n        \/\/ create a tag cloud with the added data\r\n        var chart = anychart.tagCloud(data);\r\n        \/\/ set the chart title\r\n        chart.title(\"Nobel Laureates by Country\");\r\n        \/\/ set the container element id\r\n        chart.container(\"container\");\r\n        \/\/ initiate the drawing of the chart\r\n        chart.draw();\r\n      });\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>Well, this is how I created my tag cloud using JavaScript (HTML5), displaying the statistics of the Nobel laureates by country. I hope my stepwise tutorial will help you quickly get your own charts of this type up and running.<\/p>\n<p>Leave your questions in the comments, if any, and I would love to check out your tag clouds.<\/p>\n<hr \/>\n<p><strong><em>Published with the permission of Awan Shrestha. Originally appeared on <a href=\"https:\/\/hackernoon.com\/nobel-laureates-by-country-or-creating-a-tag-cloud-with-javascript\" target=\"_blank\" rel=\"nofollow\">HackerNoon<\/a> with the title &#8220;Nobel Laureates by Country &#8211; Or Creating a Tag Cloud With JavaScript&#8221; on October 2, 2023.<\/p>\n<p>You may also like to read the <a href=\"https:\/\/www.anychart.com\/blog\/2019\/04\/30\/create-javascript-word-cloud-chart-tutorial\/\">JavaScript World Cloud Tutorial<\/a> originally published on our blog earlier, visualizing the most popular languages worldwide.<\/p>\n<p>Check out more <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a> and continue mastering interactive data visualization.<\/p>\n<p>If you feel like creating a stunning guest post for our blog, feel free to <a href=\"https:\/\/www.anychart.com\/support\/\">get in touch<\/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>The Nobel Prize 2023 announcements are just around the corner, scheduled from October 2 to 9. Recently, I stumbled upon this news, sparking my interest in Nobel laureates and their countries of origin. This curiosity led me to the comprehensive list of Nobel Prize winners on Britannica, which I transformed into an interactive tag cloud [&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,23,13,279,4],"tags":[619,618,53,3173,1758,3149,284,3269,3609,471,266,620,1292,880,806,3352,509,2220,54,2757,256,350,844,165,313,1370,133,774,775,805,1533,1762,1025,3608,2013,2014,32,55,1335,144,167,146,433,152,2949,151,36,907,141,249,3111,81,57,1238,142,99,906,905,3586,58,65,101,3526,904,903,391,393,3099,244,3456,908,909,1534,172,807,808,3100,293,899,2816,1763,804,3407,245],"class_list":["post-16938","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-big-data","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-analysis","tag-analytics","tag-anychart","tag-app-development","tag-chart-design","tag-chart-development","tag-chart-examples","tag-chart-visualizations","tag-countries","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-visualization","tag-data-visualization-development","tag-data-visualization-examples","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-front-end-development","tag-geographical-text-analysis","tag-guest-post","tag-hacker-noon","tag-hackernoon","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographic","tag-infographics","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-features","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-graph","tag-javascript-graphics","tag-javascript-library","tag-javascript-tag-cloud","tag-javascript-word-cloud","tag-js","tag-js-chart","tag-js-charting","tag-js-graphics","tag-js-library","tag-js-tag-cloud","tag-js-word-cloud","tag-nobel-prize","tag-nobel-prize-laureates","tag-storytelling-examples","tag-tag-cloud","tag-text-analysis","tag-text-data","tag-text-data-visualization","tag-text-visualization","tag-tutorial","tag-visual-analysis","tag-visual-analytics","tag-visual-storytelling-examples","tag-visualization","tag-visualizations","tag-web-design","tag-web-developers","tag-web-development","tag-website-development","tag-word-cloud","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tag Cloud Guide, or Charting Nobel Laureates&#039; Countries with JS<\/title>\n<meta name=\"description\" content=\"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.\" \/>\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\/10\/03\/nobel-tag-cloud-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating a Tag Cloud with JavaScript\" \/>\n<meta property=\"og:description\" content=\"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-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-10-03T13:48:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-03T13:53:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-og.png\" \/>\n<meta name=\"author\" content=\"Awan Shrestha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Creating a Tag Cloud with JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-og.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=\"28 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\/10\/03\/nobel-tag-cloud-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\"},\"author\":{\"name\":\"Awan Shrestha\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"headline\":\"Nobel Laureates&#8217; Countries, or Making Tag Cloud with JavaScript\",\"datePublished\":\"2023-10-03T13:48:49+00:00\",\"dateModified\":\"2023-10-03T13:53:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\"},\"wordCount\":1069,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png\",\"keywords\":[\"analysis\",\"analytics\",\"AnyChart\",\"app development\",\"chart design\",\"chart development\",\"chart examples\",\"chart visualizations\",\"countries\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data chart\",\"data charting\",\"data charts\",\"data graphic\",\"data graphics\",\"data visual\",\"Data Visualization\",\"data visualization development\",\"data visualization examples\",\"data visualization projects\",\"data visualization tutorial\",\"data visualizations\",\"data visuals\",\"data viz examples\",\"dataviz\",\"dataviz examples\",\"dataviz projects\",\"front-end development\",\"geographical text analysis\",\"guest post\",\"Hacker Noon\",\"HackerNoon\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographic\",\"infographics\",\"interactive charts\",\"interactive data visualization\",\"interactive graphics\",\"interactive infographic\",\"interactive infographics\",\"interactive visualizations\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting features\",\"JavaScript charting library\",\"javascript charts\",\"javascript graph\",\"javascript graphics\",\"JavaScript library\",\"javascript tag cloud\",\"javascript word cloud\",\"js\",\"js chart\",\"js charting\",\"JS graphics\",\"js library\",\"js tag cloud\",\"js word cloud\",\"Nobel Prize\",\"Nobel Prize Laureates\",\"storytelling examples\",\"tag cloud\",\"text analysis\",\"text data\",\"text data visualization\",\"text visualization\",\"tutorial\",\"visual analysis\",\"visual analytics\",\"visual storytelling examples\",\"visualization\",\"visualizations\",\"web design\",\"web developers\",\"web development\",\"website development\",\"word cloud\"],\"articleSection\":[\"AnyChart Charting Component\",\"Big Data\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\",\"name\":\"Tag Cloud Guide, or Charting Nobel Laureates' Countries with JS\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png\",\"datePublished\":\"2023-10-03T13:48:49+00:00\",\"dateModified\":\"2023-10-03T13:53:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"description\":\"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png\",\"width\":1366,\"height\":768},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Nobel Laureates&#8217; Countries, or Making Tag Cloud 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":"Tag Cloud Guide, or Charting Nobel Laureates' Countries with JS","description":"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.","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\/10\/03\/nobel-tag-cloud-js\/","og_locale":"en_US","og_type":"article","og_title":"Creating a Tag Cloud with JavaScript","og_description":"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.","og_url":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2023-10-03T13:48:49+00:00","article_modified_time":"2023-10-03T13:53:46+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-og.png","type":"","width":"","height":""}],"author":"Awan Shrestha","twitter_card":"summary_large_image","twitter_title":"Creating a Tag Cloud with JavaScript","twitter_description":"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide-og.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Awan Shrestha","Est. reading time":"28 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/"},"author":{"name":"Awan Shrestha","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"headline":"Nobel Laureates&#8217; Countries, or Making Tag Cloud with JavaScript","datePublished":"2023-10-03T13:48:49+00:00","dateModified":"2023-10-03T13:53:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/"},"wordCount":1069,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png","keywords":["analysis","analytics","AnyChart","app development","chart design","chart development","chart examples","chart visualizations","countries","data analysis","data analytics","data analytics examples","data chart","data charting","data charts","data graphic","data graphics","data visual","Data Visualization","data visualization development","data visualization examples","data visualization projects","data visualization tutorial","data visualizations","data visuals","data viz examples","dataviz","dataviz examples","dataviz projects","front-end development","geographical text analysis","guest post","Hacker Noon","HackerNoon","HTML","HTML charts","HTML5","html5 charts","infographic","infographics","interactive charts","interactive data visualization","interactive graphics","interactive infographic","interactive infographics","interactive visualizations","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting features","JavaScript charting library","javascript charts","javascript graph","javascript graphics","JavaScript library","javascript tag cloud","javascript word cloud","js","js chart","js charting","JS graphics","js library","js tag cloud","js word cloud","Nobel Prize","Nobel Prize Laureates","storytelling examples","tag cloud","text analysis","text data","text data visualization","text visualization","tutorial","visual analysis","visual analytics","visual storytelling examples","visualization","visualizations","web design","web developers","web development","website development","word cloud"],"articleSection":["AnyChart Charting Component","Big Data","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/","url":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/","name":"Tag Cloud Guide, or Charting Nobel Laureates' Countries with JS","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png","datePublished":"2023-10-03T13:48:49+00:00","dateModified":"2023-10-03T13:53:46+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"description":"Discover which country has the most Nobel Prize winners in an interactive tag cloud and learn how you can build your own JavaScript-based tag (word) clouds.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/09\/tag-cloud-guide.png","width":1366,"height":768},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2023\/10\/03\/nobel-tag-cloud-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Nobel Laureates&#8217; Countries, or Making Tag Cloud 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\/16938","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=16938"}],"version-history":[{"count":16,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/16938\/revisions"}],"predecessor-version":[{"id":16958,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/16938\/revisions\/16958"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=16938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=16938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=16938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}