{"id":12688,"date":"2021-05-11T05:42:09","date_gmt":"2021-05-11T05:42:09","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=12688"},"modified":"2022-08-13T11:05:46","modified_gmt":"2022-08-13T11:05:46","slug":"mosaic-chart-js","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/","title":{"rendered":"Building Mosaic Chart in JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\"><img decoding=\"async\" class=\"alignnone size-full wp-image-12700\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png\" alt=\"A laptop screen with a mosaic chart made with JavaScript\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png 1600w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-300x158.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-768x406.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-1024x541.png 1024w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/a><font size=\"4\"><strong><em>A step-by-step guide for building an interactive JS Mosaic Chart. Illustrated by visualizing data on quarterly PC shipments by brand in 2020.<\/em><\/strong><\/font><\/p>\n<p>Data visualization is a valuable tool in today\u2019s scenario, with data everywhere and various opportunities to tap into that data to find insights. Visual charts are imperative to communicate ideas, identify patterns, and make the most of the available data.<\/p>\n<p>So then, would you like to quickly and easily learn how to create a really cool chart that showcases data interestingly?<\/p>\n<p>A <strong>mosaic chart<\/strong> is a multi-series chart that effectively represents data with over 2 parameters and is so-called because each data point has distinctive indents, making it visually similar to a piece of mosaic art. Not only is this chart beautiful to look at, but is also very helpful in representing multiple variables and recognizing the relationship between these different variables.<\/p>\n<p>The year 2020 was not all bad, at least for the market of personal computers. The <strong>sales of PCs<\/strong> increased throughout each quarter of 2020, with more people working and studying from home. I explored how each brand fared in every quarter based on the number of global shipments.<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<p>Here is a look at the final chart to get you excited!<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-12702\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-built.png\" alt=\"Mosaic chart to be built and explored along this JS charting tutorial\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-built.png 1175w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-built-300x156.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-built-768x399.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-built-1024x532.png 1024w\" sizes=\"(max-width: 1175px) 100vw, 1175px\" \/><br \/>\nFollow along with this quick tutorial for front-end web developers and data viz enthusiasts to get the hang of creating a <strong>Mosaic Chart with JavaScript<\/strong>.<\/p>\n<h2>Building a JS Mosaic Chart in 4 Simple Steps<\/h2>\n<p>A mosaic chart may look exciting but difficult to create. However, it is pretty straightforward and easy to create this chart with a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JavaScript charting library<\/a> as one can remove a lot of the burden of coding and allow you to get a chart up quickly and with minimal technical details.<\/p>\n<p>For this tutorial, I am using the <a href=\"https:\/\/www.anychart.com\/\">AnyChart JS library<\/a>. I\u2019ve chosen AnyChart as it is flexible yet easy to start off. It is especially good for beginners because of the extensive <a href=\"https:\/\/docs.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">documentation<\/a>, along with many useful <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/\">examples<\/a>.<\/p>\n<p>Having some background with technologies like HTML and JavaScript is an advantage when visualizing data. Nonetheless, it is quite uncomplicated to create interactive charts with a JS library, and the steps for creating mosaic charts with almost any JavaScript library that supports this chart type tend to be more or less the same.<\/p>\n<p>The 4 fundamental steps to creating a JS Mosaic Chart are:<\/p>\n<ul>\n<li>Create an HTML page for the chart.<\/li>\n<li>Add the necessary JavaScript files.<\/li>\n<li>Connect the data.<\/li>\n<li>Write the required JS code for drawing the chart.<\/li>\n<\/ul>\n<h3>1. Create a Basic HTML Page<\/h3>\n<p>The first thing to do is create a basic HTML page that will hold the chart. Next, create an HTML block element, and to identify this <code>&lt;div&gt;<\/code> later in the code, I give it an id attribute like &#8216;container.&#8217;<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Mosaic Chart&lt;\/title&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>I give 100% width and height to the block so that the chart fills the entire page, but it can be specified according to your preference.<\/p>\n<h3>2. Reference the necessary JavaScript files<\/h3>\n<p>The next step is adding the charting library scripts to create the mosaic chart. I include the corresponding files from AnyChart\u2019s <a href=\"https:\/\/www.anychart.com\/download\/cdn\/\">CDN<\/a> since that is the library I am using. Of course, these scripts can also be downloaded and referenced as such.<\/p>\n<p>For this chart, I need the <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">core script<\/a> along with the specific <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#mekko\" target=\"_blank\" rel=\"nofollow\">module for the mosaic chart<\/a>. Here, the module for the mosaic chart contains 3 different types of Marimekko charts, mosaic being one of them. If you want to know more about these charts and their specific characteristics, check out the AnyChart <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Marimekko_Chart\/\" target=\"_blank\" rel=\"nofollow\">documentation about Marimekko charts<\/a>.<\/p>\n<p>I add both of these scripts to the <code>&lt;head&gt;<\/code> section of my HTML page.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Mosaic Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-mekko.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n      \/\/ All the JS code for the mosaic chart will come here.\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>3. Set the Data<\/h3>\n<p>I collated the sales data for different PC brands for each quarter of 2020 as given by <a href=\"https:\/\/www.gartner.com\/en\/newsroom\/press-releases\/2021-01-11-gartner-says-worldwide-pc-shipments-grew-10-point-7-percent-in-the-fourth-quarter-of-2020-and-4-point-8-percent-for-the-year\" target=\"_blank\" rel=\"nofollow\">Gartner<\/a>. To facilitate the creation of the mosaic chart, I processed the data in a format that is suitable for it, and since the data is limited, I add it directly in the code.<\/p>\n<p>Here, I plot the quarters on the X-axis and the brands as individual tiles, so I add the brands in the header data and the quarterly figures in the rows.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Mosaic Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-mekko.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n      var data = {\r\n        header: [\r\n          '#',\r\n\u00a0\u00a0        'LENOVO',\r\n          'HP',\r\n          'DELL',\r\n          'APPLE',\r\n          'ACER',\r\n          'ASUS',\r\n          'OTHERS'\r\n        ],\r\n        rows: [\r\n          ['Q1', 12613,11114,10158,3555,2900,2603,8693],\r\n          ['Q2', 16197,16165,10648,4368,4007,3593,9829],\r\n          ['Q3', 18310,15447,10827,5513,5085,4747,11448],\r\n          ['Q4', 21491,15683,13199,6893,4741,4570,12813]\r\n        ]\r\n      };\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>Now that we have all the prep done, let\u2019s go on to the final step for drawing the chic, interactive JS mosaic chart!<\/p>\n<h3>4. Write the JavaScript Code for Your Chart<\/h3>\n<p>Writing code might sound daunting for someone with not much coding experience, but believe me, it is literally 5 lines that need to be written to conjure up a beautiful mosaic chart.<\/p>\n<p>Before anything else, I add a function enclosing all the code, which makes sure that the entire code inside it will only execute once the page is ready. I then put the data inside this function.<\/p>\n<p>Next, I create the mosaic chart with the inbuilt function and set the data.<\/p>\n<p>Finally, I add the reference to the container where the chart is to be drawn, set the title of the chart, and initiate the drawing.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Mosaic Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-mekko.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n      anychart.onDocumentReady(function () {\r\n        var data = {\r\n          header: [\r\n            '#',\r\n            'LENOVO',\r\n            'HP',\r\n            'DELL',\r\n            'APPLE',\r\n            'ACER',\r\n            'ASUS',\r\n            'OTHERS'\r\n          ],\r\n          rows: [\r\n            ['Q1', 12613,11114,10158,3555,2900,2603,8693],\r\n            ['Q2', 16197,16165,10648,4368,4007,3593,9829],\r\n            ['Q3', 18310,15447,10827,5513,5085,4747,11448],\r\n            ['Q4', 21491,15683,13199,6893,4741,4570,12813]\r\n          ]\r\n        };\r\n\r\n        \/\/ create a mosaic chart\r\n        var chart = anychart.mosaic();\r\n\r\n        \/\/ set chart data\r\n        chart.data(data);\r\n\r\n        \/\/ set container id for the chart\r\n        chart.container('container');\r\n\r\n        \/\/ set the chart title  \r\n        chart.title(\"Quarterly Brand-wise Personal Computer Shipments in 2020 (Thousands of Units)\");\r\n\r\n        \/\/ initiate chart drawing\r\n        chart.draw();\r\n      });\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>Lo-and-behold! A fascinating and functional mosaic chart is created!<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-xR2Wh65Y\" src=\"https:\/\/playground.anychart.com\/xR2Wh65Y\/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-xR2Wh65Y{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>You can immediately see how the shipments increase each quarter by the increasing width of every quarter. In brands, Lenovo is the clear market leader and its sales have grown quarter by quarter. Also, something lucidly seen is that Lenovo, HP and Dell capture more than 50% of the market.<\/p>\n<p><strong>Have a look at this initial version of the mosaic chart with the full JS\/CSS\/HTML code on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/LYbvzRJ\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [or on <a href=\"https:\/\/playground.anychart.com\/xR2Wh65Y\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>].<\/strong><\/p>\n<h2>Customizing the Mosaic Chart<\/h2>\n<p>Most of the decent JS charting libraries allow you to customize the charts using their API. These customizations can make your data visualization stand out with personalized aesthetics and improved representation of the message you want to convey.<\/p>\n<p>Now that the basic mosaic chart is created, let me show you how to enhance the chart\u2019s capabilities in representing the data and tweaking its appearance by some simple customizations.<\/p>\n<h3>1. Reduce the Space Between Individual Tiles<\/h3>\n<p>To improve the appearance of the mosaic, I reduce the space between each of the points with just one line of code.<\/p>\n<pre><code class=\"javascript\">chart.pointsPadding(3);<\/code><\/pre>\n<h3>2. Improve the Data Label Presentation<\/h3>\n<p>The values in the data are in the form of figures in thousands. To make it more readable and easily comprehensible, I change the format of the numbers to showcase the figures in millions. I also update the title of the chart to reflect this modification.<\/p>\n<pre><code class=\"javascript\">\/\/ set the chart labels settings\r\nchart.labels()\r\n  .format(function(e){\r\n    var value = ((this.value)\/1000).toFixed(2);\r\n    return value + \" M\";\r\n  });\r\n\r\n...\r\n\r\n\/\/ set the chart title\r\nchart.title(\"Quarterly Brand-wise Personal Computer Shipments in 2020\");<\/code><\/pre>\n<p><strong>You can check out the entire code for this intermediate version of the mosaic chart on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/bGBJYdR\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [or on <a href=\"https:\/\/playground.anychart.com\/3FLAT707\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>].<\/strong><\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-3FLAT707\" src=\"https:\/\/playground.anychart.com\/3FLAT707\/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-3FLAT707{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3>3. Change the Color Theme and Make Other Related Modifications<\/h3>\n<p>To make the Mosaic chart more personalized, I decide to use a different color palette. AnyChart offers some great inbuilt <a href=\"https:\/\/docs.anychart.com\/Appearance_Settings\/Themes\" target=\"_blank\" rel=\"nofollow\">themes<\/a> that include pre-defined settings like the colors for the chart data points as well as background along with distinct fonts. You can also create a custom theme, but for this chart, I choose an out-of-the-box theme that feels like an old-generation PC screen.<\/p>\n<p>I add the theme script in the <code>&lt;head&gt;<\/code> section and then add a line of code to set the theme for the mosaic chart.<\/p>\n<p>The inherent font size is slightly small for my preference, so I specify the size of the font in the styling. Also, I want the title of the chart to be bigger, so I add some code to modify that as well.<\/p>\n<pre><code class=\"html\">&lt;head&gt;\r\n  &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/themes\/dark_blue.min.js\"&gt;\r\n  &lt;\/script&gt;\r\n  \r\n...\r\n  \r\n  &lt;style type=\"text\/css\"&gt;\r\n  #container text {\r\n    font-size: 13px;\r\n  }\r\n  &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n\r\n...\r\n\r\n&lt;body&gt;\r\n  &lt;script&gt;\r\n  \r\n  \/\/ set the chart theme\r\n  anychart.theme('darkBlue');\r\n  \r\n  &lt;\/script&gt;\r\n&lt;\/body&gt;<\/code><\/pre>\n<p>Also, I want the title of the chart to be bigger, so I add some code to modify that as well.<\/p>\n<pre><code class=\"javascript\">\/\/ set the chart title\r\nchart\r\n  .title()\r\n  .enabled(true)\r\n  .useHtml(true)\r\n  .text(\"&lt;span style='font-size:16px';&gt;Quarterly Brand-wise Personal Computer Shipments in 2020&lt;\/span&gt;\");<\/code><\/pre>\n<p>Aha! Doesn\u2019t the mosaic chart look so very personalized and engaging?<\/p>\n<h3>4. Enhance the tooltip<\/h3>\n<p>The last thing to do is make the tooltip more informative and better formatted. Since this is a mosaic chart with individual data points very distinctly identifiable, I want the tooltip to show all the data values for that particular quarter. This can be done by specifying the display mode for the tooltip.<\/p>\n<p>Finally, I just tweak the appearance of the tooltip.<\/p>\n<pre><code class=\"javascript\">\/\/ set union tooltip\r\nchart.tooltip().displayMode('union');\r\n\r\n\/\/ enable HTML in tooltips and format\r\nchart\r\n  .tooltip()\r\n  .useHtml(true)\r\n  .format(\"&lt;h5 style='font-size:14px; margin: 0.5rem 0;'&gt;{%name}&lt;\/h5&gt;{%SeriesName}: {%value}{scale:(1000)(1000)|( M)}\");<\/code><\/pre>\n<p>That\u2019s it! A very appealing and informative JavaScript Mosaic Chart is ready.<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-9aRCmwxU\" src=\"https:\/\/playground.anychart.com\/9aRCmwxU\/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-9aRCmwxU{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p><strong>Take a look at the final code for the mosaic chart here or on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/xxRePQw\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a> [or on <a href=\"https:\/\/playground.anychart.com\/9aRCmwxU\/\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>].<\/strong><\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;JavaScript Mosaic Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-mekko.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/themes\/dark_blue.min.js\"&gt;\r\n    &lt;\/script&gt;\r\n    &lt;style type=\"text\/css\"&gt;\r\n      html,\r\n      body,\r\n      #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n      #container text {\r\n        font-size: 13px;\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        var data = {\r\n          header: [\r\n            '#',\r\n            'LENOVO',\r\n            'HP',\r\n            'DELL',\r\n            'APPLE',\r\n            'ACER',\r\n            'ASUS',\r\n            'OTHERS'\r\n          ],\r\n          rows: [\r\n            ['Q1', 12613,11114,10158,3555,2900,2603,8693],\r\n            ['Q2', 16197,16165,10648,4368,4007,3593,9829],\r\n            ['Q3', 18310,15447,10827,5513,5085,4747,11448],\r\n            ['Q4', 21491,15683,13199,6893,4741,4570,12813]\r\n          ]\r\n        };\r\n\r\n        \/\/ set the chart theme\r\n        anychart.theme('darkBlue');\r\n\r\n        \/\/ create a mosaic chart\r\n        var chart = anychart.mosaic();\r\n\r\n        \/\/ set points padding\r\n        chart.pointsPadding(3);\r\n\r\n        \/\/ set chart data\r\n        chart.data(data);\r\n\r\n        \/\/ set the chart labels settings\r\n        chart.labels()\r\n          .format(function(e){\r\n            var value = ((this.value)\/1000).toFixed(2);\r\n          return value + \" M\";\r\n        });\r\n\r\n        \/\/ set union tooltip\r\n        chart.tooltip().displayMode('union');\r\n\r\n        \/\/ enable HTML in tooltips and format\r\n        chart\r\n          .tooltip()\r\n          .useHtml(true)\r\n          .format(\"&lt;h5 style='font-size:14px; margin: 0.5rem 0;'&gt;{%name}&lt;\/h5&gt;{%SeriesName}: {%value}{scale:(1000)(1000)|( M)}\");\r\n\r\n        \/\/ set container id for the chart\r\n        chart.container('container');\r\n\r\n        \/\/ set the chart title  \r\n        chart\r\n          .title()\r\n          .enabled(true)\r\n          .useHtml(true)\r\n          .text(\"&lt;span style='font-size:16px';&gt;Quarterly Brand-wise Personal Computer Shipments in 2020&lt;\/span&gt;\");\r\n\r\n        \/\/ initiate chart drawing\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>As you can see, building a creative and interactive JS Mosaic Chart is not difficult with the help of a charting library. Of course, this is just scratching the surface, so go ahead and experiment with different charts as well as datasets. There are many <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">other JS charting libraries<\/a> to explore or if you want, check out some awesome <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/\">other chart types<\/a> in AnyChart.<\/p>\n<p>Use that Lenovo or Dell (or are you a Mac person?) of yours to create visualizations and please share your creations here. Of course, let me know if you have any questions.<\/p>\n<hr \/>\n<p><strong><em>Published with permission of Shachee Swadia. Originally appeared on <a href=\"https:\/\/dzone.com\/articles\/how-to-create-a-mosaic-chart-using-javascript\" target=\"_blank\" rel=\"nofollow\">DZone<\/a> under the title &#8220;How to Create a Mosaic Chart Using JavaScript&#8221; on May 5, 2021.<\/em><\/strong><\/p>\n<hr \/>\n<p><strong><em>Learn more about mosaic charts on <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/mosaic-chart\/\">Chartopedia<\/a>. Check out other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a>.<\/em><\/strong><\/p>\n<hr \/>\n<p><strong><em>If you want to write an interesting guest post for our blog, please\u00a0<a href=\"https:\/\/www.anychart.com\/support\/\">contact us<\/a>.<\/em><\/strong><\/p>\n<p><!-- SyntaxHighlighter --><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/default.min.css\"><link rel=\"stylesheet\" href=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/styles\/atom-one-light.min.css\"><script src=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/highlight.js\/9.12.0\/highlight.min.js\"><\/script><script>hljs.initHighlightingOnLoad();<\/script><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>A step-by-step guide for building an interactive JS Mosaic Chart. Illustrated by visualizing data on quarterly PC shipments by brand in 2020. Data visualization is a valuable tool in today\u2019s scenario, with data everywhere and various opportunities to tap into that data to find insights. Visual charts are imperative to communicate ideas, identify patterns, and [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,23,13,279,4],"tags":[2383,53,2381,2384,1758,284,127,258,2385,471,266,620,1759,54,1760,256,844,2380,805,2376,2377,2378,2382,2013,2014,32,55,144,36,907,141,249,81,57,1238,99,58,65,56,2379,2227,2387,2388,240,2228,241,2368,2369,2372,2370,2371,2373,2374,2375,2386,588,459,30,172,1763,804],"class_list":["post-12688","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-acer","tag-anychart","tag-apple","tag-asus","tag-chart-design","tag-chart-examples","tag-chart-types","tag-charts","tag-coding","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-design","tag-data-visualization","tag-data-visualization-design","tag-data-visualization-examples","tag-data-visualization-tutorial","tag-dell","tag-front-end-development","tag-gartner","tag-gartner-data","tag-gartner-data-visualization","tag-hp","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographics","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-api","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-graph","tag-javascript-library","tag-js-chart","tag-js-charting","tag-js-charts","tag-lenovo","tag-marimekko-chart","tag-market-data","tag-market-data-visualization","tag-mekko-chart","tag-mekko-graphics","tag-mosaic-chart","tag-mosaic-plot","tag-pc-sales","tag-pc-sales-chart","tag-pc-sales-data","tag-pc-sales-data-visualization","tag-pc-shipments","tag-pc-shipments-data","tag-pc-shipments-data-visualization","tag-personal-computers","tag-sales-data","tag-statistics","tag-tips-and-tricks","tag-tutorial","tag-web-developers","tag-web-development","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Mosaic Chart in JavaScript | Simple How-To Tutorial for Beginners<\/title>\n<meta name=\"description\" content=\"A guide for how to create a cool interactive Mosaic Chart in JavaScript. Illustrated by visualizing Gartner&#039;s quarterly PC shipments data for 2020 by brand.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-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 Mosaic Chart in JavaScript\" \/>\n<meta property=\"og:description\" content=\"A guide for creating a Mosaic Chart in JS. Illustrated by visualizing Gartner&#039;s PC shipments data for 2020 by brand and by quarter.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-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=\"2021-05-11T05:42:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T11:05:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-social.png\" \/>\n<meta name=\"author\" content=\"Shachee Swadia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Build Mosaic Chart in JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"A guide for creating a Mosaic Chart in JS. Illustrated by visualizing Gartner&#039;s PC shipments data for 2020 by brand and by quarter.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shachee Swadia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\"},\"author\":{\"name\":\"Shachee Swadia\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"headline\":\"Building Mosaic Chart in JavaScript\",\"datePublished\":\"2021-05-11T05:42:09+00:00\",\"dateModified\":\"2022-08-13T11:05:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\"},\"wordCount\":1493,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png\",\"keywords\":[\"Acer\",\"AnyChart\",\"Apple\",\"ASUS\",\"chart design\",\"chart examples\",\"chart types\",\"charts\",\"coding\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data design\",\"Data Visualization\",\"data visualization design\",\"data visualization examples\",\"data visualization tutorial\",\"Dell\",\"front-end development\",\"Gartner\",\"Gartner data\",\"Gartner data visualization\",\"HP\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographics\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting library\",\"javascript charts\",\"javascript graph\",\"JavaScript library\",\"js chart\",\"js charting\",\"js charts\",\"Lenovo\",\"Marimekko chart\",\"market data\",\"market data visualization\",\"mekko chart\",\"Mekko graphics\",\"mosaic chart\",\"Mosaic Plot\",\"PC sales\",\"PC sales chart\",\"PC sales data\",\"PC sales data visualization\",\"PC shipments\",\"PC shipments data\",\"PC shipments data visualization\",\"personal computers\",\"sales data\",\"statistics\",\"Tips and tricks\",\"tutorial\",\"web developers\",\"web development\"],\"articleSection\":[\"AnyChart Charting Component\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\",\"name\":\"Mosaic Chart in JavaScript | Simple How-To Tutorial for Beginners\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png\",\"datePublished\":\"2021-05-11T05:42:09+00:00\",\"dateModified\":\"2022-08-13T11:05:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"description\":\"A guide for how to create a cool interactive Mosaic Chart in JavaScript. Illustrated by visualizing Gartner's quarterly PC shipments data for 2020 by brand.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png\",\"width\":1600,\"height\":845},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building Mosaic Chart in 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\/273255f98371177b5ac1f4775610bb51\",\"name\":\"Shachee Swadia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"caption\":\"Shachee Swadia\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mosaic Chart in JavaScript | Simple How-To Tutorial for Beginners","description":"A guide for how to create a cool interactive Mosaic Chart in JavaScript. Illustrated by visualizing Gartner's quarterly PC shipments data for 2020 by brand.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/","og_locale":"en_US","og_type":"article","og_title":"How to Build Mosaic Chart in JavaScript","og_description":"A guide for creating a Mosaic Chart in JS. Illustrated by visualizing Gartner's PC shipments data for 2020 by brand and by quarter.","og_url":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2021-05-11T05:42:09+00:00","article_modified_time":"2022-08-13T11:05:46+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-social.png","type":"","width":"","height":""}],"author":"Shachee Swadia","twitter_card":"summary_large_image","twitter_title":"How to Build Mosaic Chart in JavaScript","twitter_description":"A guide for creating a Mosaic Chart in JS. Illustrated by visualizing Gartner's PC shipments data for 2020 by brand and by quarter.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Shachee Swadia","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/"},"author":{"name":"Shachee Swadia","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"headline":"Building Mosaic Chart in JavaScript","datePublished":"2021-05-11T05:42:09+00:00","dateModified":"2022-08-13T11:05:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/"},"wordCount":1493,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png","keywords":["Acer","AnyChart","Apple","ASUS","chart design","chart examples","chart types","charts","coding","data analysis","data analytics","data analytics examples","data design","Data Visualization","data visualization design","data visualization examples","data visualization tutorial","Dell","front-end development","Gartner","Gartner data","Gartner data visualization","HP","HTML","HTML charts","HTML5","html5 charts","infographics","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting library","javascript charts","javascript graph","JavaScript library","js chart","js charting","js charts","Lenovo","Marimekko chart","market data","market data visualization","mekko chart","Mekko graphics","mosaic chart","Mosaic Plot","PC sales","PC sales chart","PC sales data","PC sales data visualization","PC shipments","PC shipments data","PC shipments data visualization","personal computers","sales data","statistics","Tips and tricks","tutorial","web developers","web development"],"articleSection":["AnyChart Charting Component","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/","url":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/","name":"Mosaic Chart in JavaScript | Simple How-To Tutorial for Beginners","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png","datePublished":"2021-05-11T05:42:09+00:00","dateModified":"2022-08-13T11:05:46+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"description":"A guide for how to create a cool interactive Mosaic Chart in JavaScript. Illustrated by visualizing Gartner's quarterly PC shipments data for 2020 by brand.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/05\/mosaic-chart-js.png","width":1600,"height":845},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2021\/05\/11\/mosaic-chart-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Building Mosaic Chart in 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\/273255f98371177b5ac1f4775610bb51","name":"Shachee Swadia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","caption":"Shachee Swadia"},"url":"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=12688"}],"version-history":[{"count":22,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12688\/revisions"}],"predecessor-version":[{"id":15509,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12688\/revisions\/15509"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=12688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=12688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=12688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}