{"id":11787,"date":"2017-03-07T01:45:25","date_gmt":"2017-03-07T00:45:25","guid":{"rendered":"http:\/\/www.highcharts.com\/blog\/?p=11787"},"modified":"2026-01-12T09:16:28","modified_gmt":"2026-01-12T09:16:28","slug":"using-highcharts-javascript-newbie","status":"publish","type":"post","link":"https:\/\/www.highcharts.com\/blog\/tutorials\/using-highcharts-javascript-newbie\/","title":{"rendered":"Using Highcharts as a JavaScript newbie"},"content":{"rendered":"<p>Highcharts is part of our curriculum in Information Visualization and Presentation, taught by Professor Marti Hearst at the UC Berkeley School of Information.<\/p>\n<p>In the first couple of weeks of the course, we learned about human perception and good visualization practices, so we were excited to put our learnings into practice in our first coding assignment. The task was to visualize a small mock dataset using Highcharts with the limitation of only using up a 800 x 600 pixel frame.<\/p>\n<p>The first step in our design process was to look at our data and see how we could most meaningfully visualize it. The data contained fake sales numbers for 9 different IoT devices from 2013 &#8211; 2016, the percentage of items returned and the number of days it takes to ship these items (for all 9 devices, this number remained the same across all years).<\/p>\n<p>Once we felt we had understood the data, we first individually thought about the best way to visualize them. Using the share-multiple method [1] we sketched a few ideas on paper individually, and later jointly discussed the designs and decided what our final visualization should look like.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11790\" src=\"https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs.jpg\" alt=\"\" width=\"1288\" height=\"634\" srcset=\"https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs.jpg 1288w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-560x276.jpg 560w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-768x378.jpg 768w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-760x374.jpg 760w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-360x177.jpg 360w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-1160x571.jpg 1160w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-30x15.jpg 30w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010017\/Getting_started_with_Highcharts_-_Google_Docs-300x148.jpg 300w\" sizes=\"auto, (max-width: 1288px) 100vw, 1288px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11791\" src=\"https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2.jpg\" alt=\"\" width=\"1372\" height=\"454\" srcset=\"https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2.jpg 1372w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-560x185.jpg 560w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-768x254.jpg 768w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-760x251.jpg 760w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-360x119.jpg 360w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-1160x384.jpg 1160w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-30x10.jpg 30w, https:\/\/wp-assets.highcharts.com\/www-highcharts-com\/blog\/wp-content\/uploads\/2017\/03\/07010224\/Using-Highcharts-as-a-JavaScript-newbie-2-300x99.jpg 300w\" sizes=\"auto, (max-width: 1372px) 100vw, 1372px\" \/><\/p>\n<p>Only then did we look at the Highcharts demo library to see what could fit our needs. We really liked the area chart and decided to adapt our design a bit to incorporate it.<\/p>\n<p>Getting started with Highcharts takes a bit of research if you are fairly new to programming in Javascript (like we were). Given the demo examples in <a href=\"https:\/\/jsfiddle.net\/\">JS Fiddle<\/a>, however, you can always start with working code and go from there.<\/p>\n<p>Our chart is actually made up of two individual charts. The top one is a basic area chart. Since we wanted grouped categories on our x-axis, we leveraged a plugin from <a href=\"https:\/\/github.com\/blacklabel\">Black Label<\/a> and tweaked it a bit by adjusting some of the layout (we\u2019re not big fans of borders around axis descriptions). The bottom one is a columns chart that\u2019s flipped on its head. We aligned the two charts on the x-axis and got rid of all unnecessary labeling (chart noise) to achieve a very clean yet legible design.<\/p>\n<p>This is our final result &#8211; hope you like it!<\/p>\n<p>&nbsp;<\/p>\n<p><iframe title=\"Highcharts combined area and bar chart\" style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/www.highcharts.com\/samples\/embed\/highcharts\/blog\/area-bar-iot-devices\" allow=\"fullscreen\"><\/iframe><br \/>\n&nbsp;<\/p>\n<p><strong>Tips for getting started with Highcharts<\/strong><\/p>\n<ul>\n<li>Don\u2019t get frustrated! A simple missing comma or bracket can make your entire visualization disappear. In these cases, the Javascript console in your browser is your best friend.<\/li>\n<li>Leverage the code in the demo versions and tinker with it in the <a href=\"https:\/\/jsfiddle.net\/\">JS Fiddle<\/a> environment. Using demo data first and only importing your own data with CSV later allows you to focus on properly setting up your chart first.<\/li>\n<li>The <a href=\"http:\/\/api.highcharts.com\/highcharts\">Highcharts API documentation<\/a> really takes the guesswork out of coding. Once we got to the fine-tuning part, it was super easy to look up the attributes we needed to change to get the look we wanted.<\/li>\n<li>Lastly, if you are hoping to make a reusable instance of Highcharts, it\u2019s better not to hard-code data into it; instead, use jQuery loops to parse through a data file (typically a CSV) to insert data into the variables for series and categories.<\/li>\n<\/ul>\n<p>Our code is uploaded here on <a href=\"https:\/\/github.com\/u-raza\/highcharts_broken_area\">Github<\/a> for anyone to play with.<br \/>\n<strong>References<\/strong><br \/>\nDow SP, Fortuna J, Schwartz D, Altringer B, Schwartz DL, Klemmer SR. Prototyping dynamics: sharing multiple designs improves exploration, group rapport, and results. InDesign Thinking Research 2012 (pp. 47-70). Springer Berlin Heidelberg.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can you create a chart without knowing javascript? Here is a story of two JavaScript newbies who succeeded to set up a wonderful chart using Highcharts.<\/p>\n","protected":false},"author":211,"featured_media":13568,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"meta_title":"","meta_description":"","hc_selected_options":[],"footnotes":""},"categories":[210],"tags":[1094,1031],"coauthors":[723],"class_list":["post-11787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-highcharts-core","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/11787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/users\/211"}],"replies":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/comments?post=11787"}],"version-history":[{"count":1,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/11787\/revisions"}],"predecessor-version":[{"id":29092,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/posts\/11787\/revisions\/29092"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/media\/13568"}],"wp:attachment":[{"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/media?parent=11787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/categories?post=11787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/tags?post=11787"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.highcharts.com\/blog\/wp-json\/wp\/v2\/coauthors?post=11787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}