Skip to content

Instantly share code, notes, and snippets.

@riyazshaikh
Created November 22, 2013 01:10
Show Gist options
  • Save riyazshaikh/7592977 to your computer and use it in GitHub Desktop.
Save riyazshaikh/7592977 to your computer and use it in GitHub Desktop.
Consumer Spending
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.oesmith.co.uk/morris-0.4.2.min.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js' type='text/javascript'></script>
<script src='http://cdn.oesmith.co.uk/morris-0.4.2.min.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
}
</style>
</head>
<body>
<div id='My Chart' class='rChart morris'></div>
<script type='text/javascript'>
var chartParams = {
"element": "My Chart",
"width": 800,
"height": 400,
"xkey": "year",
"ykeys": [
"Food",
"Alcoholic Beverages",
"Housing",
"Apparel",
"Transportation",
"Healthcare",
"Entertainment",
"Personal Care",
"Reading",
"Education",
"Tobacco Products",
"Miscellaneous",
"Cash Contributions",
"Personal Insurance"
],
"data": [
{
"year": "1984",
"sex": 1,
"Alcoholic Beverages": 275,
"Apparel": 1319,
"Cash Contributions": 706,
"Education": 303,
"Entertainment": 1055,
"Food": 3290,
"Healthcare": 1049,
"Housing": 6674,
"Miscellaneous": 451,
"Personal Care": 289,
"Personal Insurance": 1897,
"Reading": 132,
"Tobacco Products": 228,
"Transportation": 4304
},
{
"year": "1985",
"sex": 1,
"Alcoholic Beverages": 306,
"Apparel": 1420,
"Cash Contributions": 805,
"Education": 321,
"Entertainment": 1170,
"Food": 3477,
"Healthcare": 1108,
"Housing": 7087,
"Miscellaneous": 529,
"Personal Care": 303,
"Personal Insurance": 2016,
"Reading": 141,
"Tobacco Products": 219,
"Transportation": 4587
},
{
"year": "1986",
"sex": 1,
"Alcoholic Beverages": 271,
"Apparel": 1346,
"Cash Contributions": 746,
"Education": 314,
"Entertainment": 1149,
"Food": 3448,
"Healthcare": 1135,
"Housing": 7292,
"Miscellaneous": 522,
"Personal Care": 303,
"Personal Insurance": 2127,
"Reading": 140,
"Tobacco Products": 230,
"Transportation": 4842
},
{
"year": "1987",
"sex": 1,
"Alcoholic Beverages": 289,
"Apparel": 1446,
"Cash Contributions": 741,
"Education": 337,
"Entertainment": 1193,
"Food": 3664,
"Healthcare": 1135,
"Housing": 7569,
"Miscellaneous": 562,
"Personal Care": 330,
"Personal Insurance": 2175,
"Reading": 142,
"Tobacco Products": 232,
"Transportation": 4600
},
{
"year": "1988",
"sex": 1,
"Alcoholic Beverages": 269,
"Apparel": 1489,
"Cash Contributions": 693,
"Education": 342,
"Entertainment": 1329,
"Food": 3748,
"Healthcare": 1298,
"Housing": 8079,
"Miscellaneous": 578,
"Personal Care": 334,
"Personal Insurance": 2249,
"Reading": 150,
"Tobacco Products": 242,
"Transportation": 5093
},
{
"year": "1989",
"sex": 1,
"Alcoholic Beverages": 284,
"Apparel": 1582,
"Cash Contributions": 900,
"Education": 367,
"Entertainment": 1424,
"Food": 4152,
"Healthcare": 1407,
"Housing": 8609,
"Miscellaneous": 643,
"Personal Care": 366,
"Personal Insurance": 2472,
"Reading": 157,
"Tobacco Products": 261,
"Transportation": 5187
},
{
"year": "1990",
"sex": 1,
"Alcoholic Beverages": 293,
"Apparel": 1618,
"Cash Contributions": 816,
"Education": 406,
"Entertainment": 1422,
"Food": 4296,
"Healthcare": 1480,
"Housing": 8703,
"Miscellaneous": 842,
"Personal Care": 364,
"Personal Insurance": 2592,
"Reading": 153,
"Tobacco Products": 274,
"Transportation": 5120
},
{
"year": "1991",
"sex": 1,
"Alcoholic Beverages": 297,
"Apparel": 1735,
"Cash Contributions": 950,
"Education": 447,
"Entertainment": 1472,
"Food": 4271,
"Healthcare": 1554,
"Housing": 9252,
"Miscellaneous": 860,
"Personal Care": 399,
"Personal Insurance": 2787,
"Reading": 163,
"Tobacco Products": 276,
"Transportation": 5151
},
{
"year": "1992",
"sex": 1,
"Alcoholic Beverages": 301,
"Apparel": 1710,
"Cash Contributions": 958,
"Education": 426,
"Entertainment": 1500,
"Food": 4723,
"Healthcare": 1634,
"Housing": 9477,
"Miscellaneous": 765,
"Personal Care": 387,
"Personal Insurance": 2750,
"Reading": 162,
"Tobacco Products": 275,
"Transportation": 5228
},
{
"year": "1993",
"sex": 1,
"Alcoholic Beverages": 268,
"Apparel": 1676,
"Cash Contributions": 961,
"Education": 455,
"Entertainment": 1626,
"Food": 4399,
"Healthcare": 1776,
"Housing": 9636,
"Miscellaneous": 715,
"Personal Care": 385,
"Personal Insurance": 2908,
"Reading": 166,
"Tobacco Products": 268,
"Transportation": 5453
},
{
"year": "1994",
"sex": 1,
"Alcoholic Beverages": 278,
"Apparel": 1644,
"Cash Contributions": 960,
"Education": 460,
"Entertainment": 1567,
"Food": 4411,
"Healthcare": 1755,
"Housing": 10106,
"Miscellaneous": 749,
"Personal Care": 397,
"Personal Insurance": 2938,
"Reading": 165,
"Tobacco Products": 259,
"Transportation": 6044
},
{
"year": "1995",
"sex": 1,
"Alcoholic Beverages": 277,
"Apparel": 1704,
"Cash Contributions": 925,
"Education": 471,
"Entertainment": 1612,
"Food": 4505,
"Healthcare": 1732,
"Housing": 10458,
"Miscellaneous": 766,
"Personal Care": 403,
"Personal Insurance": 2964,
"Reading": 162,
"Tobacco Products": 269,
"Transportation": 6014
},
{
"year": "1996",
"sex": 1,
"Alcoholic Beverages": 309,
"Apparel": 1752,
"Cash Contributions": 940,
"Education": 524,
"Entertainment": 1834,
"Food": 4698,
"Healthcare": 1770,
"Housing": 10747,
"Miscellaneous": 855,
"Personal Care": 513,
"Personal Insurance": 3060,
"Reading": 159,
"Tobacco Products": 255,
"Transportation": 6382
},
{
"year": "1997",
"sex": 1,
"Alcoholic Beverages": 309,
"Apparel": 1729,
"Cash Contributions": 1001,
"Education": 571,
"Entertainment": 1813,
"Food": 4801,
"Healthcare": 1841,
"Housing": 11272,
"Miscellaneous": 847,
"Personal Care": 528,
"Personal Insurance": 3223,
"Reading": 164,
"Tobacco Products": 264,
"Transportation": 6457
},
{
"year": "1998",
"sex": 1,
"Alcoholic Beverages": 309,
"Apparel": 1674,
"Cash Contributions": 1109,
"Education": 580,
"Entertainment": 1746,
"Food": 4810,
"Healthcare": 1903,
"Housing": 11713,
"Miscellaneous": 860,
"Personal Care": 401,
"Personal Insurance": 3381,
"Reading": 161,
"Tobacco Products": 273,
"Transportation": 6616
},
{
"year": "1999",
"sex": 1,
"Alcoholic Beverages": 318,
"Apparel": 1743,
"Cash Contributions": 1181,
"Education": 635,
"Entertainment": 1891,
"Food": 5031,
"Healthcare": 1959,
"Housing": 12057,
"Miscellaneous": 867,
"Personal Care": 408,
"Personal Insurance": 3436,
"Reading": 159,
"Tobacco Products": 300,
"Transportation": 7011
},
{
"year": "2000",
"sex": 1,
"Alcoholic Beverages": 372,
"Apparel": 1856,
"Cash Contributions": 1192,
"Education": 632,
"Entertainment": 1863,
"Food": 5158,
"Healthcare": 2066,
"Housing": 12319,
"Miscellaneous": 776,
"Personal Care": 564,
"Personal Insurance": 3365,
"Reading": 146,
"Tobacco Products": 319,
"Transportation": 7417
},
{
"year": "2001",
"sex": 1,
"Alcoholic Beverages": 349,
"Apparel": 1743,
"Cash Contributions": 1258,
"Education": 648,
"Entertainment": 1953,
"Food": 5321,
"Healthcare": 2182,
"Housing": 13011,
"Miscellaneous": 750,
"Personal Care": 485,
"Personal Insurance": 3737,
"Reading": 141,
"Tobacco Products": 308,
"Transportation": 7633
},
{
"year": "2002",
"sex": 1,
"Alcoholic Beverages": 376,
"Apparel": 1749,
"Cash Contributions": 1277,
"Education": 752,
"Entertainment": 2079,
"Food": 5375,
"Healthcare": 2350,
"Housing": 13283,
"Miscellaneous": 792,
"Personal Care": 526,
"Personal Insurance": 3899,
"Reading": 139,
"Tobacco Products": 320,
"Transportation": 7759
},
{
"year": "2003",
"sex": 1,
"Alcoholic Beverages": 391,
"Apparel": 1640,
"Cash Contributions": 1370,
"Education": 783,
"Entertainment": 2060,
"Food": 5340,
"Healthcare": 2416,
"Housing": 13432,
"Miscellaneous": 606,
"Personal Care": 527,
"Personal Insurance": 4055,
"Reading": 127,
"Tobacco Products": 290,
"Transportation": 7781
},
{
"year": "2004",
"sex": 1,
"Alcoholic Beverages": 459,
"Apparel": 1816,
"Cash Contributions": 1408,
"Education": 905,
"Entertainment": 2218,
"Food": 5781,
"Healthcare": 2574,
"Housing": 13918,
"Miscellaneous": 690,
"Personal Care": 581,
"Personal Insurance": 4823,
"Reading": 130,
"Tobacco Products": 288,
"Transportation": 7801
},
{
"year": "2005",
"sex": 1,
"Alcoholic Beverages": 426,
"Apparel": 1886,
"Cash Contributions": 1663,
"Education": 940,
"Entertainment": 2388,
"Food": 5931,
"Healthcare": 2664,
"Housing": 15167,
"Miscellaneous": 808,
"Personal Care": 541,
"Personal Insurance": 5204,
"Reading": 126,
"Tobacco Products": 319,
"Transportation": 8344
},
{
"year": "2006",
"sex": 1,
"Alcoholic Beverages": 497,
"Apparel": 1874,
"Cash Contributions": 1869,
"Education": 888,
"Entertainment": 2376,
"Food": 6111,
"Healthcare": 2766,
"Housing": 16366,
"Miscellaneous": 846,
"Personal Care": 585,
"Personal Insurance": 5270,
"Reading": 117,
"Tobacco Products": 327,
"Transportation": 8508
},
{
"year": "2007",
"sex": 1,
"Alcoholic Beverages": 457,
"Apparel": 1881,
"Cash Contributions": 1821,
"Education": 945,
"Entertainment": 2698,
"Food": 6113,
"Healthcare": 2853,
"Housing": 16920,
"Miscellaneous": 808,
"Personal Care": 588,
"Personal Insurance": 5336,
"Reading": 118,
"Tobacco Products": 323,
"Transportation": 8758
},
{
"year": "2008",
"sex": 1,
"Alcoholic Beverages": 444,
"Apparel": 1801,
"Cash Contributions": 1737,
"Education": 1046,
"Entertainment": 2835,
"Food": 6443,
"Healthcare": 2976,
"Housing": 17109,
"Miscellaneous": 840,
"Personal Care": 616,
"Personal Insurance": 5605,
"Reading": 116,
"Tobacco Products": 317,
"Transportation": 8604
}
],
"pointSize": 0,
"lineWidth": 1,
"id": "My Chart",
"labels": [ "Food", "Alcoholic Beverages", "Housing", "Apparel", "Transportation", "Healthcare", "Entertainment", "Personal Care", "Reading", "Education", "Tobacco Products", "Miscellaneous", "Cash Contributions", "Personal Insurance" ]
},
chartType = "Line"
new Morris[chartType](chartParams)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment