{"id":9644,"date":"2020-02-26T16:54:50","date_gmt":"2020-02-26T16:54:50","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=9644"},"modified":"2022-08-13T10:20:45","modified_gmt":"2022-08-13T10:20:45","slug":"heat-map-chart-create-javascript","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/","title":{"rendered":"Creating Heat Map Chart Using JavaScript"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-9675\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\" alt=\"Creating Heat Map Chart Using JavaScript, a tutorial for web developers and data enthusiasts\" width=\"100%\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png 1147w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart-300x168.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart-768x431.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart-1024x574.png 1024w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/>Want to learn how to quickly create an interactive heat map chart using JavaScript? This data visualization tutorial will guide you through the coding process step by step. Basic knowledge of HTML (HTML5) and some understanding of programming are more than enough to master this charting technique.<\/p>\n<p>A heat map (or <a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/heatmap\/\">heatmap chart<\/a>) is a two-dimensional, matrix-based data visualization in which colors represent values. It is often used to facilitate the analysis of complex data sets, revealing patterns in how variables change, correlate, and more.<\/p>\n<p>Read this JS charting tutorial to the end and you will have no more problems with getting compelling heat maps up and running on your web sites and in your apps.<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>How to\u00a0Make JavaScript Heat Map Chart<\/h2>\n<p>Building any type of JS chart only takes the following four general steps:<\/p>\n<ol>\n<li>Create\u00a0an HTML page where\u00a0a chart will be displayed.<\/li>\n<li>Include all necessary JavaScript files.<\/li>\n<li>Load the data.<\/li>\n<li>Write the JavaScript code for the chart.<\/li>\n<\/ol>\n<p>Let&#8217;s see each of them in detail.<\/p>\n<h3>Step 1: Create an HTML page<\/h3>\n<p>The first thing you need to do is to create a basic HTML page where you will put a relevant title and an HTML block element (e.g. <code>&lt;div&gt;<\/code>) to place the chart. Here, the id has the value <code>container<\/code>, but feel free to use whatever makes sense to you. The page should look like this:<\/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;Basic JavaScript Heat Map Chart&lt;\/title&gt;\r\n    &lt;style&gt;\r\n      html, body, #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>The <code>width<\/code> and <code>height<\/code> parameters inside the <code>&lt;style&gt;<\/code> block\u00a0define the space the chart will occupy and you can change these according to your needs. The way they are set here makes the heat map occupy the entire space.<\/p>\n<h3>Step 2: Include all necessary files<\/h3>\n<p>Next, inside the <code>&lt;head&gt;<\/code> section of the HTML page, you should reference all the necessary script files.<\/p>\n<p>There are multiple JavaScript libraries out there, providing pre-written JS code that enables developers to visualize data in a more\u00a0or less straightforward way. To build heat map charts\u00a0along this tutorial, I will be using the <a href=\"https:\/\/www.anychart.com\">AnyChart<\/a> JS charting library. It is flexible, yet easy to get started with and integrate.<\/p>\n<p>When using AnyChart, you have two options of how you can get the necessary scripts:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.anychart.com\/download\/\">download<\/a>\u00a0and place\u00a0them on your server, or<\/li>\n<li>use\u00a0them from the <a href=\"https:\/\/cdn.anychart.com\" target=\"_blank\" rel=\"nofollow\">CDN<\/a>.<\/li>\n<\/ul>\n<p>Here, I will go with the CDN links. AnyChart features a <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules\" target=\"_blank\" rel=\"nofollow\">modular system<\/a>, and making a JS heat map\u00a0requires\u00a0the use of the core and the dedicated heat map scripts. The basic code implementation can look like this:<\/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;Basic JavaScript Heat Map Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.7.1\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.7.1\/js\/anychart-heatmap.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style&gt;\r\n      html, body, #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n      &lt;!-- The heat map code goes here --&gt;\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>The\u00a0<code>&lt;script&gt;<\/code> tag in the\u00a0<code>&lt;body&gt;<\/code>\u00a0section is where the heat map chart&#8217;s JavaScript code will go.<\/p>\n<h3>Step 3: Load the data<\/h3>\n<p>It&#8217;s time for data!<\/p>\n<p>In this tutorial, I will visualize the <a href=\"http:\/\/hdr.undp.org\/en\/data\" target=\"_blank\" rel=\"nofollow\">Human Development Index (HDI) data<\/a> from the United Nations Development Programme (UNDP) to observe the change\u00a0in the HDI of six macroregions \u2014 Arab States, East Asia and the Pacific, Europe and Central Asia, Latin America and the Caribbean, South Asia, and Sub-Saharan Africa \u2014 from 2010 to 2018.<\/p>\n<p>To create a heat map, three data fields are required:<\/p>\n<ul>\n<li><code>x<\/code>, where column names are set,<\/li>\n<li><code>y<\/code>, where row names are set, and<\/li>\n<li><code>heat<\/code>, where values are set.<\/li>\n<\/ul>\n<p>The resulting data will look as follows:<\/p>\n<pre><code class=\"js\">var data = [\r\n  { x: \"2010\", y: \"Arab States\", heat: 0.676 },\r\n  { x: \"2010\", y: \"East Asia and the Pacific\", heat: 0.691 },\r\n  { x: \"2010\", y: \"Europe and Central Asia\", heat: 0.735 },\r\n  { x: \"2010\", y: \"Latin America and the Caribbean\", heat: 0.731 },\r\n  { x: \"2010\", y: \"South Asia\", heat: 0.585 },\r\n  { x: \"2010\", y: \"Sub-Saharan Africa\", heat: 0.498 },\r\n  { x: \"2011\", y: \"Arab States\", heat: 0.681 },\r\n  { x: \"2011\", y: \"East Asia and the Pacific\", heat: 0.700 },\r\n  { x: \"2011\", y: \"Europe and Central Asia\", heat: 0.744 },\r\n  { x: \"2011\", y: \"Latin America and the Caribbean\", heat: 0.737 },\r\n  { x: \"2011\", y: \"South Asia\", heat: 0.593 },\r\n  { x: \"2011\", y: \"Sub-Saharan Africa\", heat: 0.505 },\r\n  { x: \"2012\", y: \"Arab States\", heat: 0.687 },\r\n  { x: \"2012\", y: \"East Asia and the Pacific\", heat: 0.707 },\r\n  { x: \"2012\", y: \"Europe and Central Asia\", heat: 0.750 },\r\n  { x: \"2012\", y: \"Latin America and the Caribbean\", heat: 0.740 },\r\n  { x: \"2012\", y: \"South Asia\", heat: 0.601 },\r\n  { x: \"2012\", y: \"Sub-Saharan Africa\", heat: 0.512 },\r\n  { x: \"2013\", y: \"Arab States\", heat: 0.688 },\r\n  { x: \"2013\", y: \"East Asia and the Pacific\", heat: 0.714 },\r\n  { x: \"2013\", y: \"Europe and Central Asia\", heat: 0.759 },\r\n  { x: \"2013\", y: \"Latin America and the Caribbean\", heat: 0.748 },\r\n  { x: \"2013\", y: \"South Asia\", heat: 0.607 },\r\n  { x: \"2013\", y: \"Sub-Saharan Africa\", heat: 0.521 },\r\n  { x: \"2014\", y: \"Arab States\", heat: 0.691 },\r\n  { x: \"2014\", y: \"East Asia and the Pacific\", heat: 0.721 },\r\n  { x: \"2014\", y: \"Europe and Central Asia\", heat: 0.766 },\r\n  { x: \"2014\", y: \"Latin America and the Caribbean\", heat: 0.752 },\r\n  { x: \"2014\", y: \"South Asia\", heat: 0.617 },\r\n  { x: \"2014\", y: \"Sub-Saharan Africa\", heat: 0.527 },\r\n  { x: \"2015\", y: \"Arab States\", heat: 0.695 },\r\n  { x: \"2015\", y: \"East Asia and the Pacific\", heat: 0.727 },\r\n  { x: \"2015\", y: \"Europe and Central Asia\", heat: 0.770 },\r\n  { x: \"2015\", y: \"Latin America and the Caribbean\", heat: 0.754 },\r\n  { x: \"2015\", y: \"South Asia\", heat: 0.624 },\r\n  { x: \"2015\", y: \"Sub-Saharan Africa\", heat: 0.532 },\r\n  { x: \"2016\", y: \"Arab States\", heat: 0.699 },\r\n  { x: \"2016\", y: \"East Asia and the Pacific\", heat: 0.733 },\r\n  { x: \"2016\", y: \"Europe and Central Asia\", heat: 0.772 },\r\n  { x: \"2016\", y: \"Latin America and the Caribbean\", heat: 0.756 },\r\n  { x: \"2016\", y: \"South Asia\", heat: 0.634 },\r\n  { x: \"2016\", y: \"Sub-Saharan Africa\", heat: 0.535 },\r\n  { x: \"2017\", y: \"Arab States\", heat: 0.699 },\r\n  { x: \"2017\", y: \"East Asia and the Pacific\", heat: 0.733 },\r\n  { x: \"2017\", y: \"Europe and Central Asia\", heat: 0.771 },\r\n  { x: \"2017\", y: \"Latin America and the Caribbean\", heat: 0.758 },\r\n  { x: \"2017\", y: \"South Asia\", heat: 0.638 },\r\n  { x: \"2017\", y: \"Sub-Saharan Africa\", heat: 0.537 },\r\n  { x: \"2018\", y: \"Arab States\", heat: 0.703 },\r\n  { x: \"2018\", y: \"East Asia and the Pacific\", heat: 0.741 },\r\n  { x: \"2018\", y: \"Europe and Central Asia\", heat: 0.779 },\r\n  { x: \"2018\", y: \"Latin America and the Caribbean\", heat: 0.759 },\r\n  { x: \"2018\", y: \"South Asia\", heat: 0.642 },\r\n  { x: \"2018\", y: \"Sub-Saharan Africa\", heat: 0.541 },\r\n];<\/code><\/pre>\n<h3>Step 4: Write the JS Heat Map chart code<\/h3>\n<p>Ok, are you ready to code?<\/p>\n<ul>\n<li>Add the <code>anychart.onDocumentReady<\/code> function inside the <code>&lt;script&gt;<\/code> tag. It will include the entire core JavaScript code of the heat map chart and will be executed when the page is ready.<\/li>\n<li>Add\u00a0the data from step 3.<\/li>\n<li>Use <code>anychart.heatMap(data)<\/code> to create a heat map chart visualizing the included data.<\/li>\n<li>Add a relevant chart title.<\/li>\n<li>Set the container id to put the chart into it.<\/li>\n<li>Draw the chart.<\/li>\n<\/ul>\n<p>Plus one important thing about the <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Heat_Map_Chart#color_scale\" target=\"_blank\" rel=\"nofollow\">color scale<\/a>. In my case, all data values are numbers less than 1. It means that AnyChart&#8217;s default ordinal scale would give us the same color in all cells. To improve the visualization and quickly apply a more appropriate cell coloring, I will use a linear scale based on two colors; the first one, #ACE8D4, will be the color for <code>heat<\/code> value 0, whereas the second color, #00726A, will be set for the maximum value. The in-between colors will be calculated automatically.<\/p>\n<p>Here is the resulting code:<\/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;Basic JavaScript Heat Map Chart&lt;\/title&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.7.1\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.7.1\/js\/anychart-heatmap.min.js\"&gt;&lt;\/script&gt;\r\n    &lt;style&gt;\r\n      html, body, #container {\r\n        width: 100%;\r\n        height: 100%;\r\n        margin: 0;\r\n        padding: 0;\r\n      }\r\n    &lt;\/style&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n    &lt;script&gt;\r\n      anychart.onDocumentReady(function () {\r\n\r\n        \/\/ create the data \r\n        var data = [\r\n          { x: \"2010\", y: \"Arab States\", heat: 0.676 },\r\n          { x: \"2010\", y: \"East Asia and the Pacific\", heat: 0.691 },\r\n          { x: \"2010\", y: \"Europe and Central Asia\", heat: 0.735 },\r\n          { x: \"2010\", y: \"Latin America and the Caribbean\", heat: 0.731 },\r\n          { x: \"2010\", y: \"South Asia\", heat: 0.585 },\r\n          { x: \"2010\", y: \"Sub-Saharan Africa\", heat: 0.498 },\r\n          { x: \"2011\", y: \"Arab States\", heat: 0.681 },\r\n          { x: \"2011\", y: \"East Asia and the Pacific\", heat: 0.700 },\r\n          { x: \"2011\", y: \"Europe and Central Asia\", heat: 0.744 },\r\n          { x: \"2011\", y: \"Latin America and the Caribbean\", heat: 0.737 },\r\n          { x: \"2011\", y: \"South Asia\", heat: 0.593 },\r\n          { x: \"2011\", y: \"Sub-Saharan Africa\", heat: 0.505 },\r\n          { x: \"2012\", y: \"Arab States\", heat: 0.687 },\r\n          { x: \"2012\", y: \"East Asia and the Pacific\", heat: 0.707 },\r\n          { x: \"2012\", y: \"Europe and Central Asia\", heat: 0.750 },\r\n          { x: \"2012\", y: \"Latin America and the Caribbean\", heat: 0.740 },\r\n          { x: \"2012\", y: \"South Asia\", heat: 0.601 },\r\n          { x: \"2012\", y: \"Sub-Saharan Africa\", heat: 0.512 },\r\n          { x: \"2013\", y: \"Arab States\", heat: 0.688 },\r\n          { x: \"2013\", y: \"East Asia and the Pacific\", heat: 0.714 },\r\n          { x: \"2013\", y: \"Europe and Central Asia\", heat: 0.759 },\r\n          { x: \"2013\", y: \"Latin America and the Caribbean\", heat: 0.748 },\r\n          { x: \"2013\", y: \"South Asia\", heat: 0.607 },\r\n          { x: \"2013\", y: \"Sub-Saharan Africa\", heat: 0.521 },\r\n          { x: \"2014\", y: \"Arab States\", heat: 0.691 },\r\n          { x: \"2014\", y: \"East Asia and the Pacific\", heat: 0.721 },\r\n          { x: \"2014\", y: \"Europe and Central Asia\", heat: 0.766 },\r\n          { x: \"2014\", y: \"Latin America and the Caribbean\", heat: 0.752 },\r\n          { x: \"2014\", y: \"South Asia\", heat: 0.617 },\r\n          { x: \"2014\", y: \"Sub-Saharan Africa\", heat: 0.527 },\r\n          { x: \"2015\", y: \"Arab States\", heat: 0.695 },\r\n          { x: \"2015\", y: \"East Asia and the Pacific\", heat: 0.727 },\r\n          { x: \"2015\", y: \"Europe and Central Asia\", heat: 0.770 },\r\n          { x: \"2015\", y: \"Latin America and the Caribbean\", heat: 0.754 },\r\n          { x: \"2015\", y: \"South Asia\", heat: 0.624 },\r\n          { x: \"2015\", y: \"Sub-Saharan Africa\", heat: 0.532 },\r\n          { x: \"2016\", y: \"Arab States\", heat: 0.699 },\r\n          { x: \"2016\", y: \"East Asia and the Pacific\", heat: 0.733 },\r\n          { x: \"2016\", y: \"Europe and Central Asia\", heat: 0.772 },\r\n          { x: \"2016\", y: \"Latin America and the Caribbean\", heat: 0.756 },\r\n          { x: \"2016\", y: \"South Asia\", heat: 0.634 },\r\n          { x: \"2016\", y: \"Sub-Saharan Africa\", heat: 0.535 },\r\n          { x: \"2017\", y: \"Arab States\", heat: 0.699 },\r\n          { x: \"2017\", y: \"East Asia and the Pacific\", heat: 0.733 },\r\n          { x: \"2017\", y: \"Europe and Central Asia\", heat: 0.771 },\r\n          { x: \"2017\", y: \"Latin America and the Caribbean\", heat: 0.758 },\r\n          { x: \"2017\", y: \"South Asia\", heat: 0.638 },\r\n          { x: \"2017\", y: \"Sub-Saharan Africa\", heat: 0.537 },\r\n          { x: \"2018\", y: \"Arab States\", heat: 0.703 },\r\n          { x: \"2018\", y: \"East Asia and the Pacific\", heat: 0.741 },\r\n          { x: \"2018\", y: \"Europe and Central Asia\", heat: 0.779 },\r\n          { x: \"2018\", y: \"Latin America and the Caribbean\", heat: 0.759 },\r\n          { x: \"2018\", y: \"South Asia\", heat: 0.642 },\r\n          { x: \"2018\", y: \"Sub-Saharan Africa\", heat: 0.541 },\r\n        ];        \r\n        \r\n        \/\/ create the chart and set the data\r\n        chart = anychart.heatMap(data);\r\n        \r\n        \/\/ set the chart title\r\n        chart.title(\"Human Development Index by region (2010-2018)\");\r\n        \r\n        \/\/ create and configure the color scale.\r\n        var customColorScale = anychart.scales.linearColor();\r\n        customColorScale.colors([\"#ACE8D4\", \"#00726A\"]);\r\n        \r\n        \/\/ set the color scale as the color scale of the chart\r\n        chart.colorScale(customColorScale);\r\n        \r\n        \/\/ set the container id\r\n        chart.container(\"container\");\r\n        \r\n        \/\/ initiate drawing the chart\r\n        chart.draw();\r\n        \r\n      });\r\n    &lt;\/script&gt;\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<p>Here&#8217;s\u00a0how the\u00a0basic JS heat map chart looks\u00a0\u2014 it is available on <a href=\"https:\/\/playground.anychart.com\/JGFu1p4e\/0\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>\u00a0where you can\u00a0proceed to practice:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-\" src=\"https:\/\/playground.anychart.com\/JGFu1p4e\/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    var head = document.getElementsByTagName('head')[0];\n    head.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n    var ac_style = document.createElement('style');\n    if (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n    else ac_style.appendChild(document.createTextNode(css));\n    ac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<p>We can see on this chart that Sub-Saharan Africa has the lowest Human\u00a0Development\u00a0Index values, whereas the Europe and Central Asia region seems to have the highest. But it is not easy to see at a glance something else interesting and even clearly understand a very important, fundamental thing \u2014 is it better for a region to have a lower or higher HDI?<\/p>\n<p>Well, that&#8217;s a good point to look at\u00a0how it&#8217;s possible to customize a JavaScript-based heat map chart, making it provide better insight with quite little JS\/HTML5 coding effort.<\/p>\n<h2>Customizing JS Heat Map Chart<\/h2>\n<p>As you see, the\u00a0basic chart built just above may not be enough to effectively communicate all the data has to say. This is where customizations come into picture as\u00a0changing the appearance (e.g. colors and texts) can make the chart more legible and informative for the end user.<\/p>\n<p>AnyChart not only gives you the ability to easily create interactive JavaScript charts, including JS heat maps, but it also gives you freedom to change it according to your needs and taste.<\/p>\n<p>Let&#8217;s\u00a0do the following modifications.<\/p>\n<ul>\n<li>Create a new custom color scale.<\/li>\n<li>Add a legend.<\/li>\n<li>Hide labels and\u00a0modify the tooltip.<\/li>\n<\/ul>\n<p>Alright, let&#8217;s go!<\/p>\n<h3>Changing the\u00a0color scale<\/h3>\n<p>HDI has four predefined categories for value ranges \u2014 &#8220;low&#8221;, &#8220;medium&#8221;, &#8220;high&#8221;\u00a0and &#8220;very high.&#8221; A higher HDI means a higher lifespan, a higher education level, and a higher gross national income per capita. To better\u00a0communicate this information, let&#8217;s create a customized color scale where each color range will be encoded with a different color\u00a0using\u00a0an ordinal color scale.<\/p>\n<p>This scale has a specific domain and color range.\u00a0So now I\u00a0will set each category as a domain and specify its color\u00a0based on a palette similar to traffic lights.<\/p>\n<p>Here, it is necessary\u00a0to use the <code>anychart.scales.ordinalColor();<\/code> constructor and then set the ranges:<\/p>\n<pre><code class=\"js\">var customColorScale = anychart.scales.ordinalColor();\r\ncustomColorScale.ranges([\r\n  { less: 0.549 },\r\n  { from: 0.550, to: 0.699 },\r\n  { from: 0.700, to: 0.799 },\r\n  { greater: 0.800 }\r\n]);<\/code><\/pre>\n<p>Then we need to\u00a0specify the colors that we want to use for each range, from small to big:<\/p>\n<pre><code class=\"js\">customColorScale.colors([\"#CF7A78\", \"#E69645\", \"#69A231\", \"#4D7623\"]);<\/code><\/pre>\n<p>And set the color scale as the color scale of the heat map chart:<\/p>\n<pre><code class=\"js\">chart.colorScale(customColorScale);<\/code><\/pre>\n<p>Check out the result\u00a0\u2014 it is also available on\u00a0<a href=\"https:\/\/playground.anychart.com\/MJw05U3Q\/0\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>\u00a0with the full source code:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-\" src=\"https:\/\/playground.anychart.com\/MJw05U3Q\/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    var head = document.getElementsByTagName('head')[0];\n    head.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n    var ac_style = document.createElement('style');\n    if (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n    else ac_style.appendChild(document.createTextNode(css));\n    ac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<h3>Adding a heat map chart legend<\/h3>\n<p>Legends help users identify what\u00a0a chart is showing. Explaining\u00a0what each color and range represents, they are like\u00a0manuals\u00a0for the corresponding data visualizations.<\/p>\n<p>To add a legend, just one simple line of code is enough:<\/p>\n<pre><code class=\"js\">chart.legend(true);<\/code><\/pre>\n<p>Here&#8217;s\u00a0the result\u00a0\u2014\u00a0you can also find it on\u00a0<a href=\"https:\/\/playground.anychart.com\/yzUYad1k\/1\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a>:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-\" src=\"https:\/\/playground.anychart.com\/yzUYad1k\/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    var head = document.getElementsByTagName('head')[0];\n    head.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n    var ac_style = document.createElement('style');\n    if (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n    else ac_style.appendChild(document.createTextNode(css));\n    ac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<p>Now, you may want to change the information displayed in the legend to make it more informative. For example, here\u00a0I want the\u00a0range names to be displayed so the viewer can clearly understand\u00a0which color encodes which range. One way to do this is to specify\u00a0the\u00a0names inside the color range constructor as shown below:<\/p>\n<pre><code class=\"js\">var customColorScale = anychart.scales.ordinalColor();\r\ncustomColorScale.ranges([\r\n  { less: 0.549, name: 'Low: &lt;= 0.549', color: '#CF7A78' },\r\n  { from: 0.550, to: 0.699, name: 'Medium: 0.55 - 0.699', color: '#E69645' },\r\n  { from: 0.700, to: 0.799, name: 'High: 0.7 - 0.799', color: '#69A231' },\r\n  { greater: 0.800, name: 'Very High: &gt;=0.8', color: '#4D7623' }\r\n]);<\/code><\/pre>\n<p>Check it out now \u2014 this example is available on <a href=\"https:\/\/playground.anychart.com\/l7TPKbGO\/1\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a> as well:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-\" src=\"https:\/\/playground.anychart.com\/l7TPKbGO\/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    var head = document.getElementsByTagName('head')[0];\n    head.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n    var ac_style = document.createElement('style');\n    if (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n    else ac_style.appendChild(document.createTextNode(css));\n    ac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<h3>Hiding labels and modifying tooltips<\/h3>\n<h4>Labels<\/h4>\n<p>Finally,\u00a0you can see that the heat map chart looks somewhat dense and maybe even a little confusing\u00a0because of all those numbers in the cells. Colors already successfully encode the ranges, so\u00a0it is possible to\u00a0hide the numbers from the cells and instead display them as extra information inside the tooltip along with the range names.<\/p>\n<p>It is easy to hide the numbers from the cells with just one line. Go ahead and add it:<\/p>\n<pre><code class=\"js\">chart.labels().enabled(false)<\/code><\/pre>\n<h4>Tooltips<\/h4>\n<p>When it comes to customizing heat map chart tooltips, there are many things you can do. Check out some ideas on the <a href=\"https:\/\/docs.anychart.com\/Common_Settings\/Tooltip\" target=\"_blank\" rel=\"nofollow\">tooltip documentation<\/a> page.<\/p>\n<p>1. Let&#8217;s start\u00a0with changing the tooltip position. By default, the position mode is set to <code>float<\/code>, which makes tooltips follow the cursor.\u00a0I want to set the tooltip position mode to <code>point<\/code>\u00a0to\u00a0prevent it from moving when you hover over the cell, hoping that\u00a0this step\u00a0will\u00a0make it\u00a0easier to read the provided info.<\/p>\n<p>The code for this modification is as follows:<\/p>\n<pre><code class=\"js\">var tooltip = chart.tooltip();\r\ntooltip.positionMode(\"point\");<\/code><\/pre>\n<p>2. Also, it is possible to\u00a0change the tooltip appearance (e.g. background and text color) which is specified using CSS properties. In the <a href=\"https:\/\/docs.anychart.com\/Common_Settings\/Tooltip#css_classes\" target=\"_blank\" rel=\"nofollow\">CSS Classes<\/a> section, you can find some examples of these properties and get ideas to apply your own styles.<\/p>\n<p>Here,\u00a0I will modify a CSS property named <code>fontWeight<\/code> to make the text appear\u00a0bolder and, therefore, more distinct. You can either add a number value to this property (e.g. <code>600<\/code>) or use the <code>bold<\/code> keyword:<\/p>\n<pre><code class=\"js\">tooltip.fontWeight(600);<\/code><\/pre>\n<p>3. Let&#8217;s\u00a0do one more modification to add\u00a0some information to\u00a0what is displayed in the tooltip. First, the numbers hidden from the cells\u00a0will be displayed inside of the tooltip, allowing\u00a0people\u00a0interested\u00a0in\u00a0precise\u00a0values to have quick access to them. Second,\u00a0I want to\u00a0include\u00a0range names\u00a0to explain the meaning of numbers.<\/p>\n<p>To add all this info,\u00a0let&#8217;s use an array containing these\u00a0names\u00a0since there is no immediate access to\u00a0them from elsewhere in the code:<\/p>\n<pre><code class=\"js\">var categoryNames = [\"Low\", \"Medium\", \"High\", \"Very High\"]<\/code><\/pre>\n<p>Next,\u00a0I will use conditions for the ranges so that we know which name should go to which cell. To do this,\u00a0I&#8217;ll\u00a0take the heat value and combine it with the ranges from the color scale. Here&#8217;s the code:<\/p>\n<pre><code class=\"js\">tooltip.format(function () {\r\n  if (this.heat &lt;= 0.549) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[0]);\r\n  }\r\n  if (this.heat &gt;= 0.55 &amp;&amp; this.heat &lt;= 0.699) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[1]);\r\n  }\r\n  if (this.heat &gt;= 0.7 &amp;&amp; this.heat &lt;= 0.799) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[2]);\r\n  }\r\n});<\/code><\/pre>\n<p>Take note of the <code>\\n<\/code> symbol in the code. It\u00a0adds a line break.<\/p>\n<p>For your convenience, here is the whole code for the Tooltips section:<\/p>\n<pre><code class=\"js\">var categoryNames = [\"Low\", \"Medium\", \"High\", \"Very High\"]\r\n\r\nvar tooltip = chart.tooltip();\r\ntooltip.fontWeight(600);\r\ntooltip.positionMode(\"point\");        \r\ntooltip.format(function () {\r\n  if (this.heat &lt;= 0.549) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[0]);\r\n  }\r\n  if (this.heat &gt;= 0.55 &amp;&amp; this.heat &lt;= 0.699) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[1]);\r\n  }\r\n  if (this.heat &gt;= 0.7 &amp;&amp; this.heat &lt;= 0.799) {\r\n    return (\"Value: \" + this.heat + \"\\n Category: \" + categoryNames[2]);\r\n  }\r\n});<\/code><\/pre>\n<p>Here is the final version of the JavaScript heat map chart \u2014 check it out on <a href=\"https:\/\/playground.anychart.com\/c7LLDvX1\/2\" target=\"_blank\" rel=\"nofollow\">AnyChart Playground<\/a> where you can play with the code and visualization:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-\" src=\"https:\/\/playground.anychart.com\/c7LLDvX1\/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    var head = document.getElementsByTagName('head')[0];\n    head.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n    var ac_style = document.createElement('style');\n    if (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n    else ac_style.appendChild(document.createTextNode(css));\n    ac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-{width:100%;height:500px;}\");\n})();<\/script><\/p>\n<p>The new\u00a0JS heat map looks more beautiful and informative than the initial chart, doesn&#8217;t it? Now we can clearly see that the world&#8217;s human development in terms of HDI got better over the considered period. Arab States region&#8217;s HDI and East Asia and Pacific region&#8217;s HDI improved from &#8220;medium&#8221; to &#8220;high.&#8221; None of the world regions has yet achieved the \u201cvery high\u201d HDI value range. Sub-Saharan Africa stays in the lowest HDI range. The two regions with the highest HDIs are Europe and Central Asia, and Latin America and the Caribbean. Much better.<\/p>\n<h3>Conclusion<\/h3>\n<p>I hope my tutorial has shown\u00a0that creating interactive JavaScript charts for websites and apps doesn&#8217;t have to be complicated. Using the AnyChart library, you can\u00a0get a good-looking data visualization in a few minutes and then customize it to your needs also with ease.<\/p>\n<p>Visit the <a href=\"https:\/\/docs.anychart.com\/Basic_Charts\/Heat_Map_Chart\" target=\"_blank\" rel=\"nofollow\">gallery of heat maps<\/a> to see more examples and get inspiration for your own creations.<\/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>Want to learn how to quickly create an interactive heat map chart using JavaScript? This data visualization tutorial will guide you through the coding process step by step. Basic knowledge of HTML (HTML5) and some understanding of programming are more than enough to master this charting technique. A heat map (or heatmap chart) is a [&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":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,263,8,23,13,279,4],"tags":[53,260,35,1758,284,127,258,44,471,266,1759,54,1760,844,179,1756,217,215,216,1754,32,55,1757,144,36,907,141,81,57,1755,58,65,56,459,30,172,701,705,706],"class_list":["post-9644","post","type-post","status-publish","format-standard","hentry","category-anychart-charting-component","category-big-data","category-business-intelligence","category-html5","category-javascript","category-javascript-chart-tutorials","category-tips-and-tricks","tag-anychart","tag-best-data-visualization-examples","tag-business-intelligence","tag-chart-design","tag-chart-examples","tag-chart-types","tag-charts","tag-charts-and-art","tag-data-analysis","tag-data-analytics","tag-data-design","tag-data-visualization","tag-data-visualization-design","tag-data-visualization-tutorial","tag-design","tag-hdi","tag-heat-map","tag-heat-map-chart","tag-heatmap","tag-heatmap-chart","tag-html5","tag-html5-charts","tag-human-development-index","tag-infographics","tag-javascript","tag-javascript-chart-tutorial","tag-javascript-charting","tag-javascript-charting-library","tag-javascript-charts","tag-javascript-heat-map","tag-js-chart","tag-js-charting","tag-js-charts","tag-statistics","tag-tips-and-tricks","tag-tutorial","tag-undp","tag-united-nations","tag-united-nations-development-programme","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Heat Map Chart: How to Create and Customize It Using JavaScript<\/title>\n<meta name=\"description\" content=\"Want to learn how to quickly create an interactive heat map chart using JavaScript? My data visualization tutorial will guide you through the coding process\" \/>\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\/2020\/02\/26\/heat-map-chart-create-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Heat Map Chart Using JavaScript\" \/>\n<meta property=\"og:description\" content=\"Want to learn how to quickly create an interactive heat map chart using JavaScript? See this data visualization tutoria!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\" \/>\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=\"2020-02-26T16:54:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T10:20:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\" \/>\n<meta name=\"author\" content=\"Anastasia Zoumpliou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Create Heat Map Chart Using JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"Want to learn how to quickly create an interactive heat map chart using JavaScript? See this data visualization tutoria!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.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=\"Anastasia Zoumpliou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\"},\"author\":{\"name\":\"Anastasia Zoumpliou\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/f5cd0be5c1240a1276a6b36bfeca2bff\"},\"headline\":\"Creating Heat Map Chart Using JavaScript\",\"datePublished\":\"2020-02-26T16:54:50+00:00\",\"dateModified\":\"2022-08-13T10:20:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\"},\"wordCount\":1784,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\",\"keywords\":[\"AnyChart\",\"best data visualization examples\",\"Business Intelligence\",\"chart design\",\"chart examples\",\"chart types\",\"charts\",\"Charts and Art\",\"data analysis\",\"data analytics\",\"data design\",\"Data Visualization\",\"data visualization design\",\"data visualization tutorial\",\"design\",\"HDI\",\"heat map\",\"heat map chart\",\"heatmap\",\"heatmap chart\",\"HTML5\",\"html5 charts\",\"Human Development Index\",\"infographics\",\"JavaScript\",\"javascript chart tutorial\",\"javascript charting\",\"JavaScript charting library\",\"javascript charts\",\"javascript heat map\",\"js chart\",\"js charting\",\"js charts\",\"statistics\",\"Tips and tricks\",\"tutorial\",\"UNDP\",\"United Nations\",\"United Nations Development Programme\"],\"articleSection\":[\"AnyChart Charting Component\",\"Big Data\",\"Business Intelligence\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\",\"name\":\"Heat Map Chart: How to Create and Customize It Using JavaScript\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\",\"datePublished\":\"2020-02-26T16:54:50+00:00\",\"dateModified\":\"2022-08-13T10:20:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/f5cd0be5c1240a1276a6b36bfeca2bff\"},\"description\":\"Want to learn how to quickly create an interactive heat map chart using JavaScript? My data visualization tutorial will guide you through the coding process\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png\",\"width\":1147,\"height\":643},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating Heat Map 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\/f5cd0be5c1240a1276a6b36bfeca2bff\",\"name\":\"Anastasia Zoumpliou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/774bd2dbe4c628607dd7ac40f009135e92ba9ab1027bccf9f63351bca2dd919e?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/774bd2dbe4c628607dd7ac40f009135e92ba9ab1027bccf9f63351bca2dd919e?s=96&r=g\",\"caption\":\"Anastasia Zoumpliou\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/anastasia-zoumpliou\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Heat Map Chart: How to Create and Customize It Using JavaScript","description":"Want to learn how to quickly create an interactive heat map chart using JavaScript? My data visualization tutorial will guide you through the coding process","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\/2020\/02\/26\/heat-map-chart-create-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Heat Map Chart Using JavaScript","og_description":"Want to learn how to quickly create an interactive heat map chart using JavaScript? See this data visualization tutoria!","og_url":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2020-02-26T16:54:50+00:00","article_modified_time":"2022-08-13T10:20:45+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","type":"","width":"","height":""}],"author":"Anastasia Zoumpliou","twitter_card":"summary_large_image","twitter_title":"How to Create Heat Map Chart Using JavaScript","twitter_description":"Want to learn how to quickly create an interactive heat map chart using JavaScript? See this data visualization tutoria!","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Anastasia Zoumpliou","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/"},"author":{"name":"Anastasia Zoumpliou","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/f5cd0be5c1240a1276a6b36bfeca2bff"},"headline":"Creating Heat Map Chart Using JavaScript","datePublished":"2020-02-26T16:54:50+00:00","dateModified":"2022-08-13T10:20:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/"},"wordCount":1784,"commentCount":1,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","keywords":["AnyChart","best data visualization examples","Business Intelligence","chart design","chart examples","chart types","charts","Charts and Art","data analysis","data analytics","data design","Data Visualization","data visualization design","data visualization tutorial","design","HDI","heat map","heat map chart","heatmap","heatmap chart","HTML5","html5 charts","Human Development Index","infographics","JavaScript","javascript chart tutorial","javascript charting","JavaScript charting library","javascript charts","javascript heat map","js chart","js charting","js charts","statistics","Tips and tricks","tutorial","UNDP","United Nations","United Nations Development Programme"],"articleSection":["AnyChart Charting Component","Big Data","Business Intelligence","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/","url":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/","name":"Heat Map Chart: How to Create and Customize It Using JavaScript","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","datePublished":"2020-02-26T16:54:50+00:00","dateModified":"2022-08-13T10:20:45+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/f5cd0be5c1240a1276a6b36bfeca2bff"},"description":"Want to learn how to quickly create an interactive heat map chart using JavaScript? My data visualization tutorial will guide you through the coding process","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2020\/02\/heat-map-chart.png","width":1147,"height":643},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2020\/02\/26\/heat-map-chart-create-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Creating Heat Map 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\/f5cd0be5c1240a1276a6b36bfeca2bff","name":"Anastasia Zoumpliou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/774bd2dbe4c628607dd7ac40f009135e92ba9ab1027bccf9f63351bca2dd919e?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/774bd2dbe4c628607dd7ac40f009135e92ba9ab1027bccf9f63351bca2dd919e?s=96&r=g","caption":"Anastasia Zoumpliou"},"url":"https:\/\/www.anychart.com\/blog\/author\/anastasia-zoumpliou\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/9644","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\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=9644"}],"version-history":[{"count":37,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/9644\/revisions"}],"predecessor-version":[{"id":9709,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/9644\/revisions\/9709"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=9644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=9644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=9644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}