{"id":12083,"date":"2021-02-03T16:27:22","date_gmt":"2021-02-03T16:27:22","guid":{"rendered":"https:\/\/www.anychart.com\/blog\/?p=12083"},"modified":"2022-08-13T11:16:26","modified_gmt":"2022-08-13T11:16:26","slug":"angular-gauge-javascript","status":"publish","type":"post","link":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/","title":{"rendered":"Creating JavaScript Angular Gauge"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png\" alt=\"Angular gauge in JavaScript on a laptop screen visualizing Grammys Record of the Year nominee songs popularity based on Spotify data\" width=\"100%\" class=\"alignnone size-full wp-image-12110\" srcset=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png 1200w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog-300x179.png 300w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog-768x457.png 768w, https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog-1024x609.png 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>Would you like to add\u00a0another really cool and interesting chart to your <a href=\"https:\/\/www.anychart.com\/blog\/2018\/11\/20\/data-visualization-definition-history-examples\/\">data visualization<\/a> portfolio? Follow this simple tutorial\u00a0and you&#8217;ll learn <strong>how to create a beautiful and interactive\u00a0Angular Gauge using JavaScript<\/strong>, with ease!<\/p>\n<p>An Angular Gauge, also\u00a0<a href=\"https:\/\/www.anychart.com\/chartopedia\/chart-type\/circular-gauge\/\">known<\/a> as a Circular Gauge, is a type of\u00a0gauge chart with a radial scale. Such visualizations\u00a0can nicely show a value within a range and are widely used in\u00a0various dashboards.<\/p>\n<p>The recent good news of vaccines feels like music to our ears. So, I\u00a0thought why not take some interesting music data for visualization in this tutorial! The 63rd annual Grammy Awards\u00a0ceremony\u00a0will be held in March 2021, and when I looked through the\u00a0list of the Record of the Year nominees, I\u00a0wondered how popular each of these songs is. To find out, I decided to look at the number of their streams on Spotify, one of the world&#8217;s leading music streaming platforms, and thought that a Solid Angular Gauge could work well in such a visual analysis. It also\u00a0resembles\u00a0a vinyl record, which makes it\u00a0an especially interesting chart\u00a0type to opt for when representing such data!<\/p>\n<p>So, along the tutorial, I will be <strong>visualizing Spotify stream counts\u00a0for each\u00a02021 GRAMMYs Record of the Year nominee song<\/strong> in<strong>\u00a0a JS Angular Gauge chart<\/strong>. That is going to be entertaining!\u00a0All aboard!<\/p>\n<p><!--more Read the JS charting tutorial \u00bb--><\/p>\n<h2>Spoiler:\u00a0Angular Gauge To Be\u00a0Developed<\/h2>\n<p>Before we get down to the process, check out how the final interactive JavaScript angular gauge chart will look:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/angular-gauge-js.gif\" alt=\"JavaScript angular gauge for HTML5 web\" width=\"82%\" class=\"alignnone size-full wp-image-12108\" \/><\/p>\n<h2>How to Build JS\u00a0Angular Gauge in 4\u00a0Basic\u00a0Steps<\/h2>\n<p>Skills with\u00a0web development and technologies like HTML and JavaScript are always helpful\u00a0in interactive data visualization. But in fact, here you don&#8217;t even need much technical knowledge and experience. The thing is, creating JS angular gauges\u00a0for\u00a0a web site or app is not rocket science.<\/p>\n<p>Basically, there are 4 fundamental steps to build an angular gauge using JavaScript:<\/p>\n<ol>\n<li>Create an HTML page.<\/li>\n<li>Include the necessary JavaScript files.<\/li>\n<li>Connect the data.<\/li>\n<li>Write the JS code for the chart.<\/li>\n<\/ol>\n<h3>1. Create a basic HTML page<\/h3>\n<p>The first thing to do is\u00a0to make an HTML page where the\u00a0angular gauge visualization will be rendered.<\/p>\n<p>We add a <code>div<\/code> element to hold the chart and\u00a0provide it with an id to\u00a0properly reference this <code>div<\/code> later.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Angular Gauge&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;  \r\n    &lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>Here, the <code>div<\/code> block element is given a width and height of 100% to make the\u00a0gauge chart\u00a0appear full screen. But it can be customized according to your requirements, of course.<\/p>\n<h3>2. Include the necessary JavaScript files<\/h3>\n<p>The second step\u00a0is about referencing the necessary scripts you are going to use, in the &lt;head&gt; section.<\/p>\n<p>Some\u00a0of the\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_libraries\" target=\"_blank\" rel=\"nofollow\">JavaScript charting libraries <\/a>can make it really easy to create stunning graphics and diagrams visualizing data without much difficulty. In this tutorial, I am using <a href=\"https:\/\/www.anychart.com\/\">AnyChart<\/a> which is a lightweight, flexible, and easy-to-use JavaScript\u00a0charting library. It supports angular gauges out of the box and\u00a0has extensive <a href=\"https:\/\/docs.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">documentation<\/a>. In addition, AnyChart JS\u00a0provides a\u00a0cool\u00a0<a href=\"https:\/\/playground.anychart.com\/\" target=\"_blank\" rel=\"nofollow\">code playground<\/a> for testing out things.<\/p>\n<p>So, let&#8217;s include the\u00a0necessary files from\u00a0this library&#8217;s\u00a0<a href=\"https:\/\/www.anychart.com\/download\/cdn\/\">CDN<\/a>. To create an angular gauge, we need to add\u00a0the\u00a0<a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#core\" target=\"_blank\" rel=\"nofollow\">core module<\/a> that is required for all types of charts and\u00a0the\u00a0<a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Modules#circular_gauge\" target=\"_blank\" rel=\"nofollow\">specific module for angular gauges<\/a>.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Venn Diagram&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-circular-gauge.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;  \r\n\u00a0\u00a0\u00a0\u00a0&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ All the code for the angular gauge chart will come here\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/script&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h3>3. Prepare and connect the data<\/h3>\n<p>Step three is about data.<\/p>\n<p>I created the data for this visualization manually by collating what I wanted from the official sources of the <a href=\"https:\/\/www.grammy.com\/grammys\/news\/2021-grammys-complete-nominees-list#general\" target=\"_blank\" rel=\"nofollow\">Grammys<\/a> website and\u00a0the\u00a0<a href=\"https:\/\/www.spotify.com\/\" target=\"_blank\" rel=\"nofollow\">Spotify<\/a> app. I included the Song name, Artist name, Number of Spotify Streams, and Duration of each song.<\/p>\n<p>I then sorted the data in descending order based on the number of streams and added a percentage field. The highest streamed record was given 100% and the percentage for the following records was calculated in comparison to the highest streamed record.<\/p>\n<p>Finally, I created a JSON file which you can download <a href=\"https:\/\/gist.githubusercontent.com\/shacheeswadia\/9e4598a73bb86180f1726daf9de8062f\/raw\/b258e93e1f9db37da6847eb05a230afcb64446d5\/circularGaugeData.json\" target=\"_blank\" rel=\"nofollow\">here<\/a>.<\/p>\n<p>Loading the JSON\u00a0data in AnyChart can be done with the help of the <a href=\"https:\/\/docs.anychart.com\/Working_with_Data\/Data_Adapter\/Overview\" target=\"_blank\" rel=\"nofollow\">Data Adapter<\/a>, an additional helpful script available through the dedicated module. Let&#8217;s reference\u00a0it\u00a0along with all the JS scripts in\u00a0<code>&lt;head&gt;<\/code>.<\/p>\n<p>Next, we use the <code>loadJsonFile<\/code> method inside the <code>&lt;script&gt;<\/code> tag in the body of our HTML page to load\u00a0the\u00a0JSON file.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Angular Gauge&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-circular-gauge.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;  \r\n\u00a0\u00a0\u00a0\u00a0&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0anychart.data.loadJsonFile('<em><strong>{JSON data file location here}<\/strong><\/em>', function (data) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ The angular gauge's JS code will come here\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0});\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/script&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>Now that we have all the preliminary steps taken care of, let\u2019s amp up our excitement and start adding the code to\u00a0visualize the\u00a0data in\u00a0an interactive\u00a0JS-based\u00a0angular\u00a0gauge!<\/p>\n<h3>4. Add\u00a0the JS code for the gauge<\/h3>\n<p>To build any\u00a0JS chart\u00a0or gauge, it is necessary to add a function enclosing all the code, which\u00a0will make sure that the entire code inside\u00a0of it will only execute once the page is ready.<\/p>\n<p>The\u00a0solid angular gauge\u00a0we are creating right now is slightly more complicated to build than other chart types like a\u00a0<a href=\"https:\/\/www.anychart.com\/blog\/2017\/10\/25\/javascript-bar-chart-tutorial\/\">bar<\/a>, <a href=\"https:\/\/www.anychart.com\/blog\/2017\/12\/06\/pie-chart-create-javascript\/\">pie<\/a>, or <a href=\"https:\/\/www.anychart.com\/blog\/2017\/10\/28\/create-javascript-area-chart\/\">area<\/a>\u00a0chart. But, do not worry as all the code is commented and I will also\u00a0guide you through the code snippets. In case it still feels confusing, just follow the steps and you will be able to drum up a lovely chart in no time. Ask questions if any, in the\u00a0post comments.<\/p>\n<p>To begin with, we extract the data values required for the radial bars, create the\u00a0angular gauge, and pass the extracted data to the chart.<\/p>\n<pre><code class=\"html\">&lt;script&gt;\r\n\r\n  anychart.onDocumentReady(function () {\r\n\r\n    anychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/shacheeswadia\/9e4598a73bb86180f1726daf9de8062f\/raw\/b258e93e1f9db37da6847eb05a230afcb64446d5\/circularGaugeData.json', function (data) {\r\n\r\n      \/\/ Get the names of the records \r\n      var recordNames = data.map(function(d){\r\n        return d.Record;\r\n      });\r\n\r\n      \/\/ Get the percent values\r\n      var recordPercentValue = data.map(function(d){\r\n        return d.percent;\r\n      });\r\n\r\n      \/\/ Add the 100% value to signify the max value for each of the radial ring\r\n      recordPercentValue.push(100);\r\n\r\n      \/\/ Set the data to indicate the percent values\r\n      var dataSet = anychart.data.set(recordPercentValue);\r\n\r\n      \/\/ Create the angular gauge\r\n      var gauge = anychart.gauges.circular();\r\n\r\n      \/\/ Set the data for the angular gauge\r\n      gauge.data(dataSet);\r\n\r\n    });\r\n\r\n\u00a0\u00a0});\r\n\r\n&lt;\/script&gt;\r\n<\/code><\/pre>\n<p>I want each data point to\u00a0have a different color. So, let&#8217;s up a color palette. Initially, we\u00a0can use the <a href=\"https:\/\/api.anychart.com\/v8\/anychart.palettes#defaultPalette\" target=\"_blank\" rel=\"nofollow\">default<\/a> colors\u00a0of the AnyChart JavaScript charting library.<\/p>\n<p>Next, we specify the attributes of the gauge and create the axis. I do not want to show the axis labels and ticks so\u00a0let&#8217;s hide those.<\/p>\n<pre><code class=\"javascript\">\/\/ Set the colors based on the default palette\r\nvar palette = anychart.palettes\r\n  .distinctColors()\r\n  .items([\r\n    '#64b5f6', '#1976d2', '#ef6c00', '#ffd54f', '#455a64', '#dd2c00', '#00838f', '#00bfa5', '#96a6a6', '#ffa000'\r\n  ]);\r\n\r\n\/\/ Specify the attributes of the angular gauge chart\r\ngauge\r\n  .fill('#fff')\r\n  .stroke(null)\r\n  .padding(25, 100, 25, 100)\r\n  .margin(0)\r\n  .startAngle(0)\r\n  .sweepAngle(270);\r\n\r\n\/\/ Create the angular gauge axis\r\nvar axis = gauge.axis().radius(100).width(1).fill(null);\r\n\r\n\/\/ Set the minimum and maximum values for the axis\r\naxis\r\n  .scale()\r\n  .minimum(0)\r\n  .maximum(100);\r\n\r\n\/\/ Hide the axis labels and ticks\r\naxis.labels().enabled(false);\r\naxis.ticks().enabled(false);\r\naxis.minorTicks().enabled(false);\r\n<\/code><\/pre>\n<p>Now comes the main part of creating the radial bars of the angular gauge. We create a function that accepts the gauge, index of each radial bar along with the radius, and the width of the radial bar as the parameters. We then\u00a0build each bar based on the data point and also a background radial bar of each of those points.<\/p>\n<p>Next, we set up the labels and align them to correspond to each radial bar. The last thing in the function is to return a gauge for each of the data points.<\/p>\n<pre><code class=\"javascript\">\/\/ Create a function to make radial bars for each data point\r\nvar makeBarWithBar = function (gauge, radius, i, width) {\r\n\r\n  \/\/ Create the radial bars based on the data\r\n  gauge\r\n    .bar(i)\r\n    .dataIndex(i)\r\n    .radius(radius)\r\n    .width(width)\r\n    .fill(palette.itemAt(i))\r\n    .stroke(null)\r\n    .zIndex(5);\r\n\r\n  \/\/ Create the background radial bars indicating the total value\r\n  gauge\r\n    .bar(i + 100)\r\n    .dataIndex(8)\r\n    .radius(radius)\r\n    .width(width)\r\n    .fill('#F5F4F4')\r\n    .stroke(null)\r\n    .zIndex(4);\r\n\r\n  \/\/ Set the labels based on each data point\r\n  gauge\r\n    .label(i)\r\n    .text(recordNames[i]);\r\n\r\n  \/\/ Align the labels \r\n  gauge\r\n    .label(i)\r\n    .hAlign('center')\r\n    .vAlign('middle')\r\n    .anchor('right-center')\r\n    .padding(0, 10)\r\n    .height(width \/ 2 + '%')\r\n    .offsetY(radius + '%')\r\n    .offsetX(0);\r\n\r\n  return gauge.bar(i);\r\n\r\n};\r\n<\/code><\/pre>\n<p>Now that the function is created, we call the function for each of the data points that we have. In total, there are 8 data points. So we call the function 8 times. The radius values are 100 divided by the number of data points, and I keep the width of each bar as 11.<\/p>\n<pre><code class=\"javascript\">\/\/ Call the function to create the radial bars with specifications\r\nmakeBarWithBar(gauge, 100, 0, 11);\r\nmakeBarWithBar(gauge, 87.5, 1, 11);\r\nmakeBarWithBar(gauge, 75, 2, 11);\r\nmakeBarWithBar(gauge, 62.5, 3, 11);\r\nmakeBarWithBar(gauge, 50, 4, 11);\r\nmakeBarWithBar(gauge, 37.5, 5, 11);\r\nmakeBarWithBar(gauge, 25, 6, 11);\r\nmakeBarWithBar(gauge, 12.5, 7, 11);\r\n<\/code><\/pre>\n<p>We then add a title to the chart. Finally, we reference the <code>div<\/code> container and draw our angular gauge.<\/p>\n<pre><code class=\"javascript\">\/\/ Add the angular gauge chart title\r\ngauge.title('Comparing Popularity of 2021 GRAMMYs Record of the Year Nominations on Spotify');\r\n\r\n\/\/ Drawing the resulting angular gauge\r\ngauge.container('container');\r\ngauge.draw();\r\n<\/code><\/pre>\n<p>There you have it &#8211; a fully functional and cool\u00a0JavaScript-based\u00a0Angular Gauge is ready! Or you can call it a Circular Gauge or a Radial Gauge &#8211; whichever you prefer.<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-tS422T7p\" src=\"https:\/\/playground.anychart.com\/tS422T7p\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-tS422T7p{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>We can clearly see from our Angular Gauge that there is quite a huge difference in the popularity of these tracks. Dua Lipa\u2019s &#8220;Don\u2019t Start Now&#8221; is the most-streamed song from the list of the 2021 Grammys Record\u00a0of\u00a0the Year nominees with a whooping 1.26 billion streams\u00a0on Spotify,\u00a0closely followed by Post Malone\u2019s &#8220;Circles&#8221; with 1.24 billion streams. These two are\u00a0the definite leaders by this parameter. Does it mean one of them will win? Hmm&#8230;\u00a0(Not necessarily, you know.)<\/p>\n<p>The song &#8220;Colors&#8221; by Black Pumas does have an impressive\u00a0total of 36 million streams but ends up as the least-streamed song in this group.<\/p>\n<p>Have a look at this initial version of the Angular Gauge with the full JS\/CSS\/HTML code on\u00a0<a href=\"https:\/\/playground.anychart.com\/tS422T7p\/\" target=\"_blank\" rel=\"nofollow\">Playground<\/a> or\u00a0<a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/qBaKpMW\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/p>\n<h2>JavaScript Angular Gauge Customization<\/h2>\n<p>Robust JavaScript libraries\u00a0for data visualization not only simplify chart creation but also provide flexibility to make customizations. With a few code tweaks, we can make some quick and effective changes to our circular graphic.<\/p>\n<p>Let us look at some different functionalities and aesthetics for\u00a0the\u00a0angular\u00a0gauge.<\/p>\n<h3>Change\u00a0the color palette<\/h3>\n<p>Since our data is about Grammys nominations, I decided to\u00a0use the colors resembling the gilded gramophone trophies\u00a0and introduce\u00a0the corresponding\u00a0palette. We have already created a palette with distinct colors, so\u00a0let&#8217;s just replace the default colors with the new ones.<\/p>\n<pre><code class=\"javascript\">\/\/ Set the colors based on the designated palette\r\nvar palette = anychart.palettes\r\n  .distinctColors()\r\n  .items([\r\n    '#593d04', '#6c4304', '#966905', '#a77b0a', '#cf9f20', '#ddb22e', '#f1c84d', '#ffdc73'\r\n  ]);\r\n<\/code><\/pre>\n<p>See how the chart looks much more personalized\u00a0&#8211; here&#8217;s\u00a0the\u00a0Angular Gauge\u00a0built with JS, now with these modifications:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-rD5NeHdt\" src=\"https:\/\/playground.anychart.com\/rD5NeHdt\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-rD5NeHdt{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>Check it out on <a href=\"https:\/\/playground.anychart.com\/rD5NeHdt\/\" target=\"_blank\" rel=\"nofollow\">Playground<\/a> or <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/WNGyyWW\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/p>\n<h3>Set a\u00a0custom\u00a0bar\u00a0sizing<\/h3>\n<p>Now, let&#8217;s experiment a bit with the radial bars and add some more information to the current chart.<\/p>\n<p>For example, we can make the width of each bar represent the song duration.<\/p>\n<p>To do that, we need to extract the duration of each song from the data and then create a loop that makes the width of each bar correspond to the duration of that data point.<\/p>\n<pre><code class=\"javascript\">\/\/ Get the time of each song\r\nvar recordLength = data.map(function(d){\r\n  return d['Time'];\r\n});\r\n\r\n\/\/ Call the function to create the radial bars with specifications\r\nfor(var i=0, j=100; i&lt;data.length, j&gt;=12.5; i++, j-=12.5){\r\n  makeBarWithBar(gauge, j, i, (recordLength[i]* 2.75));\r\n}\r\n<\/code><\/pre>\n<p>Check out how the variation looks:<\/p>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-lLNC4CH0\" src=\"https:\/\/playground.anychart.com\/lLNC4CH0\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-lLNC4CH0{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>You can find this version with the entire code on <a href=\"https:\/\/playground.anychart.com\/lLNC4CH0\/\" target=\"_blank\" rel=\"nofollow\">Playground<\/a> or <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/WNGyYEb\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/p>\n<p>Ultimately I did not find it very insightful and reverted to the version with a fixed width for each bar. I did keep the loop though since that reduces\u00a0the amount of the code and is a better way of calling the function repeatedly.<\/p>\n<h3>Improve the design of the angular gauge tooltip and other formatting<\/h3>\n<p>The\u00a0JavaScript\u00a0angular\u00a0gauge\u00a0we&#8217;ve made already\u00a0looks great. All we\u00a0may need are\u00a0some finishing touches.<\/p>\n<p>Let\u2019s design a good-looking\u00a0and informative tooltip.<\/p>\n<p>To start with, please note changes here:<\/p>\n<pre><code class=\"javascript\">\/\/ Add the 100% value to signify the max value for each of the radial ring\r\nvar initialLength = recordPercentValue.length;\r\nrecordPercentValue.length *= 2;\r\nrecordPercentValue.fill(100, initialLength);\r\n\r\n...\r\n\r\n\/\/ Create the background radial bars indicating the total value\r\ngauge\r\n  .bar(i + 100)\r\n  .dataIndex(initialLength + I)\r\n  .radius(radius)\r\n  .width(width)\r\n  .fill('#F5F4F4')\r\n  .stroke(null)\r\n  .zIndex(4);\r\n<\/code><\/pre>\n<p>And we add the following part:<\/p>\n<pre><code class=\"javascript\">\/\/ Angular gauge tooltip\r\ngauge.tooltip().useHtml(true);\r\n \r\n\/\/ Format the information of the tooltip\r\ngauge\r\n  .tooltip()\r\n  .format(function(){\r\n    var index = this.index;\r\n    if (index &gt;= initialLength)\r\n    index -= initialLength;\r\n    return \"&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Record: &lt;span style='color:#fff;'&gt;\" + data[index]['Record'] + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Artist: &lt;span style='color:#fff;'&gt;\" + data[index]['Artist'] + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Number of Spotify Streams: &lt;span style='color:#fff;'&gt;\" + Intl.NumberFormat().format(data[index]['StreamsSpotify']) + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Comparitive Popularity: &lt;span style='color:#fff;'&gt;\" + data[index]['percent'] + \"%&lt;\/span&gt;&lt;\/div&gt;\";\r\n  });\r\n<\/code><\/pre>\n<p>Lastly, that should\u00a0be great to beautify the title with larger fonts\u00a0and apply some color changes to highlight\u00a0exactly what we are showing:<\/p>\n<pre><code class=\"javascript\">\/\/ Add the angular gauge chart title\r\ngauge\r\n  .title()\r\n  .useHtml(true)\r\n  .text(\r\n    '&lt;span style = \"color: #4c2b04; font-size:20px;\"&gt;Comparing Popularity of 2021 GRAMMYs Record of the Year Nominations&lt;\/span&gt;' +\r\n    '&lt;br\/&gt;&lt;span style=\"color:#1db954; font-size: 18px;\"&gt;(Based on the number of Spotify Streams)&lt;\/span&gt;'\r\n  );\r\n<\/code><\/pre>\n<p><iframe loading=\"lazy\" class=\"anychart-embed anychart-embed-Q6OseQ30\" src=\"https:\/\/playground.anychart.com\/Q6OseQ30\/iframe\" width=\"300\" height=\"150\" frameborder=\"0\" sandbox=\"allow-scripts allow-pointer-lock allow-same-origin allow-popups allow-modals allow-forms\" allowfullscreen=\"allowfullscreen\"><br \/>\n<\/iframe><br \/>\n<script type=\"text\/javascript\">(function(){\nfunction ac_add_to_head(el){\n\tvar head = document.getElementsByTagName('head')[0];\n\thead.insertBefore(el,head.firstChild);\n}\nfunction ac_add_style(css){\n\tvar ac_style = document.createElement('style');\n\tif (ac_style.styleSheet) ac_style.styleSheet.cssText = css;\n\telse ac_style.appendChild(document.createTextNode(css));\n\tac_add_to_head(ac_style);\n}\nac_add_style(\".anychart-embed-Q6OseQ30{width:100%;height:600px;}\");\n})();<\/script><\/p>\n<p>You can find the full source code for this\u00a0final Angular Gauge here\u00a0below as well as look into it and play with it\u00a0on <a href=\"https:\/\/playground.anychart.com\/Q6OseQ30\/\" target=\"_blank\" rel=\"nofollow\">Playground<\/a> or on <a href=\"https:\/\/codepen.io\/shacheeswadia\/pen\/WNGyYXb\" target=\"_blank\" rel=\"nofollow\">CodePen<\/a>.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\u00a0\u00a0&lt;head&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;title&gt;JavaScript Angular Gauge&lt;\/title&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-core.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-circular-gauge.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script src=\"https:\/\/cdn.anychart.com\/releases\/8.9.0\/js\/anychart-data-adapter.min.js\"&gt;&lt;\/script&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;style type=\"text\/css\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0html,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0body,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#container {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0width: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0height: 100%;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0margin: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0padding: 0;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/style&gt;\r\n\u00a0\u00a0&lt;\/head&gt;\r\n\u00a0\u00a0&lt;body&gt;  \r\n\u00a0\u00a0\u00a0\u00a0&lt;div id=\"container\"&gt;&lt;\/div&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;script&gt;\r\n\r\nanychart.onDocumentReady(function () {\r\n\r\nanychart.data.loadJsonFile('https:\/\/gist.githubusercontent.com\/shacheeswadia\/9e4598a73bb86180f1726daf9de8062f\/raw\/b258e93e1f9db37da6847eb05a230afcb64446d5\/circularGaugeData.json', function (data) {\r\n\r\n  \/\/ Get the names of the records \r\n  var recordNames = data.map(function(d){\r\n    return d.Record;\r\n  });\r\n\r\n  \/\/ Get the percent values\r\n  var recordPercentValue = data.map(function(d){\r\n    return d.percent;\r\n  });\r\n\r\n  \/\/ Add the 100% value to signify the max value for each of the radial ring\r\n  var initialLength = recordPercentValue.length;\r\n  recordPercentValue.length *= 2;\r\n  recordPercentValue.fill(100, initialLength);\r\n\r\n  \/\/ Set the data to indicate the percent values\r\n  var dataSet = anychart.data.set(recordPercentValue);\r\n\r\n  \/\/ Create the angular gauge\r\n  var gauge = anychart.gauges.circular();\r\n\r\n  \/\/ Set the data for the angular gauge\r\n  gauge.data(dataSet);\r\n \r\n  \/\/ Set the colors based on the designated palette\r\n  var palette = anychart.palettes\r\n    .distinctColors()\r\n    .items([\r\n      '#593d04', '#6c4304', '#966905', '#a77b0a', '#cf9f20', '#ddb22e', '#f1c84d', '#ffdc73'\r\n  ]);\r\n\r\n  \/\/ Specify the attributes of the angular gauge chart\r\n  gauge\r\n    .fill('#fff')\r\n    .stroke(null)\r\n    .padding(25, 100, 25, 100)\r\n    .margin(0)\r\n    .startAngle(0)\r\n    .sweepAngle(270);\r\n\r\n  \/\/ Create the angular gauge axis\r\n  var axis = gauge.axis().radius(100).width(1).fill(null);\r\n\r\n  \/\/ Set the minimum and maximum values for the axis\r\n  axis\r\n    .scale()\r\n    .minimum(0)\r\n    .maximum(100);\r\n\r\n  \/\/ Hide the axis labels and ticks\r\n  axis.labels().enabled(false);\r\n  axis.ticks().enabled(false);\r\n  axis.minorTicks().enabled(false);\r\n\r\n  \/\/ Create a function to make radial bars for each data point\r\n  var makeBarWithBar = function (gauge, radius, i, width) {\r\n\r\n    \/\/ Create the radial bars based on the data\r\n    gauge\r\n      .bar(i)\r\n      .dataIndex(i)\r\n      .radius(radius)\r\n      .width(width)\r\n      .fill(palette.itemAt(i))\r\n      .stroke(null)\r\n      .zIndex(5);\r\n\r\n    \/\/ Create the background radial bars indicating the total value\r\n    gauge\r\n      .bar(i + 100)\r\n      .dataIndex(initialLength + i)\r\n      .radius(radius)\r\n      .width(width)\r\n      .fill('#F5F4F4')\r\n      .stroke(null)\r\n      .zIndex(4);\r\n\r\n    \/\/ Set the labels based on each data point\r\n    gauge\r\n      .label(i)\r\n      .text(recordNames[i]);\r\n\r\n    \/\/ Align the labels \r\n    gauge\r\n      .label(i)\r\n      .hAlign('center')\r\n      .vAlign('middle')\r\n      .anchor('right-center')\r\n      .padding(0, 10)\r\n      .height(width \/ 2 + '%')\r\n      .offsetY(radius + '%')\r\n      .offsetX(0);\r\n\r\n    return gauge.bar(i);\r\n\r\n  };\r\n\r\n  \/\/ Angular gauge tooltip\r\n  gauge.tooltip().useHtml(true);\r\n \r\n  \/\/ Format the information of the tooltip\r\n  gauge\r\n    .tooltip()\r\n    .format(function(){\r\n      var index = this.index;\r\n      if (index &gt;= initialLength)\r\n      index -= initialLength;\r\n      return \"&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Record: &lt;span style='color:#fff;'&gt;\" + data[index]['Record'] + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Artist: &lt;span style='color:#fff;'&gt;\" + data[index]['Artist'] + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Number of Spotify Streams: &lt;span style='color:#fff;'&gt;\" + Intl.NumberFormat().format(data[index]['StreamsSpotify']) + \"&lt;\/span&gt;&lt;\/div&gt;&lt;div style='font-size:15px; font-weight:400; margin: 0.2rem 0; color: #1db954; padding:0.15rem'&gt;Comparitive Popularity: &lt;span style='color:#fff;'&gt;\" + data[index]['percent'] + \"%&lt;\/span&gt;&lt;\/div&gt;\";\r\n    }); \r\n\r\n  \/\/ Call the function to create the radial bars with specifications\r\n  for(var i=0, j=100; i&lt;data.length, j&gt;=12.5; i++, j-=12.5){\r\n    makeBarWithBar(gauge, j, i, 12);\r\n  }\r\n\r\n  \/\/ Add the angular gauge chart title\r\n  gauge\r\n    .title()\r\n    .useHtml(true)\r\n    .text(\r\n      '&lt;span style = \"color: #4c2b04; font-size:20px;\"&gt;Comparing Popularity of 2021 GRAMMYs Record of the Year Nominations&lt;\/span&gt;' +\r\n      '&lt;br\/&gt;&lt;span style=\"color:#1db954; font-size: 18px;\"&gt;(Based on the number of Spotify Streams)&lt;\/span&gt;'\r\n    );\r\n\r\n  gauge\r\n    .title()\r\n    .enabled(true)\r\n    .hAlign('center')\r\n    .padding(0)\r\n    .margin([0, 0, 10, 0]);\r\n \r\n  \/\/ Drawing the resulting angular gauge\r\n  gauge.container('container');\r\n  gauge.draw();\r\n\r\n\u00a0 });\r\n\r\n});\r\n\r\n\u00a0\u00a0\u00a0\u00a0&lt;\/script&gt;\r\n\u00a0\u00a0&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>In this step-by-step tutorial, I have shown you in detail how to create a compelling Angular Gauge with JavaScript (HTML5). As you can see, creating interactive JS charts is easy.<\/p>\n<p>You can try out other JavaScript charting libraries and gauge their capability in creating the\u00a0data visualizations you need. Or you can check out various other <a href=\"https:\/\/docs.anychart.com\/Quick_Start\/Supported_Charts_Types\" target=\"_blank\" rel=\"nofollow\">chart options<\/a> provided by AnyChart. For inspiration, you might like to visit the library&#8217;s <a href=\"https:\/\/www.anychart.com\/products\/anychart\/gallery\/\">gallery for basic chart types.<\/a>\u00a0Please feel free to ask me any questions or let me know how your JS\u00a0gauge turned out.<\/p>\n<p>Wishing you a healthy, musical, and visual 2021!<\/p>\n<hr \/>\n<p><em>We at AnyChart are glad to thank Shachee Swadia, an experienced data designer, for creating this amazing tutorial.<\/p>\n<p>If you want to write a compelling guest post for our blog, <a href=\"https:\/\/www.anychart.com\/support\/\">get in touch<\/a>.<\/em><\/p>\n<hr \/>\n<p><em>Check out other <a href=\"https:\/\/www.anychart.com\/blog\/category\/javascript-chart-tutorials\/\">JavaScript charting tutorials<\/a>.<\/em><\/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>Would you like to add\u00a0another really cool and interesting chart to your data visualization portfolio? Follow this simple tutorial\u00a0and you&#8217;ll learn how to create a beautiful and interactive\u00a0Angular Gauge using JavaScript, with ease! An Angular Gauge, also\u00a0known as a Circular Gauge, is a type of\u00a0gauge chart with a radial scale. Such visualizations\u00a0can nicely show 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":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,23,13,279,4],"tags":[224,53,127,258,223,471,266,620,54,256,130,145,220,219,32,55,144,36,141,81,57,58,65,56,459,30,172],"class_list":["post-12083","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-angular-gauges","tag-anychart","tag-chart-types","tag-charts","tag-circular-gauges","tag-data-analysis","tag-data-analytics","tag-data-analytics-examples","tag-data-visualization","tag-data-visualization-examples","tag-data-visualization-weekly","tag-dataviz-weekly","tag-gauge-charts","tag-gauges","tag-html5","tag-html5-charts","tag-infographics","tag-javascript","tag-javascript-charting","tag-javascript-charting-library","tag-javascript-charts","tag-js-chart","tag-js-charting","tag-js-charts","tag-statistics","tag-tips-and-tricks","tag-tutorial","wpautop"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Angular Gauge &amp; How to Create This Data Visualization Using JavaScript<\/title>\n<meta name=\"description\" content=\"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-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 an Angular Gauge with JavaScript\" \/>\n<meta property=\"og:description\" content=\"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-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=\"2021-02-03T16:27:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-13T11:16:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-social.png\" \/>\n<meta name=\"author\" content=\"Shachee Swadia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Create an Angular Gauge with JavaScript\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-twitter.png\" \/>\n<meta name=\"twitter:creator\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:site\" content=\"@AnyChart\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shachee Swadia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/\"},\"author\":{\"name\":\"Shachee Swadia\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"headline\":\"Creating JavaScript Angular Gauge\",\"datePublished\":\"2021-02-03T16:27:22+00:00\",\"dateModified\":\"2022-08-13T11:16:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/\"},\"wordCount\":1772,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png\",\"keywords\":[\"angular gauges\",\"AnyChart\",\"chart types\",\"charts\",\"circular gauges\",\"data analysis\",\"data analytics\",\"data analytics examples\",\"Data Visualization\",\"data visualization examples\",\"data visualization weekly\",\"dataviz weekly\",\"gauge charts\",\"gauges\",\"HTML5\",\"html5 charts\",\"infographics\",\"JavaScript\",\"javascript charting\",\"JavaScript charting library\",\"javascript charts\",\"js chart\",\"js charting\",\"js charts\",\"statistics\",\"Tips and tricks\",\"tutorial\"],\"articleSection\":[\"AnyChart Charting Component\",\"HTML5\",\"JavaScript\",\"JavaScript Chart Tutorials\",\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/\",\"url\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/\",\"name\":\"Angular Gauge & How to Create This Data Visualization Using JavaScript\",\"isPartOf\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png\",\"datePublished\":\"2021-02-03T16:27:22+00:00\",\"dateModified\":\"2022-08-13T11:16:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\"},\"description\":\"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage\",\"url\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png\",\"contentUrl\":\"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png\",\"width\":1200,\"height\":714},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.anychart.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating JavaScript Angular Gauge\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#website\",\"url\":\"https:\/\/www.anychart.com\/blog\/\",\"name\":\"AnyChart News\",\"description\":\"AnyChart JS Charts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.anychart.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51\",\"name\":\"Shachee Swadia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g\",\"caption\":\"Shachee Swadia\"},\"url\":\"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular Gauge & How to Create This Data Visualization Using JavaScript","description":"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Create an Angular Gauge with JavaScript","og_description":"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.","og_url":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/","og_site_name":"AnyChart News","article_publisher":"https:\/\/www.facebook.com\/AnyCharts","article_published_time":"2021-02-03T16:27:22+00:00","article_modified_time":"2022-08-13T11:16:26+00:00","og_image":[{"url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-social.png","type":"","width":"","height":""}],"author":"Shachee Swadia","twitter_card":"summary_large_image","twitter_title":"How to Create an Angular Gauge with JavaScript","twitter_description":"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.","twitter_image":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-twitter.png","twitter_creator":"@AnyChart","twitter_site":"@AnyChart","twitter_misc":{"Written by":"Shachee Swadia","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#article","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/"},"author":{"name":"Shachee Swadia","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"headline":"Creating JavaScript Angular Gauge","datePublished":"2021-02-03T16:27:22+00:00","dateModified":"2022-08-13T11:16:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/"},"wordCount":1772,"commentCount":0,"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png","keywords":["angular gauges","AnyChart","chart types","charts","circular gauges","data analysis","data analytics","data analytics examples","Data Visualization","data visualization examples","data visualization weekly","dataviz weekly","gauge charts","gauges","HTML5","html5 charts","infographics","JavaScript","javascript charting","JavaScript charting library","javascript charts","js chart","js charting","js charts","statistics","Tips and tricks","tutorial"],"articleSection":["AnyChart Charting Component","HTML5","JavaScript","JavaScript Chart Tutorials","Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/","url":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/","name":"Angular Gauge & How to Create This Data Visualization Using JavaScript","isPartOf":{"@id":"https:\/\/www.anychart.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png","datePublished":"2021-02-03T16:27:22+00:00","dateModified":"2022-08-13T11:16:26+00:00","author":{"@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51"},"description":"Learn how to make an interactive Angular Gauge for a website or app using JavaScript HTML5. Visualizing Spotify data on Grammys Record of the Year nominees.","breadcrumb":{"@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#primaryimage","url":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png","contentUrl":"https:\/\/www.anychart.com\/blog\/wp-content\/uploads\/2021\/02\/javascript-angular-gauge-html5-tutorial-web-blog.png","width":1200,"height":714},{"@type":"BreadcrumbList","@id":"https:\/\/www.anychart.com\/blog\/2021\/02\/03\/angular-gauge-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.anychart.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Creating JavaScript Angular Gauge"}]},{"@type":"WebSite","@id":"https:\/\/www.anychart.com\/blog\/#website","url":"https:\/\/www.anychart.com\/blog\/","name":"AnyChart News","description":"AnyChart JS Charts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.anychart.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/273255f98371177b5ac1f4775610bb51","name":"Shachee Swadia","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.anychart.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/50ebd5c61e4e46e052898a5ddbcef5996666132cf07c614be4725f028ec7eae3?s=96&r=g","caption":"Shachee Swadia"},"url":"https:\/\/www.anychart.com\/blog\/author\/shachee-swadia\/"}]}},"_links":{"self":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/comments?post=12083"}],"version-history":[{"count":20,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12083\/revisions"}],"predecessor-version":[{"id":15534,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/posts\/12083\/revisions\/15534"}],"wp:attachment":[{"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/media?parent=12083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/categories?post=12083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anychart.com\/blog\/wp-json\/wp\/v2\/tags?post=12083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}