{"id":850,"date":"2014-08-01T00:01:36","date_gmt":"2014-08-01T07:01:36","guid":{"rendered":"http:\/\/c-for-dummies.com\/blog\/?p=850"},"modified":"2014-08-03T10:01:35","modified_gmt":"2014-08-03T17:01:35","slug":"show-me-a-bar-chart","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=850","title":{"rendered":"Show Me a Bar Chart"},"content":{"rendered":"<p>Computers are notorious for spewing out rows and columns of meaningless numbers. Sure, they have significance, but often your audience is more energized when they view something other than a dull table filled with values.<br \/>\n<!--more--><br \/>\nAs an example, consider one of the basic pillars of office productivity software: the spreadsheet.<\/p>\n<p>The first spreadsheet, which would still be able to do the job today, was <em>VisiCalc<\/em>. It was a text-mode spreadsheet, an inspired piece of software, and today relatively unknown outside of hard core techies.<\/p>\n<p><em>VisiCalc<\/em> was unseated by a program called <em>Lotus 1-2-3<\/em>. The big difference between the two was that <em>Lotus 1-2-3<\/em> offered graphics. Yes, you could whip up a bar chart or a pie chart and add that to your spreadsheet. Business people went nuts, the software sold like hell, and suddenly it became important for computer software to have another way to display values.<\/p>\n<blockquote><p>As an aside, one of the first best-selling computer books was <em>Using 1-2-3<\/em>. The book sold so well, that the publisher cleverly re-branded the title, thereby screwing the original author out of millions of dollars of royalties.<\/p><\/blockquote>\n<p>All that history aside, your job for this month&#8217;s Exercise is to display a series of values in a bar chart. In this case, the values are average high month temperatures for each month of the year in my own home town. Here are those values:<\/p>\n<pre>January  : 35\r\nFebruary : 41\r\nMarch    : 49\r\nApril    : 58\r\nMay      : 67\r\nJune     : 74\r\nJuly     : 83\r\nAugust   : 84\r\nSeptember: 74\r\nOctober  : 60\r\nNovember : 43\r\nDecember : 36<\/pre>\n<p>Your job is to create two types of bar charts. The first (and easiest) one is a horizontal bar chart, a sample of which is shown in Figure 1.<\/p>\n<div id=\"attachment_882\" style=\"width: 436px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-882\" src=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure1.png\" alt=\"Figure 1. A horizontal bar chart.\" width=\"426\" height=\"196\" class=\"size-full wp-image-882\" srcset=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure1.png 426w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure1-300x138.png 300w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><p id=\"caption-attachment-882\" class=\"wp-caption-text\">Figure 1. A horizontal bar chart.<\/p><\/div>\n<p>The second (and more difficult) one is a vertical bar chart, shown in Figure 2.<\/p>\n<div id=\"attachment_883\" style=\"width: 436px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-883\" src=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure2.png\" alt=\"Figure 2. A vertical bar chart (much more difficult to do).\" width=\"426\" height=\"354\" class=\"size-full wp-image-883\" srcset=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure2.png 426w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure2-300x249.png 300w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/0801-figure2-361x300.png 361w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><p id=\"caption-attachment-883\" class=\"wp-caption-text\">Figure 2. A vertical bar chart (much more difficult to do).<\/p><\/div>\n<p>As I remind you each month, please attempt these exercises on your own before you peek at my suggested solutions below. Also, keep in mind that my solutions present merely one way to solve the puzzle. You don&#8217;t even have to present the output as shown in Figures 1 and 2 if you can devise something that you find more pleasing.<\/p>\n<p><a href=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/08exercise1.c\">Horizontal Bar Chart Solution<\/a><\/p>\n<p><a href=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2014\/08\/08exercise2.c\">Vertical Bar Chart Solution<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Displaying numbers is great. Displaying a bar chart is better! <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=850\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-850","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=850"}],"version-history":[{"count":5,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/850\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/850\/revisions\/929"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}