Created
August 31, 2015 05:08
-
-
Save tgerard/613262ec919a25485ac2 to your computer and use it in GitHub Desktop.
Quick horizontal bar chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Tongariro National Park</title> | |
| <script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> | |
| <link href="natparks.css" rel="stylesheet" type="text/css"/> | |
| </head> | |
| <body> | |
| <h1>Visitors to Tongariro National Park by calendar year</h1> | |
| <script type="text/javascript"> | |
| var svg = d3.select("body") | |
| .append("svg") | |
| .attr("width", 300) | |
| .attr("height", 400); | |
| d3.csv("visitorsToNZNationalParks.csv", function(data) { | |
| var tongariro = svg.selectAll("rect") | |
| .data(data) | |
| .enter(); | |
| tongariro.append("rect") | |
| .attr("class", "volcano") | |
| .attr("x", 0) | |
| .attr("y", function(d, i) { | |
| return i * 20; | |
| }) | |
| .attr("width", function(d) { | |
| return d.tongariro / 500; | |
| }) | |
| .attr("height", 18); | |
| tongariro.append("text") | |
| .attr("class", "label") | |
| .attr("x", 6) | |
| .attr("y", function(d, i) { | |
| return i * 20 + 12; | |
| }) | |
| .text(function(d) { | |
| return d.calendarYear; | |
| }); | |
| }); | |
| </script> | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| h1, .label { | |
| font-family: verdana, sans-serif; | |
| font-size: 18px; | |
| } | |
| h1 { | |
| color: #56350c; | |
| } | |
| .label { | |
| fill: #f2f6cb; | |
| font-size: 10px; | |
| } | |
| .volcano { | |
| fill: #56350c; | |
| } | |
| .volcano:hover { | |
| fill: #af1e23; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| calendarYear | abelTasman | fiordland | westland | aorakiMtCook | tongariro | paparoa | |
|---|---|---|---|---|---|---|---|
| 1997 | 28800 | 196100 | 205500 | 154300 | 32100 | 11700 | |
| 1998 | 31100 | 234500 | 207300 | 147100 | 41900 | 30100 | |
| 1999 | 31700 | 205100 | 233900 | 135500 | 45500 | 33400 | |
| 2000 | 54400 | 250300 | 278900 | 158400 | 48600 | 40500 | |
| 2001 | 48200 | 239300 | 271500 | 143100 | 51800 | 40500 | |
| 2002 | 57900 | 273000 | 280900 | 158100 | 55100 | 44400 | |
| 2003 | 93000 | 308400 | 342300 | 157700 | 80800 | 71200 | |
| 2004 | 94400 | 393700 | 362400 | 209900 | 96700 | 87700 | |
| 2005 | 95800 | 409700 | 386000 | 201000 | 100300 | 98300 | |
| 2006 | 96700 | 438000 | 372800 | 192200 | 95000 | 116700 | |
| 2007 | 110700 | 439900 | 376700 | 172700 | 97800 | 97400 | |
| 2008 | 119300 | 441200 | 379300 | 201800 | 83200 | 121200 | |
| 2009 | 106800 | 385700 | 341400 | 170400 | 102100 | 130800 | |
| 2010 | 120800 | 392700 | 357300 | 186600 | 110000 | 165800 | |
| 2011 | 110500 | 371400 | 312100 | 146900 | 141500 | 127500 | |
| 2012 | 95300 | 338700 | 288800 | 155700 | 114000 | 114200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment