{"id":17031,"date":"2023-11-27T17:08:12","date_gmt":"2023-11-27T17:08:12","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=17031"},"modified":"2023-11-28T08:39:50","modified_gmt":"2023-11-28T08:39:50","slug":"mekko-chart-js","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/","title":{"rendered":"How to Make Mekko Chart Using JavaScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\"><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png\" alt=\"\" width=\"100%\" class=\"alignnone size-full wp-image-17043\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png 1920w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js-300x169.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js-768x432.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js-1024x576.png 1024w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><a href=\"https:\/\/www.anychart.com\/blog\/2018\/11\/20\/data-visualization-definition-history-examples\/\">Data visualization<\/a> plays a pivotal role in comprehending complex information and conveying insights clearly. Among the diverse array of techniques, the <strong>Mekko chart<\/strong> stands out for its ability to vividly represent categorical data and illuminate relationships between categories and subcategories.<\/p>\n<p>In this tutorial, we will delve into the world of Mekko charts. First, let\u2019s take a moment to explore what they are and how they function. Then, we\u2019ll get to the focal point, a step-by-step guide on how to quickly create a Mekko chart using <strong>JavaScript<\/strong>.<\/p>\n<p>The data used for illustration is the <strong>U.S. car sales data<\/strong> for the top eight car brands in 2022. By the end of this tutorial, you will have crafted a cool interactive JS Mekko chart that graphically represents the respective proportions within this data by brand and by quarter.<\/p>\n<p>So, ignite your data visualization engines, and let\u2019s go!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2 id=\"what-is-a-mekko-chart-\">What Is a Mekko Chart?<\/h2>\n<p>The Mekko Chart is a two-dimensional <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/mekko-chart\/\">visualization of categorical data<\/a> presented in a rectangular grid, often referred to as the mosaic plot. Essentially, it functions as a variable-width <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/percent-stacked-column-chart\/\">100% stacked column chart<\/a> with no spacing between columns and is designed to assist data analysts in uncovering relationships between categories and subcategories.<\/p>\n<p>Mekko charts effectively represent categorical data across two variables along the horizontal and vertical axes, respectively. Each category is depicted as a column, signifying 100%, and its width illustrates the category\u2019s size relative to the total of all categories, which is also represented as 100%. These columns are further divided into components, with the height of each sub-column indicating the proportion of subcategories within the overarching category.<\/p>\n<p>Mekko charts are also known as Marimekko charts. The &quot;full&quot; name &quot;Marimekko charts&quot; pays homage to the Finnish textile company Marimekko, renowned for its vibrant prints, some of which these charts resemble. Staying true to their inspirational source, Marimekko charts offer an engaging approach to intuitively presenting complex data. They excel in scenarios where you need to showcase how categories and subcategories contribute to their respective wholes and compare these contributions. These charts find wide-ranging applications across various fields, including market segmentation, product portfolio analysis, and project resource allocation.<\/p>\n<h2 id=\"mekko-chart-example-preview\">Mekko Chart Example: Preview<\/h2>\n<p>Eager to catch a glimpse of the data graphic we\u2019re about to create? Here\u2019s a sneak peek of what the final JavaScript-based Mekko chart will look like after implementing all the steps described in this tutorial.<\/p>\n<p><a href=\"https:\/\/playground.anychart.com\/1wiI8omg\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" src=\"https:\/\/ucarecdn.com\/60cf36c5-7fa1-46c6-804b-995146f543ce\/\" width=\"100%\" alt=\"Basic Mekko Chart\"><\/a><\/p>\n<p>Get ready to kickstart this data visualization journey with JavaScript. Buckle up as we steer through this data-driven road trip!<\/p>\n<h2 id=\"a-building-a-basic-mekko-chart-with-javascript\">A. Building a Basic Mekko Chart with JavaScript<\/h2>\n<p>Creating a JS-based Mekko chart is just a few simple steps away. Those are:<\/p>\n<ol>\n<li>Set up an HTML page with a container<\/li>\n<li>Include the required JavaScript files<\/li>\n<li>Load the data<\/li>\n<li>Write some JS charting code<\/li>\n<\/ol>\n<p>No need to worry if you\u2019re a beginner in HTML, CSS, and JavaScript \u2013 I\u2019ll guide you through every step in detail.<\/p>\n<h3 id=\"1-set-up-an-html-page-with-a-container\">1. Set up an HTML page with a container<\/h3>\n<p>To create a Mekko chart, you\u2019ll need to set up an HTML container, your canvas for this masterpiece. Here\u2019s how:<\/p>\n<p>Begin by creating a basic HTML page, or if you have one ready, use that as your starting point.<\/p>\n<p>Next, introduce a <code>&lt;div&gt;<\/code> element into the body of your HTML page. Give it a unique ID, which you\u2019ll refer to in the JavaScript charting code.<\/p>\n<p>You can also adjust CSS rules within the <code>&lt;style&gt;<\/code> tags to influence the chart\u2019s appearance. For instance, if you want it to span the entire page, set both the width and height properties to 100%. However, keep in mind that these CSS properties are totally flexible, and you can modify them to match the design and aesthetic requirements of your project.<\/p>\n<p>Here\u2019s an example of how a basic web page structure, including a Mekko chart container element, might look:<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Mekko Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">\r\n    <span class=\"hljs-selector-tag\">html<\/span>,\r\n    <span class=\"hljs-selector-tag\">body<\/span>,\r\n    <span class=\"hljs-selector-id\">#mekko-container<\/span> {\r\n      <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n    }\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"mekko-container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h3 id=\"2-include-the-required-javascript-files\">2. Include the required JavaScript files<\/h3>\n<p>With your HTML structure in place, it\u2019s time to incorporate the JavaScript files needed for creating the required graphic. To streamline the process, you can <a href=\"https:\/\/www.anychart.com\/blog\/2017\/03\/05\/how-to-choose-the-right-javascript-charting-component-10-factors-you-have-to-consider\/\">opt for a JavaScript charting library<\/a> that comes with built-in Mekko chart support. This tutorial uses <a href=\"https:\/\/www.anychart.com\/\">AnyChart<\/a>.<\/p>\n<p>Generally, you have two ways to include JavaScript files. You can download them for local usage or link them directly via a CDN. This tutorial showcases the CDN approach.<\/p>\n<p>Here\u2019s how your HTML code might look with a library\u2019s modules:<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Mekko Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">\r\n    <span class=\"hljs-selector-tag\">html<\/span>,\r\n    <span class=\"hljs-selector-tag\">body<\/span>,\r\n    <span class=\"hljs-selector-id\">#mekko-container<\/span> {\r\n      <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n    }\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-mekko.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"mekko-container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h3 id=\"3-load-the-data\">3. Load the data<\/h3>\n<p>Now, it\u2019s time to provide your Mekko chart with data. The data I\u2019m guiding you through visualizing in this tutorial pertains to auto sales of the top 8 car brands in the United States for the year 2022, broken down by quarter for each brand. It has been sourced from <a href=\"https:\/\/www.goodcarbadcar.net\/2022-us-vehicle-sales-figures-by-brand\/\" target=\"_blank\" rel=\"nofollow\">GoodCarBadCar.net<\/a>. Given the dataset\u2019s conciseness, you can add it directly into the JS code.<\/p>\n<p>In the example provided below, the data is structured as a JavaScript object referred to as &quot;data.&quot; This object encompasses the title of the dataset, a header array that delineates the four quarters of 2022, and a rows array. Within the rows array, each item is itself an array that corresponds to a leading auto brand and its quarterly sales figures.<\/p>\n<pre><code class=\"lang-javascript\">var data = {\r\n  title: <span class=\"hljs-string\">\"2022 U.S. Quarterly Auto Sales by Top 8 Brands\"<\/span>,\r\n  header: [<span class=\"hljs-string\">\"Name\"<\/span>, <span class=\"hljs-string\">\"Q1\"<\/span>, <span class=\"hljs-string\">\"Q2\"<\/span>, <span class=\"hljs-string\">\"Q3\"<\/span>, <span class=\"hljs-string\">\"Q4\"<\/span>],\r\n  rows: [\r\n    [<span class=\"hljs-string\">\"Ford\"<\/span>, <span class=\"hljs-number\">410.0<\/span>, <span class=\"hljs-number\">453.5<\/span>, <span class=\"hljs-number\">441.4<\/span>, <span class=\"hljs-number\">459.1<\/span>],\r\n    [<span class=\"hljs-string\">\"Toyota\"<\/span>, <span class=\"hljs-number\">433.4<\/span>, <span class=\"hljs-number\">416.8<\/span>, <span class=\"hljs-number\">411.9<\/span>, <span class=\"hljs-number\">456.5<\/span>],\r\n    [<span class=\"hljs-string\">\"Chevrolet\"<\/span>, <span class=\"hljs-number\">342.6<\/span>, <span class=\"hljs-number\">383.8<\/span>, <span class=\"hljs-number\">371.4<\/span>, <span class=\"hljs-number\">415.0<\/span>],\r\n    [<span class=\"hljs-string\">\"Honda\"<\/span> <span class=\"hljs-number\">238.1<\/span>, <span class=\"hljs-number\">215.1<\/span>, <span class=\"hljs-number\">200.2<\/span>, <span class=\"hljs-number\">227.5<\/span>],\r\n    [<span class=\"hljs-string\">\"Hyundai\"<\/span>, <span class=\"hljs-number\">152.3<\/span>, <span class=\"hljs-number\">184.1<\/span>, <span class=\"hljs-number\">184.4<\/span>, <span class=\"hljs-number\">195.9<\/span>],\r\n    [<span class=\"hljs-string\">\"Jeep\"<\/span>, <span class=\"hljs-number\">193.2<\/span>, <span class=\"hljs-number\">186.6<\/span>, <span class=\"hljs-number\">161.3<\/span>, <span class=\"hljs-number\">143.3<\/span>],\r\n    [<span class=\"hljs-string\">\"Nissan\"<\/span>, <span class=\"hljs-number\">189.8<\/span>, <span class=\"hljs-number\">172.6<\/span>, <span class=\"hljs-number\">142.8<\/span>, <span class=\"hljs-number\">177.4<\/span>],\r\n    [<span class=\"hljs-string\">\"Kia\"<\/span>, <span class=\"hljs-number\">149.0<\/span>, <span class=\"hljs-number\">172.8<\/span>, <span class=\"hljs-number\">181.1<\/span>, <span class=\"hljs-number\">175.4<\/span>]\r\n  ]\r\n};\r\n<\/code><\/pre>\n<h3 id=\"4-write-some-js-charting-code\">4. Write some JS charting code<\/h3>\n<p>Now that the data is ready, start coding your Mekko chart with JavaScript.<\/p>\n<p>Begin by adding the <code>anychart.onDocumentReady()<\/code> function, which ensures that your chart is rendered only when the web page is fully loaded.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n  anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\r\n    <span class=\"hljs-comment\">\/\/ The Mekko chart data and code will be in this section<\/span>\r\n  });\r\n<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<p>Then, introduce the data prepared in Step 3 to create a Mekko chart.<\/p>\n<pre><code class=\"lang-javascript\">anychart.onDocumentReady(function () {\r\n  \/\/ create a dataset\r\n  var data = {\r\n      title: <span class=\"hljs-string\">\"2022 U.S. Quarterly Auto Sales by Top 8 Brands\"<\/span>,\r\n      header: [<span class=\"hljs-string\">\"Name\"<\/span>, <span class=\"hljs-string\">\"Q1\"<\/span>, <span class=\"hljs-string\">\"Q2\"<\/span>, <span class=\"hljs-string\">\"Q3\"<\/span>, <span class=\"hljs-string\">\"Q4\"<\/span>],\r\n      rows: [\r\n        [<span class=\"hljs-string\">\"Ford\"<\/span>, <span class=\"hljs-number\">410.0<\/span>, <span class=\"hljs-number\">453.5<\/span>, <span class=\"hljs-number\">441.4<\/span>, <span class=\"hljs-number\">459.1<\/span>],\r\n        [<span class=\"hljs-string\">\"Toyota\"<\/span>, <span class=\"hljs-number\">433.4<\/span>, <span class=\"hljs-number\">416.8<\/span>, <span class=\"hljs-number\">411.9<\/span>, <span class=\"hljs-number\">456.5<\/span>],\r\n        [<span class=\"hljs-string\">\"Chevrolet\"<\/span>, <span class=\"hljs-number\">342.6<\/span>, <span class=\"hljs-number\">383.8<\/span>, <span class=\"hljs-number\">371.4<\/span>, <span class=\"hljs-number\">415.0<\/span>],\r\n        [<span class=\"hljs-string\">\"Honda\"<\/span>, <span class=\"hljs-number\">238.1<\/span>, <span class=\"hljs-number\">215.1<\/span>, <span class=\"hljs-number\">200.2<\/span>, <span class=\"hljs-number\">227.5<\/span>],\r\n        [<span class=\"hljs-string\">\"Hyundai\"<\/span>, <span class=\"hljs-number\">152.3<\/span>, <span class=\"hljs-number\">184.1<\/span>, <span class=\"hljs-number\">184.4<\/span>, <span class=\"hljs-number\">195.9<\/span>],\r\n        [<span class=\"hljs-string\">\"Jeep\"<\/span>, <span class=\"hljs-number\">193.2<\/span>, <span class=\"hljs-number\">186.6<\/span>, <span class=\"hljs-number\">161.3<\/span>, <span class=\"hljs-number\">143.3<\/span>],\r\n        [<span class=\"hljs-string\">\"Nissan\"<\/span>, <span class=\"hljs-number\">189.8<\/span>, <span class=\"hljs-number\">172.6<\/span>, <span class=\"hljs-number\">142.8<\/span>, <span class=\"hljs-number\">177.4<\/span>],\r\n        [<span class=\"hljs-string\">\"Kia\"<\/span>, <span class=\"hljs-number\">149.0<\/span>, <span class=\"hljs-number\">172.8<\/span>, <span class=\"hljs-number\">181.1<\/span>, <span class=\"hljs-number\">175.4<\/span>]\r\n      ]\r\n    };\r\n  });\r\n<\/code><\/pre>\n<p>Next, within the same code enclosing function, create a Mekko chart instance and add the data to it.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-comment\">\/\/ create a mekko (marimekko) chart<\/span>\r\n<span class=\"hljs-keyword\">var<\/span> chart = anychart.mekko();\r\n\r\n<span class=\"hljs-comment\">\/\/ add the data to the chart<\/span>\r\nchart.<span class=\"hljs-keyword\">data<\/span>(<span class=\"hljs-keyword\">data<\/span>);\r\n<\/code><\/pre>\n<p>Finally, just put the chart in the div container created in Step 1 and draw the resulting Mekko chart.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-comment\">\/\/ set the container<\/span>\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.container<\/span>(<span class=\"hljs-string\">\"mekko-container\"<\/span>);\r\n\r\n<span class=\"hljs-comment\">\/\/ draw the chart<\/span>\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.draw<\/span>();\r\n<\/code><\/pre>\n<p>And with that, you\u2019ve successfully created a Mekko chart using JavaScript. By observing the width of the columns, you can determine the sales share for each brand, while the height of the bars within each column reveals the quarterly brand sales distribution. Feel free to explore the interactive version of this chart <a href=\"https:\/\/playground.anychart.com\/Jw2rJesS\" target=\"_blank\" rel=\"nofollow\">here<\/a>, and stay tuned for the next section of this tutorial, which will delve into some ways to customize a ready JS Mekko chart.<\/p>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-Jw2rJesS\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/Jw2rJesS\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-Jw2rJesS{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Mekko Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">\r\n    <span class=\"hljs-selector-tag\">html<\/span>,\r\n    <span class=\"hljs-selector-tag\">body<\/span>,\r\n    <span class=\"hljs-selector-id\">#mekko-container<\/span> {\r\n      <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n    }\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-mekko.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"mekko-container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n    anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\r\n      <span class=\"hljs-comment\">\/\/ create a dataset<\/span>\r\n      <span class=\"hljs-keyword\">var<\/span> data = {\r\n        title: <span class=\"hljs-string\">\"2022 U.S. Quarterly Auto Sales by Top 8 Brands\"<\/span>,\r\n        header: [<span class=\"hljs-string\">\"Name\"<\/span>, <span class=\"hljs-string\">\"Q1\"<\/span>, <span class=\"hljs-string\">\"Q2\"<\/span>, <span class=\"hljs-string\">\"Q3\"<\/span>, <span class=\"hljs-string\">\"Q4\"<\/span>],\r\n        rows: [\r\n          [<span class=\"hljs-string\">\"Ford\"<\/span>, <span class=\"hljs-number\">410.0<\/span>, <span class=\"hljs-number\">453.5<\/span>, <span class=\"hljs-number\">441.4<\/span>, <span class=\"hljs-number\">459.1<\/span>],\r\n          [<span class=\"hljs-string\">\"Toyota\"<\/span>, <span class=\"hljs-number\">433.4<\/span>, <span class=\"hljs-number\">416.8<\/span>, <span class=\"hljs-number\">411.9<\/span>, <span class=\"hljs-number\">456.5<\/span>],\r\n          [<span class=\"hljs-string\">\"Chevrolet\"<\/span>, <span class=\"hljs-number\">342.6<\/span>, <span class=\"hljs-number\">383.8<\/span>, <span class=\"hljs-number\">371.4<\/span>, <span class=\"hljs-number\">415.0<\/span>],\r\n          [<span class=\"hljs-string\">\"Honda\"<\/span>, <span class=\"hljs-number\">238.1<\/span>, <span class=\"hljs-number\">215.1<\/span>, <span class=\"hljs-number\">200.2<\/span>, <span class=\"hljs-number\">227.5<\/span>],\r\n          [<span class=\"hljs-string\">\"Hyundai\"<\/span>, <span class=\"hljs-number\">152.3<\/span>, <span class=\"hljs-number\">184.1<\/span>, <span class=\"hljs-number\">184.4<\/span>, <span class=\"hljs-number\">195.9<\/span>],\r\n          [<span class=\"hljs-string\">\"Jeep\"<\/span>, <span class=\"hljs-number\">193.2<\/span>, <span class=\"hljs-number\">186.6<\/span>, <span class=\"hljs-number\">161.3<\/span>, <span class=\"hljs-number\">143.3<\/span>],\r\n          [<span class=\"hljs-string\">\"Nissan\"<\/span>, <span class=\"hljs-number\">189.8<\/span>, <span class=\"hljs-number\">172.6<\/span>, <span class=\"hljs-number\">142.8<\/span>, <span class=\"hljs-number\">177.4<\/span>],\r\n          [<span class=\"hljs-string\">\"Kia\"<\/span>, <span class=\"hljs-number\">149.0<\/span>, <span class=\"hljs-number\">172.8<\/span>, <span class=\"hljs-number\">181.1<\/span>, <span class=\"hljs-number\">175.4<\/span>]\r\n        ]\r\n      };\r\n      <span class=\"hljs-comment\">\/\/ create a mekko (marimekko) chart<\/span>\r\n      <span class=\"hljs-keyword\">var<\/span> chart = anychart.mekko();\r\n      <span class=\"hljs-comment\">\/\/ add the data to the chart<\/span>\r\n      chart.data(data);\r\n      <span class=\"hljs-comment\">\/\/ set a container<\/span>\r\n      chart.container(<span class=\"hljs-string\">\"mekko-container\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ draw the chart<\/span>\r\n      chart.draw();\r\n    });\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h2 id=\"b-customizing-a-mekko-chart\">B. Customizing a Mekko Chart<\/h2>\n<p>Now, let\u2019s see how you can add some customizations to your basic Mekko chart to make it more visually appealing and informative.<\/p>\n<h3 id=\"1-axes-titles\">1. Axes Titles<\/h3>\n<p>In order to make it understandable at a glance, it\u2019s generally a good idea to add appropriate captions to a chart. For instance, to make it obvious right away precisely what each axis represents, you can set titles for the axes.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-comment\">\/\/ set the x-axis title<\/span>\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.xAxis<\/span>()<span class=\"hljs-selector-class\">.title<\/span>(<span class=\"hljs-string\">\"Sales by brand (units)\"<\/span>);\r\n<span class=\"hljs-comment\">\/\/ set the y-axis title<\/span>\r\n<span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.yAxis<\/span>()<span class=\"hljs-selector-class\">.title<\/span>(<span class=\"hljs-string\">\"Sales by quarter (%)\"<\/span>);\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-Ad4nTNmB\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/Ad4nTNmB\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-Ad4nTNmB{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"2-labels-format\">2. Labels Format<\/h3>\n<p>Next, you may want to enhance the chart labels. Here\u2019s a way to add a unit of measurement, which is thousands of vehicles in this case, and slightly change their formatting.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"xml\">chart.labels()\r\n  .useHtml(true)\r\n  .format(\"<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">b<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">'color:#ebebeb;font-size:10px;'<\/span>&gt;<\/span><\/span><span class=\"hljs-template-variable\">{%Value}<\/span><span class=\"xml\">K<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">b<\/span>&gt;<\/span>\");<\/span>\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-xtiXlPtB\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/xtiXlPtB\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-xtiXlPtB{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"3-axis-labels-rotation\">3. Axis Labels Rotation<\/h3>\n<p>If the horizontal axis labels appear long and do not fit properly, it\u2019s possible to rotate them. Here\u2019s, for example, how you can rotate the X-axis labels by 40 degrees counterclockwise.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.xAxis<\/span>()<span class=\"hljs-selector-class\">.labels<\/span>()<span class=\"hljs-selector-class\">.rotation<\/span>(<span class=\"hljs-selector-tag\">-40<\/span>);\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-f1vJWFIY\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/f1vJWFIY\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-f1vJWFIY{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"4-color-adjustment\">4. Color Adjustment<\/h3>\n<p>To enhance the visual appeal of your Mekko (or any other chart), align it with your brand\u2019s design preferences, or improve its overall comprehensibility, you can consider applying different colors than appear by default.<\/p>\n<p>Begin by creating a custom color palette for the chart, specifying color codes, and then set it to the chart\u2019s palette.<\/p>\n<pre><code class=\"javascript\">var customPalette = anychart.palettes.distinctColors()\r\n  .items([\"#ff7f0e\", \"#077fe8\", \"#2ca02c\", \"#d62728\"]);\r\nchart.palette(customPalette);\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-2COhqQWA\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/2COhqQWA\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-2COhqQWA{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"5-chart-legend\">5. Chart Legend<\/h3>\n<p>Adding a legend can be a good way to enhance the chart\u2019s legibility. It helps viewers understand the meaning of different colors and elements within your chart.<\/p>\n<p>To include a legend, just enable it. Additionally, you can adjust the font size and padding for better visibility and positioning. That will make your Mekko chart more user-friendly and informative.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.legend<\/span>()\r\n  <span class=\"hljs-selector-class\">.enabled<\/span>(<span class=\"hljs-selector-tag\">true<\/span>)\r\n  <span class=\"hljs-selector-class\">.fontSize<\/span>(13)\r\n  <span class=\"hljs-selector-class\">.padding<\/span>(<span class=\"hljs-selector-attr\">[0, 0, 20, 0]<\/span>);\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-bZn7Q3Mp\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/bZn7Q3Mp\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-bZn7Q3Mp{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<h3 id=\"6-tooltip-enhancement\">6. Tooltip Enhancement<\/h3>\n<p>Customizing tooltips is like fine-tuning an engine for better performance. In this way, viewers can quickly gain the necessary detailed insights by hovering over specific chart segments.<\/p>\n<p>For example, here\u2019s how it\u2019s possible to customize Mekko tooltips to display essential information such as the brand name, sales value, and percentage contribution to total sales for each quarter.<\/p>\n<pre><code class=\"lang-javascript\"><span class=\"hljs-selector-tag\">chart<\/span><span class=\"hljs-selector-class\">.tooltip<\/span>()\r\n  <span class=\"hljs-selector-class\">.useHtml<\/span>(true)\r\n  <span class=\"hljs-selector-class\">.format<\/span>(<span class=\"hljs-string\">\"{%seriesName}: &lt;b&gt;{%Value}K&lt;\/b&gt; units ({%yPercentOfCategory}%)\"<\/span>)\r\n  <span class=\"hljs-selector-class\">.displayMode<\/span>(<span class=\"hljs-string\">\"union\"<\/span>);\r\n<\/code><\/pre>\n<p><iframe sandbox=\"allow-scripts allow-pointer-lock allow-same-origin\n                 allow-popups allow-modals allow-forms\" frameBorder=\"0\" class=\"anychart-embed anychart-embed-1wiI8omg\"\n        allowtransparency=\"true\" allowfullscreen=\"true\"\n        src=\"https:\/\/playground.anychart.com\/1wiI8omg\/iframe\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-1wiI8omg{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>It\u2019s truly remarkable how these seemingly minor adjustments can significantly enhance the visual clarity and information provided by the data. Take a moment to explore the final version of the Mekko chart. You can access an interactive version of the final chart <a href=\"https:\/\/playground.anychart.com\/1wiI8omg\" target=\"_blank\" rel=\"nofollow\">here<\/a> and experiment further.<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span> <span class=\"hljs-attr\">lang<\/span>=<span class=\"hljs-string\">\"en\"<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">meta<\/span> <span class=\"hljs-attr\">charset<\/span>=<span class=\"hljs-string\">\"utf-8\"<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>JavaScript Mekko Chart<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/css\"<\/span>&gt;<\/span><span class=\"css\">\r\n    <span class=\"hljs-selector-tag\">html<\/span>,\r\n    <span class=\"hljs-selector-tag\">body<\/span>,\r\n    <span class=\"hljs-selector-id\">#mekko-container<\/span> {\r\n      <span class=\"hljs-attribute\">width<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">height<\/span>: <span class=\"hljs-number\">100%<\/span>;\r\n      <span class=\"hljs-attribute\">margin<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n      <span class=\"hljs-attribute\">padding<\/span>: <span class=\"hljs-number\">0<\/span>;\r\n    }\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">style<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-core.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/cdn.anychart.com\/releases\/8.11.1\/js\/anychart-mekko.min.js\"<\/span>&gt;<\/span><span class=\"undefined\"><\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"mekko-container\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\r\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">\r\n    anychart.onDocumentReady(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-params\">()<\/span> <\/span>{\r\n      <span class=\"hljs-comment\">\/\/ create a dataset<\/span>\r\n      <span class=\"hljs-keyword\">var<\/span> data = {\r\n        title: <span class=\"hljs-string\">\"2022 U.S. Quarterly Auto Sales by Top 8 Brands\"<\/span>,\r\n        header: [<span class=\"hljs-string\">\"Name\"<\/span>, <span class=\"hljs-string\">\"Q1\"<\/span>, <span class=\"hljs-string\">\"Q2\"<\/span>, <span class=\"hljs-string\">\"Q3\"<\/span>, <span class=\"hljs-string\">\"Q4\"<\/span>],\r\n        rows: [\r\n          [<span class=\"hljs-string\">\"Ford\"<\/span>, <span class=\"hljs-number\">410.0<\/span>, <span class=\"hljs-number\">453.5<\/span>, <span class=\"hljs-number\">441.4<\/span>, <span class=\"hljs-number\">459.1<\/span>],\r\n          [<span class=\"hljs-string\">\"Toyota\"<\/span>, <span class=\"hljs-number\">433.4<\/span>, <span class=\"hljs-number\">416.8<\/span>, <span class=\"hljs-number\">411.9<\/span>, <span class=\"hljs-number\">456.5<\/span>],\r\n          [<span class=\"hljs-string\">\"Chevrolet\"<\/span>, <span class=\"hljs-number\">342.6<\/span>, <span class=\"hljs-number\">383.8<\/span>, <span class=\"hljs-number\">371.4<\/span>, <span class=\"hljs-number\">415.0<\/span>],\r\n          [<span class=\"hljs-string\">\"Honda\"<\/span>, <span class=\"hljs-number\">238.1<\/span>, <span class=\"hljs-number\">215.1<\/span>, <span class=\"hljs-number\">200.2<\/span>, <span class=\"hljs-number\">227.5<\/span>],\r\n          [<span class=\"hljs-string\">\"Hyundai\"<\/span>, <span class=\"hljs-number\">152.3<\/span>, <span class=\"hljs-number\">184.1<\/span>, <span class=\"hljs-number\">184.4<\/span>, <span class=\"hljs-number\">195.9<\/span>],\r\n          [<span class=\"hljs-string\">\"Jeep\"<\/span>, <span class=\"hljs-number\">193.2<\/span>, <span class=\"hljs-number\">186.6<\/span>, <span class=\"hljs-number\">161.3<\/span>, <span class=\"hljs-number\">143.3<\/span>],\r\n          [<span class=\"hljs-string\">\"Nissan\"<\/span>, <span class=\"hljs-number\">189.8<\/span>, <span class=\"hljs-number\">172.6<\/span>, <span class=\"hljs-number\">142.8<\/span>, <span class=\"hljs-number\">177.4<\/span>],\r\n          [<span class=\"hljs-string\">\"Kia\"<\/span>, <span class=\"hljs-number\">149.0<\/span>, <span class=\"hljs-number\">172.8<\/span>, <span class=\"hljs-number\">181.1<\/span>, <span class=\"hljs-number\">175.4<\/span>]\r\n        ]\r\n      };\r\n      <span class=\"hljs-comment\">\/\/ create a mekko (marimekko) chart<\/span>\r\n      <span class=\"hljs-keyword\">var<\/span> chart = anychart.mekko();\r\n      <span class=\"hljs-comment\">\/\/ add the dataset to the chart<\/span>\r\n      chart.data(data);\r\n      <span class=\"hljs-comment\">\/\/ set the x-axis title<\/span>\r\n      chart.xAxis().title(<span class=\"hljs-string\">\"Sales by brand (units)\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ set the y-axis title<\/span>\r\n      chart.yAxis().title(<span class=\"hljs-string\">\"Sales by quarter (%)\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ customize the chart labels<\/span>\r\n      chart.labels()\r\n        .useHtml(<span class=\"hljs-literal\">true<\/span>)\r\n        .format(<span class=\"hljs-string\">\"&lt;b style='color:#ebebeb;font-size:10px;'&gt;{%Value}K&lt;\/b&gt;\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ rotate the x-axis labels<\/span>\r\n      chart.xAxis().labels().rotation(<span class=\"hljs-number\">-40<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ set a custom color palette for the chart<\/span>\r\n      <span class=\"hljs-keyword\">var<\/span> customPalette = anychart.palettes.distinctColors()\r\n        .items([<span class=\"hljs-string\">\"#ff7f0e\"<\/span>, <span class=\"hljs-string\">\"#077fe8\"<\/span>, <span class=\"hljs-string\">\"#2ca02c\"<\/span>, <span class=\"hljs-string\">\"#d62728\"<\/span>]);\r\n      chart.palette(customPalette);\r\n      <span class=\"hljs-comment\">\/\/ enable the legend<\/span>\r\n      chart.legend()\r\n        .enabled(<span class=\"hljs-literal\">true<\/span>)\r\n        .fontSize(<span class=\"hljs-number\">13<\/span>)\r\n        .padding([<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">0<\/span>]);\r\n      <span class=\"hljs-comment\">\/\/ customize the tooltip format<\/span>\r\n      chart.tooltip()\r\n        .useHtml(<span class=\"hljs-literal\">true<\/span>)\r\n        .format(<span class=\"hljs-string\">\"{%seriesName}: &lt;b&gt;{%Value}K&lt;\/b&gt; units ({%yPercentOfCategory}%)\"<\/span>)\r\n        .displayMode(<span class=\"hljs-string\">\"union\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ set a container<\/span>\r\n      chart.container(<span class=\"hljs-string\">\"mekko-container\"<\/span>);\r\n      <span class=\"hljs-comment\">\/\/ draw the chart<\/span>\r\n      chart.draw();\r\n    });\r\n  <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\r\n<\/code><\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>Bravo! We\u2019ve successfully navigated the journey of creating a Mekko chart using JavaScript. Hopefully, this guide has equipped you with the knowledge and skills to craft your own charts of this type.<\/p>\n<p>Now it\u2019s your turn to take the wheel and explore the limitless <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Marimekko_Chart\/Mekko_Chart\" target=\"_blank\" rel=\"nofollow\">customizations<\/a> available to you. I\u2019m excited to see the JavaScript-based Mekko charts you&#39;ll create after following this tutorial. Let your creativity cruise in the fast lane, and let your work shine as a beacon on the data highway!<\/p>\n<p>Happy mekkoing!<\/p>\n<hr \/>\n<p><strong><em>Published with the permission of Awan Shrestha. Originally appeared on <a href=\"https:\/\/www.codementor.io\/@awanshrestha\/mekko-chart-how-to-build-it-with-javascript-2ac1mndu55\" target=\"_blank\" rel=\"nofollow\">Codementor<\/a> under the title &#8220;Mekko Chart &#038; How to Build It with JavaScript&#8221; on November 8, 2023.<\/p>\n<p>You&#8217;re also welcome to check out the <a href=\"https:\/\/www.anychart.com\/blog\/2021\/03\/16\/waterfall-chart-js\">Marimekko Chart Tutorial<\/a> specifically produced by Dilhani Withanage for our blog earlier, visualizing global smartphone shipments by quarter and by vendor step by step.<\/p>\n<p>See our other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a> and continue improving your interactive data visualization skills.<\/p>\n<p>Would you like to contribute some nice guest post? Don&#8217;t hesitate to <a href=\"https:\/\/www.anychart.com\/support\/\">contact us<\/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>Data visualization plays a pivotal role in comprehending complex information and conveying insights clearly. Among the diverse array of techniques, the Mekko chart stands out for its ability to vividly represent categorical data and illuminate relationships between categories and subcategories. In this tutorial, we will delve into the world of Mekko charts. First, let\u2019s take [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,23,13,279,4],"tags":[619,618,53,3618,3617,254,1758,3149,166,258,282,471,266,620,1292,880,806,509,294,257,2220,54,1389,3377,1111,844,165,313,805,1762,2013,2014,32,55,1335,144,2979,2016,167,146,152,2949,151,36,907,141,249,3111,81,57,169,170,1238,142,96,99,3586,58,65,56,101,3526,2227,2387,2388,240,2228,241,2368,172,309,807,808,954,2816,1763,804],"class_list":["post-17031","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-analysis","tag-analytics","tag-anychart","tag-auto-sales","tag-car-sales","tag-chart","tag-chart-design","tag-chart-development","tag-charting","tag-charts","tag-data","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-chart","tag-data-charting","tag-data-charts","tag-data-graphics","tag-data-science","tag-data-stories","tag-data-visual","tag-data-visualization","tag-data-visualization-best-pracices","tag-data-visualization-guide","tag-data-visualization-practice","tag-data-visualization-tutorial","tag-data-visualizations","tag-data-visuals","tag-front-end-development","tag-guest-post","tag-html","tag-html-charts","tag-html5","tag-html5-charts","tag-infographic","tag-infographics","tag-information-graphics","tag-information-visualization","tag-interactive-charts","tag-interactive-data-visualization","tag-interactive-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-drawing","tag-javascript-drawing-library","tag-javascript-graph","tag-javascript-graphics","tag-javascript-graphics-library","tag-javascript-library","tag-js","tag-js-chart","tag-js-charting","tag-js-charts","tag-js-graphics","tag-js-library","tag-marimekko-chart","tag-market-data","tag-market-data-visualization","tag-mekko-chart","tag-mekko-graphics","tag-mosaic-chart","tag-mosaic-plot","tag-tutorial","tag-united-states","tag-visual-analysis","tag-visual-analytics","tag-visual-data-analytics","tag-web-design","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>Mekko Chart Development Using JavaScript (HTML5): Tutorial<\/title>\n<meta name=\"description\" content=\"Learn what the Mekko chart is &amp; how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!\" \/>\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\/11\/27\/mekko-chart-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mekko Chart Development Using JavaScript (HTML5): Tutorial\" \/>\n<meta property=\"og:description\" content=\"Learn what the Mekko chart is &amp; how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\" \/>\n<meta property=\"og:site_name\" content=\"AnyChart News\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/AnyCharts\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-27T17:08:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-28T08:39:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-social.png\" \/>\n<meta name=\"author\" content=\"Awan Shrestha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Mekko Chart Development Using JavaScript (HTML5): Tutorial\" \/>\n<meta name=\"twitter:description\" content=\"Learn what the Mekko chart is &amp; how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-social.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Awan Shrestha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"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\/2023\/11\/27\/mekko-chart-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\"},\"author\":{\"name\":\"Awan Shrestha\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"headline\":\"How to Make Mekko Chart Using JavaScript\",\"datePublished\":\"2023-11-27T17:08:12+00:00\",\"dateModified\":\"2023-11-28T08:39:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\"},\"wordCount\":1577,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png\",\"keywords\":[\"analysis\",\"analytics\",\"AnyChart\",\"auto sales\",\"car sales\",\"chart\",\"chart design\",\"chart development\",\"charting\",\"charts\",\"data\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"data chart\",\"data charting\",\"data charts\",\"data graphics\",\"data science\",\"data stories\",\"data visual\",\"Data Visualization\",\"data visualization best practices\",\"data visualization guide\",\"data visualization practice\",\"data visualization tutorial\",\"data visualizations\",\"data visuals\",\"front-end development\",\"guest post\",\"HTML\",\"HTML charts\",\"HTML5\",\"html5 charts\",\"infographic\",\"infographics\",\"information graphics\",\"information visualization\",\"interactive charts\",\"interactive data visualization\",\"interactive infographic\",\"interactive infographics\",\"interactive visualizations\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"javascript charting api\",\"JavaScript charting features\",\"JavaScript charting library\",\"javascript charts\",\"javascript drawing\",\"javascript drawing library\",\"javascript graph\",\"javascript graphics\",\"JavaScript graphics library\",\"JavaScript library\",\"js\",\"js chart\",\"js charting\",\"js charts\",\"JS graphics\",\"js library\",\"Marimekko chart\",\"market data\",\"market data visualization\",\"mekko chart\",\"Mekko graphics\",\"mosaic chart\",\"Mosaic Plot\",\"tutorial\",\"united states\",\"visual analysis\",\"visual analytics\",\"visual data analytics\",\"web design\",\"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\/2023\/11\/27\/mekko-chart-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\",\"name\":\"Mekko Chart Development Using JavaScript (HTML5): Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png\",\"datePublished\":\"2023-11-27T17:08:12+00:00\",\"dateModified\":\"2023-11-28T08:39:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1\"},\"description\":\"Learn what the Mekko chart is & how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Make Mekko Chart Using 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":"Mekko Chart Development Using JavaScript (HTML5): Tutorial","description":"Learn what the Mekko chart is & how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!","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\/11\/27\/mekko-chart-js\/","og_locale":"en_US","og_type":"article","og_title":"Mekko Chart Development Using JavaScript (HTML5): Tutorial","og_description":"Learn what the Mekko chart is & how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!","og_url":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2023-11-27T17:08:12+00:00","article_modified_time":"2023-11-28T08:39:50+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-social.png","type":"","width":"","height":""}],"author":"Awan Shrestha","twitter_card":"summary_large_image","twitter_title":"Mekko Chart Development Using JavaScript (HTML5): Tutorial","twitter_description":"Learn what the Mekko chart is & how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-social.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Awan Shrestha","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/"},"author":{"name":"Awan Shrestha","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"headline":"How to Make Mekko Chart Using JavaScript","datePublished":"2023-11-27T17:08:12+00:00","dateModified":"2023-11-28T08:39:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/"},"wordCount":1577,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png","keywords":["analysis","analytics","AnyChart","auto sales","car sales","chart","chart design","chart development","charting","charts","data","data analysis","data analytics","data analytics examples","data chart","data charting","data charts","data graphics","data science","data stories","data visual","Data Visualization","data visualization best practices","data visualization guide","data visualization practice","data visualization tutorial","data visualizations","data visuals","front-end development","guest post","HTML","HTML charts","HTML5","html5 charts","infographic","infographics","information graphics","information visualization","interactive charts","interactive data visualization","interactive infographic","interactive infographics","interactive visualizations","JavaScript","javascript chart tutorial","javascript charting","javascript charting api","JavaScript charting features","JavaScript charting library","javascript charts","javascript drawing","javascript drawing library","javascript graph","javascript graphics","JavaScript graphics library","JavaScript library","js","js chart","js charting","js charts","JS graphics","js library","Marimekko chart","market data","market data visualization","mekko chart","Mekko graphics","mosaic chart","Mosaic Plot","tutorial","united states","visual analysis","visual analytics","visual data analytics","web design","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\/2023\/11\/27\/mekko-chart-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/","url":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/","name":"Mekko Chart Development Using JavaScript (HTML5): Tutorial","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png","datePublished":"2023-11-27T17:08:12+00:00","dateModified":"2023-11-28T08:39:50+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/3f107fdcb3fe326a63cd52812f5287c1"},"description":"Learn what the Mekko chart is & how to create this visualization using JavaScript with ease. Illustrated by U.S. car sales data. Start your data viz engine!","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2023\/11\/marimekko-chart-js.png","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2023\/11\/27\/mekko-chart-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Make Mekko Chart Using 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\/17031","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=17031"}],"version-history":[{"count":11,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/17031\/revisions"}],"predecessor-version":[{"id":17046,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/17031\/revisions\/17046"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=17031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=17031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=17031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}