Exploring other views of: http://flowingdata.com/2016/02/09/why-people-visit-the-emergency-room/. Code copied from Nathan Yau's work, and adapted.
Last active
February 27, 2016 01:12
-
-
Save zanarmstrong/d5380c855e887b113e4b to your computer and use it in GitHub Desktop.
Seasonality of ER products, small multiples
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="stl.css"> | |
<link href='http://fonts.googleapis.com/css?family=Raleway:400,700' rel='stylesheet' type='text/css'> | |
</head> | |
<body> | |
<div class="projectTitle">Seasonality of products involved in ER visits, sorted by most to least seasonal</div> | |
<div class="projectDesc">For each product type and month, the chart shows the percent of accidents involving that product that took place in that month. For example, in 2014, just over 70% of all ER visits related to Fireworks occured in July. The products are sorted from most to least seasonal, ending with "stair/steps" accidents which are essentially equally likely in any month.</div> | |
<div class="projectDesc">The dashed line at 8.3% shows an "average" month. The y-scale emphasizes values between 0 and 20%, to better reveal the differences in seasonality between 0 occurances and 2x an average month.</div> | |
<div class="productDesc">Inspired by and adapted from Nathan Yau's <a href="http://flowingdata.com/2016/02/09/why-people-visit-the-emergency-room/">Why People Visit the Emergency Room</a>.</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
<script src="stl.js"></script> | |
</body> |
This file contains 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
Code | m1 | m2 | m3 | m4 | m5 | m6 | m7 | m8 | m9 | m10 | m11 | m12 | Title | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0115 | 1457 | 1070 | 1228 | 1418 | 1204 | 1539 | 1231 | 1016 | 1595 | 1300 | 1909 | 1576 | Vacuum cleaners | |
0127 | 490 | 416 | 680 | 436 | 576 | 356 | 473 | 479 | 546 | 617 | 594 | 593 | Clothes dryers, not specified | |
0140 | 852 | 859 | 927 | 923 | 914 | 736 | 1539 | 843 | 1760 | 1730 | 839 | 1358 | Washing machines, other or not specified | |
0214 | 605 | 406 | 419 | 760 | 612 | 495 | 691 | 618 | 537 | 605 | 471 | 863 | Dishwashers | |
0215 | 717 | 565 | 548 | 698 | 808 | 1182 | 555 | 844 | 472 | 928 | 268 | 916 | Electric blenders | |
0264 | 590 | 479 | 802 | 427 | 1124 | 333 | 1278 | 882 | 928 | 250 | 465 | 517 | Microwave ovens | |
0276 | 2296 | 1847 | 2165 | 3436 | 2017 | 3338 | 3681 | 3941 | 2908 | 4275 | 2573 | 3123 | Refrigerators | |
0281 | 2092 | 2219 | 2641 | 1935 | 2637 | 1846 | 1778 | 1799 | 1775 | 2468 | 2490 | 2607 | Ranges or ovens, not specified | |
0342 | 750 | 562 | 625 | 651 | 654 | 749 | 633 | 826 | 579 | 834 | 1233 | 1055 | Fireplaces, not specified | |
0374 | 1722 | 1455 | 3149 | 2054 | 2554 | 1912 | 2602 | 2483 | 2266 | 2005 | 1329 | 1490 | Pipes (excluding smoking pipes) | |
0379 | 704 | 361 | 948 | 606 | 258 | 370 | 396 | 417 | 160 | 546 | 817 | 928 | Radiators (excluding vehicle radiators) | |
0380 | 353 | 615 | 642 | 830 | 1625 | 1485 | 2110 | 1710 | 1838 | 1112 | 934 | 642 | Fans | |
0381 | 309 | 272 | 359 | 639 | 1250 | 2467 | 2413 | 1196 | 935 | 707 | 999 | 449 | Air conditioners | |
0393 | 1402 | 1300 | 780 | 632 | 415 | 253 | 265 | 163 | 525 | 828 | 555 | 1176 | Heaters or heating systems, other or not specified | |
0413 | 2501 | 3215 | 2720 | 3270 | 3589 | 2790 | 1857 | 3574 | 3545 | 3137 | 3101 | 2430 | Waste containers, trash baskets or refuse bins | |
0420 | 886 | 1073 | 1463 | 828 | 1244 | 1186 | 1202 | 1068 | 1061 | 598 | 1151 | 1297 | Manual scissors | |
0428 | 436 | 958 | 841 | 637 | 869 | 1155 | 1008 | 699 | 777 | 740 | 1274 | 1266 | Kitchen gadgets, not elsewhere classified | |
0431 | 587 | 420 | 762 | 265 | 571 | 103 | 645 | 636 | 645 | 239 | 693 | 726 | Toothpicks or hor d'oeuvres picks | |
0438 | 1271 | 1062 | 1767 | 975 | 947 | 844 | 1112 | 1364 | 634 | 1556 | 1043 | 1236 | Laundry baskets | |
0450 | 602 | 574 | 548 | 700 | 528 | 983 | 1189 | 674 | 1316 | 1191 | 1384 | 1588 | Scissors, not specified | |
0463 | 462 | 306 | 806 | 617 | 466 | 582 | 744 | 463 | 479 | 1156 | 845 | 1221 | Candles, candlesticks and other candle holders | |
0464 | 23655 | 19461 | 26882 | 24897 | 27289 | 26322 | 30054 | 27638 | 26907 | 27828 | 29914 | 29921 | Knives, not elsewhere classified | |
0466 | 1643 | 1212 | 1788 | 1528 | 2338 | 1259 | 1562 | 2221 | 1790 | 1389 | 1631 | 1755 | Cookware, not specified | |
0469 | 2158 | 1728 | 2194 | 2433 | 1804 | 1574 | 1588 | 2404 | 1885 | 2162 | 2614 | 2794 | Slicers and choppers | |
0474 | 6277 | 5008 | 5379 | 6005 | 5705 | 6081 | 6312 | 6894 | 5823 | 5317 | 5552 | 6549 | Tableware and accessories (excluding drinking glasses) | |
0478 | 5150 | 3569 | 5014 | 4467 | 6174 | 5298 | 5277 | 5484 | 4724 | 5272 | 4699 | 4534 | Drinking glasses | |
0480 | 1476 | 1716 | 2276 | 2098 | 2458 | 2036 | 3399 | 3349 | 2542 | 3143 | 1688 | 1998 | Manual cleaning equipment (excluding buckets orpails) | |
0519 | 788 | 472 | 660 | 576 | 552 | 1016 | 754 | 847 | 565 | 951 | 1410 | 825 | Television tables or stands | |
0546 | 743 | 761 | 1191 | 610 | 1122 | 1125 | 937 | 1500 | 851 | 1025 | 680 | 1119 | Stereo or hi-fi components or accessories (excluding self-contained units) | |
0550 | 1784 | 878 | 2107 | 1982 | 1267 | 1694 | 1327 | 2083 | 1673 | 1472 | 1884 | 2258 | Telephones or telephone accessories | |
0557 | 2801 | 1759 | 3046 | 1668 | 1540 | 1843 | 1865 | 1754 | 1745 | 1959 | 1965 | 2877 | Computers (equipment and electronic games) | |
0566 | 599 | 436 | 793 | 507 | 869 | 605 | 945 | 857 | 967 | 725 | 598 | 553 | Musical instruments, not electric or not battery operated or not specified | |
0572 | 3532 | 3142 | 3317 | 3677 | 3532 | 4335 | 4028 | 3415 | 2838 | 2960 | 3226 | 3976 | Televisions | |
0604 | 8177 | 7288 | 8656 | 7459 | 9960 | 8215 | 8453 | 8161 | 8851 | 9677 | 9455 | 9708 | Desks, dressers, chests, bureaus, or buffets | |
0611 | 19271 | 18941 | 22990 | 22460 | 25531 | 24536 | 26936 | 26334 | 26062 | 24406 | 22285 | 25529 | Bathtubs or showers | |
0612 | 2484 | 2250 | 1588 | 1680 | 1641 | 1687 | 1323 | 1525 | 1827 | 1722 | 1744 | 2681 | Runners, throw rugs or doormats (excluding bathtub mats) | |
0613 | 1396 | 1679 | 1082 | 999 | 1205 | 836 | 1282 | 1411 | 1158 | 1473 | 1781 | 992 | Room-sized, wall-to-wall or outdoor carpeting (excluding runners) | |
0618 | 738 | 714 | 482 | 1141 | 802 | 1296 | 1231 | 678 | 675 | 1428 | 1395 | 1006 | Stepladders (excluding step stools) | |
0620 | 822 | 637 | 865 | 1474 | 1590 | 826 | 1165 | 849 | 1487 | 975 | 1669 | 1571 | Step stools | |
0627 | 858 | 329 | 669 | 780 | 790 | 586 | 866 | 1156 | 1187 | 610 | 495 | 1440 | Light bulbs (excluding Christmas tree light bulbs) | |
0648 | 1764 | 1122 | 1983 | 1563 | 1566 | 1876 | 1548 | 1817 | 1788 | 1993 | 1940 | 2029 | Sinks (excluding faucets) | |
0649 | 6626 | 6043 | 7914 | 6816 | 8300 | 8066 | 8707 | 8937 | 9410 | 8389 | 7199 | 8626 | Toilets | |
0652 | 840 | 905 | 1302 | 1041 | 737 | 1258 | 1557 | 1141 | 1530 | 1277 | 1694 | 1661 | Pictures, picture frames or wall decorations | |
0654 | 1063 | 1006 | 996 | 1193 | 1082 | 977 | 1888 | 2271 | 1430 | 833 | 1422 | 1203 | Knickknacks, statues, vases or urns | |
0661 | 3222 | 2502 | 3824 | 2438 | 2943 | 3228 | 2700 | 3402 | 2394 | 2808 | 3219 | 2873 | Bunk beds | |
0666 | 483 | 492 | 532 | 635 | 774 | 681 | 584 | 536 | 615 | 687 | 520 | 688 | Towels or cloths | |
0670 | 1403 | 1798 | 1631 | 1900 | 1641 | 2384 | 2243 | 2286 | 2825 | 2289 | 2943 | 2683 | Chair, recliner | |
0671 | 613 | 458 | 385 | 719 | 461 | 973 | 753 | 590 | 332 | 699 | 548 | 557 | Chair, rocking | |
0676 | 6045 | 6421 | 6471 | 6831 | 7333 | 5845 | 7462 | 8305 | 6384 | 7454 | 7976 | 8080 | Rugs or carpets, not specified | |
0679 | 14486 | 12541 | 14984 | 14358 | 15163 | 14885 | 16346 | 14895 | 14711 | 15447 | 16136 | 16469 | Sofas, couches, davenports, divans or studio couches | |
0687 | 2165 | 2059 | 2322 | 3427 | 3156 | 3412 | 3867 | 4327 | 3419 | 3250 | 2515 | 2490 | Benches (excluding work benches) | |
0689 | 378 | 802 | 552 | 782 | 469 | 345 | 755 | 694 | 542 | 250 | 505 | 944 | Blankets, not specified | |
0698 | 518 | 246 | 567 | 380 | 431 | 751 | 608 | 867 | 718 | 354 | 842 | 179 | Hot tubs or home spas | |
0814 | 728 | 449 | 1131 | 1379 | 2132 | 1886 | 2053 | 2249 | 1297 | 2041 | 853 | 1393 | Hoists, lifts, jacks or jack stands | |
0827 | 1314 | 1515 | 1667 | 2360 | 3024 | 2617 | 2665 | 2843 | 2619 | 1937 | 1805 | 904 | Hammers | |
0828 | 442 | 616 | 785 | 484 | 762 | 628 | 579 | 417 | 214 | 436 | 423 | 768 | Screwdrivers | |
0832 | 990 | 606 | 731 | 922 | 1106 | 758 | 834 | 1098 | 1499 | 1216 | 1508 | 503 | Portable circular power saws | |
0835 | 459 | 780 | 468 | 508 | 373 | 935 | 979 | 546 | 474 | 779 | 699 | 789 | Toolboxes or tool kits (excluding tools) | |
0836 | 3140 | 2942 | 3070 | 3002 | 4013 | 4151 | 3272 | 3495 | 3364 | 3426 | 4133 | 3446 | Knives with replaceable blades | |
0837 | 213 | 274 | 628 | 352 | 881 | 930 | 389 | 562 | 667 | 611 | 204 | 455 | Wire, not specified | |
0841 | 2757 | 1784 | 2498 | 3469 | 4013 | 2674 | 2627 | 2719 | 3472 | 2151 | 2321 | 2715 | Bench or table saws | |
0845 | 1431 | 574 | 1408 | 1319 | 970 | 1358 | 742 | 1154 | 880 | 1390 | 821 | 964 | Saws, not specified | |
0847 | 531 | 601 | 698 | 705 | 1089 | 1217 | 1022 | 992 | 873 | 920 | 586 | 63 | Drills, not specified | |
0852 | 497 | 125 | 727 | 555 | 742 | 556 | 1184 | 800 | 346 | 372 | 135 | 534 | Rope or string | |
0857 | 564 | 405 | 1067 | 715 | 1147 | 934 | 1507 | 1090 | 985 | 628 | 1132 | 1236 | Pliers, wire cutters or wrenches | |
0881 | 440 | 109 | 613 | 940 | 313 | 391 | 418 | 499 | 546 | 877 | 111 | 646 | Other manual workshop tools | |
0884 | 1313 | 932 | 1047 | 671 | 577 | 680 | 720 | 740 | 1646 | 831 | 1673 | 873 | Batteries | |
0893 | 727 | 1240 | 2554 | 3036 | 2914 | 3355 | 2598 | 2317 | 2296 | 2648 | 1813 | 1535 | Tools, not specified | |
0895 | 566 | 359 | 1034 | 1051 | 749 | 779 | 514 | 1422 | 1028 | 959 | 655 | 702 | Power saws, other or not specified | |
0896 | 778 | 775 | 1050 | 1378 | 1292 | 1363 | 1674 | 1116 | 1153 | 1001 | 1123 | 692 | Welding equipment | |
0897 | 576 | 365 | 567 | 750 | 932 | 236 | 603 | 716 | 666 | 528 | 422 | 508 | Power workshop grinders, buffers or polishers | |
0899 | 952 | 869 | 1242 | 1483 | 2872 | 2772 | 1832 | 1423 | 2695 | 2722 | 1381 | 1219 | Workshop grinders, buffers, or polishers | |
0909 | 505 | 608 | 398 | 100 | 728 | 897 | 880 | 653 | 513 | 513 | 159 | 402 | Adhesives (excluding tapes) | |
0910 | 641 | 601 | 413 | 894 | 1173 | 884 | 1114 | 2013 | 879 | 695 | 1054 | 985 | Gasoline | |
0921 | 562 | 273 | 786 | 572 | 629 | 487 | 610 | 366 | 356 | 364 | 680 | 196 | Chemicals, not elsewhere classified | |
0949 | 1595 | 1139 | 1459 | 1427 | 1990 | 2055 | 1671 | 1312 | 1899 | 1782 | 1560 | 1977 | Laundry soaps or detergents | |
0954 | 1218 | 1258 | 957 | 622 | 1090 | 1325 | 991 | 1235 | 971 | 1193 | 859 | 1305 | General purpose household cleaners | |
0956 | 1356 | 1067 | 1855 | 1820 | 2095 | 1662 | 1812 | 2319 | 1203 | 1838 | 881 | 1224 | Bleaches (noncosmetic) | |
0960 | 530 | 309 | 399 | 935 | 1056 | 824 | 954 | 1006 | 1135 | 883 | 1087 | 137 | Paints, varnishes or shellacs | |
0983 | 983 | 1764 | 1663 | 1924 | 2028 | 1764 | 1645 | 1520 | 1478 | 2003 | 2107 | 1474 | Soaps (excluding detergents) | |
1112 | 5294 | 4492 | 4820 | 4346 | 4394 | 4272 | 5624 | 5775 | 6160 | 4550 | 4233 | 5094 | Metal containers | |
1114 | 975 | 622 | 804 | 805 | 555 | 736 | 1046 | 982 | 874 | 1418 | 1282 | 1253 | Cardboard products | |
1122 | 1090 | 779 | 190 | 1062 | 1229 | 794 | 1170 | 1464 | 1657 | 945 | 845 | 1043 | Glass alcoholic beverage bottles | |
1123 | 645 | 361 | 133 | 309 | 854 | 505 | 773 | 618 | 798 | 607 | 517 | 472 | Plastic containers (rigid or semi-rigid, excluding bottles and jars) | |
1125 | 286 | 393 | 719 | 1270 | 834 | 532 | 817 | 995 | 761 | 419 | 151 | 583 | Wooden containers | |
1127 | 55 | 695 | 257 | 731 | 602 | 1260 | 510 | 797 | 213 | 619 | 282 | 359 | Nonglass bottles or jars (excluding baby bottles) | |
1130 | 826 | 578 | 305 | 426 | 447 | 865 | 566 | 578 | 717 | 370 | 466 | 596 | Plastic bags | |
1135 | 440 | 613 | 1025 | 1510 | 991 | 1732 | 1450 | 1232 | 1777 | 1107 | 958 | 1197 | Bottles or jars, not specified | |
1137 | 1766 | 1825 | 1957 | 1891 | 2228 | 1885 | 2278 | 1721 | 1914 | 2005 | 1832 | 3034 | Paper products (excluding bags, cups, straws and cardboard products) | |
1140 | 713 | 841 | 710 | 1048 | 1312 | 1201 | 1931 | 1474 | 1133 | 1240 | 753 | 1120 | Glass bottles or jars, not specified | |
1141 | 8174 | 7835 | 8486 | 7837 | 10036 | 10870 | 10771 | 10285 | 10108 | 9304 | 8103 | 12077 | Containers, not specified | |
1143 | 575 | 832 | 482 | 1206 | 1198 | 1240 | 944 | 1172 | 1476 | 795 | 932 | 801 | Buckets or pails | |
1144 | 3185 | 3080 | 3562 | 2840 | 2275 | 3853 | 4126 | 3978 | 3744 | 2864 | 2869 | 2900 | Bags, not elsewhere classified | |
1200 | 4797 | 5326 | 6382 | 5775 | 8543 | 3575 | 2287 | 5131 | 9505 | 10438 | 5487 | 5429 | Sports and recreational activity, not elsewhere classified | |
1205 | 48853 | 46854 | 47015 | 51816 | 51099 | 44735 | 36556 | 32142 | 36557 | 35782 | 38463 | 45181 | Basketball (activity, apparel or equipment) | |
1206 | 1483 | 1173 | 1761 | 1389 | 1339 | 1177 | 801 | 1088 | 1732 | 1692 | 1225 | 1577 | Bowling (activity, apparel or equipment) | |
1207 | 686 | 1177 | 1633 | 1871 | 1698 | 1638 | 1525 | 1530 | 1417 | 1077 | 859 | 1120 | Boxing (activity, apparel or equipment) | |
1211 | 9599 | 7849 | 11614 | 12694 | 20951 | 14577 | 14552 | 54095 | 103902 | 94237 | 34874 | 13359 | Football (activity, apparel or equipment) | |
1212 | 839 | 1107 | 1928 | 1771 | 3858 | 2886 | 4217 | 3246 | 3305 | 1990 | 2211 | 1751 | Golf (activity, apparel or equipment) | |
1213 | 450 | 603 | 804 | 461 | 1742 | 1533 | 1840 | 1650 | 2054 | 915 | 962 | 1205 | Golf carts | |
1215 | 454 | 964 | 2336 | 3446 | 3449 | 1161 | 1056 | 201 | 310 | 439 | 735 | 684 | Lacrosse (activity, apparel or equipment) | |
1217 | 6617 | 6341 | 1185 | 20 | 0 | 0 | 150 | 16 | 16 | 82 | 938 | 1153 | Sleds | |
1233 | 3958 | 4732 | 8654 | 13466 | 13916 | 11104 | 11633 | 9640 | 8762 | 7991 | 5262 | 4234 | Trampolines | |
1237 | 1024 | 783 | 1220 | 1055 | 681 | 1235 | 859 | 619 | 581 | 878 | 1067 | 1421 | Gas, air or spring-operated guns (including BB guns) | |
1239 | 2910 | 2697 | 3303 | 4075 | 5371 | 5013 | 5601 | 6187 | 4904 | 4887 | 2753 | 2244 | Horseback riding (activity, apparel or equipment) | |
1240 | 595 | 106 | 856 | 429 | 343 | 891 | 373 | 692 | 478 | 307 | 463 | 519 | Aquariums or accessories | |
1242 | 2181 | 1485 | 3444 | 5642 | 6808 | 5554 | 4748 | 5511 | 4893 | 4244 | 3120 | 1827 | Slides or sliding boards | |
1244 | 2522 | 3035 | 4240 | 7751 | 11212 | 7640 | 5947 | 8176 | 12605 | 9469 | 4038 | 3081 | Playground gyms or other playground climbing apparatus | |
1261 | 703 | 299 | 464 | 965 | 1292 | 929 | 3271 | 2076 | 1592 | 1242 | 942 | 1307 | Surfing (activity, apparel or equipment) | |
1266 | 2124 | 3267 | 3816 | 4481 | 3826 | 3157 | 3363 | 5225 | 8719 | 6877 | 3320 | 2851 | Volleyball (activity, apparel or equipment) | |
1267 | 11988 | 12887 | 14443 | 18852 | 23890 | 17974 | 18328 | 19913 | 37834 | 30518 | 18728 | 11775 | Soccer (activity, apparel or equipment) | |
1270 | 9502 | 4904 | 3013 | 1829 | 1474 | 1013 | 1005 | 868 | 1055 | 1601 | 4977 | 7736 | Wrestling (activity, apparel or equipment) | |
1272 | 2660 | 2733 | 2467 | 2625 | 2898 | 2256 | 3111 | 3457 | 3538 | 3144 | 2517 | 2197 | Gymnastics (activity, apparel or equipment) | |
1279 | 2219 | 1660 | 1879 | 229 | 415 | 403 | 661 | 301 | 1260 | 2001 | 2726 | 3846 | Ice hockey (activity, apparel or equipment) | |
1284 | 327 | 947 | 1196 | 2487 | 5959 | 11475 | 15358 | 8056 | 4027 | 1706 | 748 | 344 | Swimming pools, not specified | |
1290 | 1207 | 2249 | 1625 | 191 | 80 | 74 | 0 | 82 | 0 | 0 | 139 | 626 | Snowmobiles (activity, apparel or equipment) | |
1293 | 921 | 1221 | 2170 | 1746 | 2555 | 3203 | 3879 | 3598 | 2742 | 2838 | 859 | 1482 | Amusement attractions (including rides) | |
1294 | 1124 | 962 | 948 | 1502 | 921 | 1084 | 902 | 1270 | 2385 | 2075 | 1355 | 804 | Bleachers | |
1313 | 517 | 57 | 210 | 176 | 338 | 447 | 7288 | 586 | 0 | 47 | 16 | 596 | Fireworks | |
1329 | 2450 | 2650 | 3470 | 6682 | 6294 | 5855 | 6200 | 6806 | 4672 | 3505 | 3195 | 3199 | Scooters, unpowered | |
1333 | 5654 | 5944 | 8783 | 10711 | 12194 | 10986 | 14973 | 12481 | 11154 | 11125 | 7105 | 7012 | Skateboards | |
1345 | 545 | 512 | 318 | 267 | 794 | 622 | 739 | 484 | 626 | 609 | 563 | 470 | Building sets | |
1381 | 454 | 303 | 585 | 894 | 676 | 440 | 686 | 832 | 823 | 406 | 291 | 399 | Toys, not elsewhere classified | |
1395 | 3375 | 2814 | 3280 | 3893 | 3134 | 4358 | 4964 | 4443 | 4957 | 4929 | 3227 | 3318 | Toys, not specified | |
1401 | 162 | 94 | 137 | 1450 | 3387 | 1846 | 2616 | 1535 | 990 | 1549 | 251 | 31 | Power lawn mowers, not specified | |
1403 | 1347 | 2091 | 1517 | 3706 | 3627 | 2688 | 2608 | 2281 | 1466 | 2881 | 2493 | 1592 | Other unpowered garden tools | |
1406 | 2536 | 3429 | 417 | 242 | 0 | 0 | 0 | 74 | 90 | 0 | 673 | 843 | Snow throwers/blowers | |
1411 | 1341 | 1564 | 2459 | 2889 | 2660 | 2908 | 3011 | 2419 | 3065 | 3530 | 1914 | 1640 | Chain saws | |
1413 | 826 | 519 | 865 | 817 | 2092 | 1084 | 2418 | 1145 | 971 | 1098 | 870 | 676 | Greenhouse or gardening supplies | |
1414 | 437 | 581 | 632 | 1249 | 1669 | 1631 | 1604 | 1221 | 1009 | 1215 | 1041 | 336 | Garden hoses, nozzles or sprinklers | |
1415 | 14555 | 22582 | 6008 | 412 | 163 | 103 | 0 | 0 | 0 | 0 | 2577 | 1328 | Manual snow or ice removal tools | |
1422 | 162 | 139 | 362 | 1178 | 2359 | 2029 | 2461 | 2641 | 1812 | 983 | 628 | 487 | Riding power lawn mowers | |
1426 | 1348 | 704 | 1447 | 737 | 823 | 1794 | 1348 | 775 | 1318 | 1244 | 1394 | 1370 | Hatchets or axes | |
1439 | 117 | 438 | 674 | 2439 | 8104 | 6251 | 8152 | 6406 | 4585 | 2619 | 1218 | 500 | Lawn mowers, not specified | |
1447 | 350 | 582 | 945 | 1611 | 2430 | 2839 | 4244 | 2023 | 3188 | 2153 | 1266 | 540 | Pruning or trimming equipment, not specified | |
1457 | 830 | 599 | 569 | 412 | 534 | 708 | 530 | 704 | 1004 | 1041 | 685 | 1170 | Log splitters | |
1464 | 96 | 167 | 307 | 477 | 2235 | 2091 | 2320 | 2112 | 1634 | 617 | 145 | 90 | Lawn trimmers or edgers, powered | |
1465 | 712 | 788 | 432 | 671 | 1019 | 1010 | 843 | 981 | 860 | 1280 | 1058 | 389 | Decorative yard equipment, excluding water features | |
1506 | 586 | 446 | 950 | 1177 | 1206 | 1037 | 706 | 732 | 1145 | 633 | 965 | 1017 | Baby gates or barriers | |
1519 | 1065 | 880 | 1258 | 1063 | 1536 | 949 | 1322 | 696 | 943 | 1433 | 987 | 757 | Car seats (for infants or children) | |
1522 | 295 | 493 | 1072 | 1195 | 1115 | 1188 | 1641 | 1641 | 1845 | 1588 | 280 | 932 | Baby strollers | |
1543 | 690 | 702 | 692 | 586 | 705 | 991 | 786 | 525 | 448 | 639 | 411 | 577 | NA | |
1555 | 833 | 309 | 761 | 910 | 367 | 543 | 836 | 846 | 832 | 671 | 850 | 830 | NA | |
1615 | 10853 | 9255 | 12145 | 11849 | 14229 | 15045 | 14030 | 13598 | 13680 | 12928 | 9615 | 9715 | Footwear | |
1616 | 7664 | 8419 | 8685 | 8719 | 9547 | 9005 | 7372 | 9236 | 7779 | 7854 | 7439 | 7763 | Jewelry (excluding watches) | |
1623 | 766 | 1102 | 1059 | 762 | 1517 | 1339 | 2319 | 2151 | 1055 | 1055 | 1098 | 1653 | Luggage (excluding foot lockers) | |
1645 | 5339 | 3817 | 4815 | 5489 | 4801 | 3527 | 4625 | 4465 | 5015 | 5025 | 5773 | 5514 | Day wear | |
1647 | 997 | 1212 | 792 | 788 | 632 | 1013 | 701 | 1342 | 1062 | 1344 | 1298 | 1013 | Clothing accessories | |
1650 | 719 | 1239 | 1027 | 915 | 707 | 553 | 522 | 715 | 624 | 882 | 1180 | 799 | Desk supplies (excluding pens and pencils) | |
1658 | 1502 | 1568 | 1604 | 1786 | 1778 | 1577 | 1489 | 1770 | 1588 | 2073 | 2101 | 1698 | Clothing, not specified | |
1659 | 1188 | 1117 | 1525 | 1688 | 1415 | 1836 | 1536 | 1437 | 1437 | 1134 | 1681 | 1308 | Manicuring devices | |
1661 | 2292 | 2722 | 3339 | 3446 | 3501 | 3101 | 2895 | 2254 | 3436 | 2522 | 2646 | 2609 | Nonelectric razors or shavers | |
1667 | 1279 | 1316 | 925 | 1590 | 1507 | 1232 | 1287 | 1426 | 1748 | 2022 | 1194 | 1530 | Razors or shavers, not specified | |
1669 | 712 | 601 | 758 | 852 | 758 | 1028 | 900 | 902 | 911 | 539 | 877 | 734 | Pins and needles (excluding safety pins and knitting needles) | |
1679 | 2357 | 2336 | 3114 | 3668 | 2837 | 2938 | 3113 | 3583 | 2362 | 2842 | 2593 | 3690 | Grocery or shopping carts | |
1682 | 1117 | 931 | 1313 | 1292 | 1112 | 1009 | 1296 | 1444 | 1420 | 1698 | 1601 | 1628 | Hair curlers, curling irons, clips & hairpins | |
1684 | 633 | 656 | 438 | 661 | 195 | 1232 | 1020 | 654 | 802 | 585 | 738 | 945 | Carts, other or not specified | |
1685 | 1233 | 1281 | 1384 | 1530 | 1884 | 1020 | 812 | 797 | 2097 | 1558 | 2113 | 1503 | Pens and pencils | |
1686 | 3015 | 2406 | 2557 | 2607 | 3263 | 3673 | 3926 | 3607 | 3449 | 2149 | 2561 | 3137 | Coins | |
1715 | 3508 | 3345 | 3963 | 4988 | 5118 | 4086 | 4474 | 6203 | 4366 | 5416 | 4643 | 5389 | Pet supplies (excluding foods and medicines) | |
1726 | 515 | 639 | 753 | 1183 | 1117 | 341 | 0 | 295 | 1090 | 847 | 873 | 1056 | Lockers | |
1738 | 609 | 368 | 459 | 737 | 728 | 561 | 752 | 684 | 432 | 678 | 677 | 544 | Public equipment, not elsewhere classified (including conveyor belts, signs) | |
1744 | 321 | 791 | 526 | 947 | 928 | 1628 | 1123 | 1444 | 1465 | 1482 | 1024 | 1030 | Motorized vehicles, not elsewhere classified (three or more wheels) | |
1807 | 86820 | 76833 | 83738 | 80303 | 91455 | 85455 | 107129 | 102229 | 99759 | 104222 | 100501 | 112984 | Floors or flooring materials | |
1812 | 574 | 89 | 236 | 540 | 461 | 863 | 551 | 638 | 676 | 569 | 243 | 696 | Gutters, drainpipes, downspouts or run-off pipes | |
1817 | 8088 | 6774 | 7364 | 9741 | 13695 | 13481 | 16767 | 13252 | 12106 | 10920 | 9018 | 8418 | Porches, balconies, open-side floors or floor openings | |
1819 | 4927 | 4202 | 7271 | 9047 | 12378 | 12090 | 14490 | 10302 | 9042 | 8113 | 6486 | 5087 | Nails, screws, tacks or bolts | |
1820 | 1146 | 715 | 1514 | 1182 | 1398 | 1240 | 1293 | 1094 | 1268 | 1219 | 833 | 1112 | Cabinet or door hardware | |
1829 | 2251 | 2034 | 2308 | 2476 | 3324 | 2815 | 2426 | 2452 | 3263 | 1941 | 1968 | 2140 | Handrails, railings or banisters | |
1842 | 98702 | 86513 | 92424 | 88509 | 96657 | 91862 | 91084 | 93370 | 95587 | 98626 | 101966 | 100043 | Stairs or steps | |
1843 | 1131 | 641 | 1615 | 887 | 966 | 705 | 1385 | 1507 | 1282 | 1493 | 1377 | 1171 | Ramps or landings | |
1864 | 3748 | 3500 | 3841 | 2974 | 3474 | 3030 | 4275 | 3739 | 3420 | 3997 | 4127 | 3520 | Counters or countertops (excluding bars) | |
1865 | 1652 | 2378 | 2680 | 3664 | 4537 | 2646 | 3006 | 3586 | 2957 | 3413 | 3374 | 2153 | Poles | |
1866 | 1326 | 1046 | 1845 | 812 | 1006 | 806 | 1089 | 1160 | 1481 | 588 | 680 | 1288 | General home or room involvement in fires | |
1870 | 1483 | 597 | 1273 | 1313 | 1776 | 1089 | 1687 | 542 | 1402 | 912 | 887 | 818 | Windowsills or frames | |
1871 | 4298 | 4404 | 7927 | 9195 | 11452 | 12207 | 10875 | 10590 | 9180 | 8767 | 7209 | 5313 | Fences or fence posts | |
1876 | 421 | 1121 | 1113 | 794 | 1631 | 1227 | 1258 | 1702 | 1565 | 1309 | 774 | 476 | House repair or construction materials, not elsewhere classified | |
1878 | 4617 | 3601 | 4216 | 4051 | 5256 | 4015 | 4382 | 4555 | 4503 | 3812 | 4324 | 4768 | Doorsills or frames | |
1884 | 21860 | 20062 | 23490 | 21906 | 25648 | 22233 | 25910 | 24005 | 22839 | 24923 | 25449 | 26402 | Ceilings and walls | |
1886 | 1300 | 525 | 808 | 822 | 1263 | 807 | 1704 | 1337 | 910 | 1290 | 1045 | 1156 | Garage doors (excluding automatic garage doors or door openers) | |
1887 | 258 | 334 | 527 | 499 | 923 | 339 | 929 | 242 | 470 | 442 | 569 | 246 | Tool sheds | |
1889 | 295 | 843 | 657 | 543 | 761 | 1061 | 1303 | 1781 | 966 | 909 | 769 | 563 | Elevators or other lifts | |
1890 | 1075 | 698 | 914 | 1016 | 1274 | 1236 | 757 | 837 | 996 | 795 | 1252 | 1307 | Escalators | |
1892 | 1276 | 1718 | 2010 | 1374 | 1815 | 3009 | 2974 | 3223 | 2258 | 1372 | 2271 | 2037 | Glass doors or doors with glass panels | |
1893 | 19352 | 17162 | 24451 | 22640 | 25597 | 24228 | 25121 | 24188 | 23110 | 22122 | 22057 | 20122 | Doors, other or not specified | |
1894 | 4724 | 4528 | 6704 | 7236 | 9727 | 11460 | 11774 | 9433 | 9444 | 7593 | 6873 | 5657 | Windows and window glass, other than storm windows | |
1928 | 441 | 663 | 712 | 739 | 522 | 202 | 189 | 420 | 379 | 337 | 754 | 460 | Antihistamines | |
1930 | 557 | 435 | 977 | 769 | 545 | 372 | 582 | 876 | 226 | 640 | 1146 | 884 | Aspirin substitutes | |
1931 | 2545 | 2055 | 2946 | 2020 | 2575 | 2735 | 2539 | 3650 | 1813 | 2683 | 2500 | 1757 | Tablet or capsule drugs | |
1932 | 378 | 373 | 349 | 472 | 607 | 483 | 706 | 748 | 344 | 460 | 342 | 660 | Other drugs or medications | |
1934 | 2362 | 3257 | 3235 | 2084 | 3361 | 3157 | 2806 | 2648 | 3003 | 2542 | 2394 | 3908 | Hot water | |
1936 | 753 | 440 | 503 | 872 | 385 | 649 | 646 | 591 | 270 | 555 | 290 | 121 | BBs or pellets | |
3200 | 0 | 0 | 14 | 160 | 775 | 1352 | 2067 | 1355 | 566 | 347 | 0 | 0 | Water tubing | |
3215 | 374 | 454 | 764 | 1144 | 1313 | 1463 | 1925 | 1968 | 1470 | 1366 | 1122 | 335 | Mopeds or power-assisted cycles | |
3216 | 5281 | 5750 | 6735 | 5485 | 5628 | 3759 | 3738 | 3249 | 3588 | 4313 | 3562 | 2745 | Roller skating (activity, apparel or equipment) | |
3219 | 1161 | 377 | 1967 | 1955 | 3521 | 2701 | 3099 | 2982 | 2699 | 2396 | 1505 | 1013 | Other playground equipment | |
3223 | 1270 | 2267 | 3498 | 5502 | 9489 | 9932 | 11338 | 8195 | 5752 | 3474 | 1928 | 1674 | Fishing (activity, apparel or equipment) | |
3234 | 1667 | 917 | 1192 | 1241 | 1371 | 571 | 311 | 284 | 2290 | 1466 | 444 | 80 | Rugby (activity, apparel or equipment) | |
3235 | 1909 | 2036 | 2892 | 3069 | 4535 | 3656 | 2457 | 2189 | 2861 | 3213 | 2487 | 2061 | Other ball sports (activity, apparel or equipment) | |
3236 | 563 | 563 | 1230 | 1366 | 1388 | 833 | 451 | 685 | 753 | 1228 | 882 | 469 | Ball sports (activity, apparel or equipment), not specified | |
3246 | 1431 | 1294 | 2957 | 5976 | 7237 | 6672 | 6090 | 6029 | 5058 | 5625 | 1562 | 1180 | Swings or swing sets (excluding portable baby swings) | |
3249 | 323 | 315 | 764 | 513 | 1269 | 1640 | 1430 | 944 | 1069 | 873 | 259 | 145 | Grills, not specified | |
3251 | 374 | 377 | 363 | 572 | 1585 | 2826 | 3879 | 2018 | 1219 | 681 | 249 | 573 | Built-in swimming pools | |
3254 | 3527 | 2376 | 2147 | 1123 | 1368 | 1691 | 2008 | 2832 | 5116 | 6881 | 3713 | 2801 | Cheerleading (activity, apparel or equipment) | |
3255 | 4648 | 3330 | 1818 | 642 | 381 | 375 | 623 | 508 | 504 | 896 | 2234 | 4081 | Ice skating (activity, apparel or equipment) | |
3257 | 2493 | 2165 | 2709 | 2713 | 2229 | 2419 | 2035 | 2067 | 2277 | 3482 | 3001 | 1785 | Martial arts (activity, apparel or equipment) | |
3259 | 251 | 461 | 618 | 971 | 1413 | 1474 | 1499 | 1800 | 863 | 1030 | 339 | 463 | Go-carts | |
3265 | 8285 | 7432 | 9161 | 9972 | 8837 | 7704 | 8676 | 8096 | 8356 | 8469 | 6348 | 6496 | Weight lifting (activity, apparel or equipment) | |
3272 | 2972 | 2832 | 2708 | 2254 | 2514 | 1172 | 1371 | 951 | 1502 | 2798 | 2774 | 2141 | Hockey (activity, apparel or equipment), not specified | |
3273 | 898 | 1565 | 1317 | 2223 | 2655 | 2251 | 2164 | 2154 | 2151 | 2000 | 1400 | 1192 | Playground equipment, not specified | |
3274 | 859 | 1127 | 1827 | 2716 | 5064 | 16195 | 20863 | 12005 | 4577 | 2082 | 1337 | 842 | Swimming (activity, apparel or equipment; excluding flotation devices) | |
3277 | 5198 | 5029 | 6315 | 5595 | 4527 | 4282 | 4405 | 5279 | 6032 | 4081 | 4231 | 4235 | Exercise equipment (excluding weight lifting or gymnastic equipment) | |
3278 | 3797 | 4661 | 4458 | 3894 | 4172 | 4553 | 3109 | 5284 | 5048 | 5268 | 4841 | 4323 | Dancing (activity, apparel or equipment) | |
3283 | 9740 | 13131 | 8630 | 1395 | 29 | 0 | 0 | 0 | 0 | 0 | 160 | 2907 | Snow skiing (activity, apparel or equipment) | |
3284 | 1294 | 1221 | 1420 | 1957 | 2054 | 1608 | 2280 | 1510 | 1830 | 1848 | 1409 | 912 | Tennis (activity, apparel or equipment) | |
3286 | 2745 | 3795 | 5521 | 7147 | 8753 | 8860 | 10057 | 7637 | 8303 | 6319 | 4449 | 4629 | All-terrain vehicles (four wheels) | |
3287 | 851 | 1605 | 1718 | 2234 | 2932 | 1463 | 2934 | 2619 | 2246 | 1833 | 1364 | 885 | All-terrain vehicles (number of wheels not specified) | |
3294 | 0 | 0 | 0 | 478 | 1275 | 1515 | 1599 | 1553 | 269 | 170 | 0 | 0 | Water slides, backyard/home | |
3297 | 552 | 806 | 1083 | 1255 | 1017 | 1553 | 1047 | 1174 | 1009 | 1010 | 408 | 626 | In-line skating (activity, apparel or equipment) | |
3299 | 18499 | 16244 | 24033 | 25372 | 24955 | 27733 | 30639 | 30000 | 30455 | 27087 | 21243 | 19582 | Exercise | |
4004 | 1612 | 1219 | 1907 | 2027 | 2309 | 2061 | 2910 | 2637 | 2579 | 1698 | 1416 | 1074 | Mirrors or mirror glass (excluding lighted make-up mirrors) | |
4010 | 800 | 658 | 1579 | 729 | 818 | 1222 | 705 | 1388 | 779 | 1507 | 1077 | 1562 | Mattresses, not specified | |
4014 | 6551 | 8028 | 7419 | 8189 | 8591 | 9195 | 9903 | 8837 | 10378 | 9827 | 8489 | 8529 | Furniture, not specified | |
4016 | 204 | 383 | 77 | 227 | 752 | 1231 | 711 | 582 | 766 | 560 | 648 | 745 | Beach chairs or folding chairs | |
4025 | 1003 | 811 | 1203 | 1017 | 1373 | 1226 | 1890 | 764 | 1251 | 798 | 1149 | 1887 | Barstools or kitchen stools | |
4047 | 626 | 582 | 768 | 655 | 664 | 537 | 806 | 665 | 781 | 806 | 724 | 463 | Books, magazines, albums or scrapbooks | |
4050 | 222 | 492 | 707 | 436 | 739 | 612 | 837 | 626 | 450 | 799 | 361 | 686 | Pillows (excluding water pillows) | |
4051 | 711 | 460 | 258 | 509 | 806 | 642 | 552 | 877 | 790 | 736 | 855 | 403 | Sheets or pillowcases | |
4056 | 9231 | 8266 | 8635 | 9147 | 9554 | 10804 | 10953 | 10860 | 10166 | 10361 | 9729 | 10626 | Cabinets, racks, room dividers and shelves, not elsewhere classified | |
4057 | 18788 | 16902 | 21672 | 19479 | 21152 | 20886 | 23089 | 24441 | 21601 | 21989 | 21813 | 21990 | Tables | |
4071 | 685 | 491 | 485 | 754 | 631 | 945 | 828 | 752 | 447 | 408 | 717 | 281 | Floor lamps or table lamps, electric (excluding halogen lamps) | |
4074 | 21697 | 21035 | 25191 | 25328 | 24813 | 24008 | 25376 | 27605 | 27043 | 27129 | 26892 | 27555 | Chairs, other or not specified | |
4075 | 677 | 483 | 533 | 725 | 132 | 362 | 1204 | 231 | 460 | 722 | 1075 | 597 | Bed rails | |
4076 | 49358 | 42112 | 46384 | 46551 | 51685 | 51895 | 54499 | 58648 | 57664 | 52501 | 55810 | 53195 | Beds or bedframes, other or not specified | |
4077 | 681 | 717 | 546 | 935 | 1326 | 1100 | 501 | 887 | 983 | 1272 | 967 | 537 | Extension or straight ladders | |
4078 | 8203 | 6701 | 8922 | 11251 | 13939 | 14515 | 15409 | 14157 | 13982 | 15769 | 14727 | 12726 | Ladders, other or not specified | |
4079 | 952 | 260 | 360 | 701 | 574 | 477 | 880 | 498 | 739 | 586 | 789 | 917 | Footstools, ottomans or hassocks | |
4080 | 1540 | 1313 | 1897 | 1898 | 1911 | 2082 | 1852 | 2137 | 2339 | 2503 | 3066 | 2483 | Stools, other or not specified | |
4081 | 594 | 525 | 739 | 784 | 665 | 696 | 1088 | 556 | 771 | 1231 | 1045 | 1296 | Cords, electrical, other or not specified | |
5011 | 485 | 794 | 1127 | 669 | 588 | 709 | 319 | 1175 | 1300 | 682 | 754 | 448 | Book bags or back carriers (excluding baby carriers, luggage and camping equipment) | |
5016 | 1203 | 890 | 1403 | 1892 | 2177 | 2310 | 1380 | 1714 | 1564 | 1207 | 1010 | 1508 | Balls, other or not specified | |
5017 | 288 | 418 | 676 | 894 | 1081 | 1067 | 1082 | 1301 | 1265 | 860 | 729 | 246 | Flying discs and boomerangs | |
5021 | 606 | 961 | 1058 | 1043 | 682 | 729 | 1044 | 1637 | 902 | 1196 | 1091 | 865 | Toy vehicles (excluding riding toys) | |
5030 | 903 | 1617 | 3971 | 6522 | 5616 | 1078 | 910 | 1113 | 2435 | 2633 | 1260 | 577 | Track and field (activity, apparel or equipment) | |
5031 | 10190 | 9504 | 5819 | 883 | 102 | 0 | 0 | 0 | 98 | 98 | 856 | 3824 | Snow boarding (activity, apparel or equipment) | |
5033 | 501 | 353 | 246 | 479 | 890 | 1096 | 935 | 1311 | 876 | 1034 | 339 | 644 | Mountain or all-terrain bicycles or accessories | |
5034 | 1491 | 3683 | 8393 | 14695 | 14699 | 14493 | 9804 | 8511 | 7971 | 6468 | 2910 | 1413 | Softball (activity, apparel or equipment) | |
5036 | 1494 | 1974 | 3267 | 5648 | 7294 | 5434 | 5982 | 6824 | 5773 | 4094 | 2542 | 2159 | Two-wheeled, powered, off-road vehicles | |
5040 | 17671 | 19029 | 29568 | 44724 | 57226 | 63045 | 62125 | 63793 | 49957 | 40358 | 26171 | 21870 | Bicycles or accessories | |
5041 | 1778 | 4824 | 11383 | 19692 | 26568 | 21130 | 14417 | 6765 | 7442 | 8086 | 4764 | 2057 | Baseball (activity, apparel or equipment) |
This file contains 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
body { | |
font: 14px 'Inconsolata', Monaco, "Lucida Console", Consolas, "Courier New"; | |
} | |
.projectTitle { | |
margin-left: 40px; | |
} | |
.projectDesc{ | |
margin-left: 40px; | |
font-size: 12px; | |
max-width: 800px; | |
margin-top: 14px; | |
} | |
.hidden { | |
display: none; | |
} | |
.product path { | |
fill: none; | |
stroke: blue; | |
stroke-linejoin: round; | |
stroke-linecap: round; | |
stroke-width: 0.8px; | |
} | |
.axis path { | |
stroke: grey; | |
stroke-width: .4px; | |
} | |
.title { | |
font-size: 12px; | |
} | |
.tick line { | |
stroke: grey; | |
stroke-width: .4px; | |
} | |
.tick text { | |
fill: grey; | |
stroke: none; | |
font-size: 8px; | |
} |
This file contains 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
"use strict"; | |
var selected = false; | |
var months, | |
monthFormat = d3.time.format("%m"); | |
var chartWidth = 200; | |
var chartHeight = 100; | |
var chartHeightMargin = 30; | |
var chartWidthMargin = 30; | |
var margin = { | |
top: 25, | |
right: 0, | |
bottom: 50, | |
left: 40 | |
}, | |
width = 1500 - margin.left - margin.right; | |
var numWide = Math.floor(width / (chartWidth + chartWidthMargin)) | |
var height = margin.top + margin.bottom + (chartHeight + chartHeightMargin) * 250 / numWide; | |
var max_radius = 14; | |
var countFormat = d3.format(",.1%"); | |
var x = d3.time.scale() | |
.range([0, chartWidth]); | |
//var y = d3.scale.linear().domain([-1, 7]).range([100, 0]) | |
//var y = d3.scale.linear().domain([-1, 1, 5, 8]).range([100, 60, 35, 0]) | |
var y = d3.scale.linear().domain([0, 1 / 6, .8]).range([chartHeight, chartHeight / 2, 0]) | |
var xAxis = d3.svg.axis() | |
.scale(x) | |
.orient('bottom') | |
.tickSize('4') | |
.tickFormat(d3.time.format("%b")); | |
var yAxis = d3.svg.axis() | |
.scale(y) | |
.orient('left') | |
.tickSize('4') | |
.tickValues([1 / 12, 1 / 6, .3, .5, .7]) | |
.tickFormat(d3.format(".1%")); | |
var yCat = d3.scale.linear().domain([0, 250 / numWide]).range([0, height - (chartHeight)]) | |
var xCat = d3.scale.linear().domain([0, 4]).range([0, (chartWidth + chartWidthMargin) * 4]) | |
var line = d3.svg.line() | |
.x(function(d) { | |
return x(d.date); | |
}) | |
.y(function(d) { | |
return y(d.valueSeasonal); | |
}); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width + margin.left + margin.right) | |
.attr("height", height + margin.top + margin.bottom) | |
.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
d3.tsv("products-monthly-2014-top250.tsv", type, function(error, products) { | |
console.log(products) | |
products.sort(function(a, b) { | |
return b.std - a.std | |
}) | |
x.domain(d3.extent(months)); | |
// Container for a product line and circles. | |
var product_container = svg.selectAll('.product') | |
.data(products) | |
.enter().append("g") | |
.attr("class", "product") | |
.attr("transform", function(d, i) { | |
return "translate(" + xCat(i % numWide) + "," + yCat(Math.floor(i / numWide)) + ")" | |
}) | |
.attr("id", function(d) { | |
return "p" + d.code; | |
}); | |
// | |
// Lines. | |
// | |
product_container.append('g') | |
.attr("transform", "translate(0," + y(0) + ")") | |
.attr("class", function(d) { | |
return "xAxis axis hidden id-" + d.code | |
}) | |
.append('g').call(xAxis); | |
product_container.append('g') | |
//.attr("transform", "translate(0," + (chartHeight - 25) + ")") | |
.attr("class", function(d) { | |
return "hidden axis id-" + d.code | |
}) | |
.append('g').call(yAxis); | |
product_container.append("path") | |
.attr("d", function(d) { | |
return line(d.values); | |
}) | |
.attr("class", function(d) { | |
return d.code; | |
}); | |
product_container.append("line") | |
.attr({ | |
'x2': chartWidth, | |
'y1': y(1 / 12), | |
'y2': y(1 / 12), | |
'stroke-dasharray': '5,5', | |
'stroke': 'grey', | |
'stroke-width': '.5px' | |
}) | |
product_container.append("line") | |
.attr({ | |
'x2': chartWidth, | |
'y1': y(0), | |
'y2': y(0), | |
'stroke': 'grey', | |
'stroke-width': '.5px' | |
}) | |
// | |
// Text | |
// | |
product_container.append('text') | |
.text(function(d) { | |
return d.name | |
}) | |
.attr({ | |
'x': 2, | |
'y': y(.73), | |
'class': function(d) { | |
return 'title hidden id-' + d.code | |
} | |
}) | |
product_container.append("rect") | |
.attr({ | |
'height': chartHeight, | |
'width': chartWidth, | |
'opacity': 0 | |
}) | |
.on('mouseover', function(d) { | |
d3.selectAll('.id-' + d.code).classed("hidden", false) | |
}) | |
.on('mouseout', function(d) { | |
d3.selectAll('.id-' + d.code).classed("hidden", true) | |
});; | |
}); // @end d3.tsv() | |
function type(d, i) { | |
var calculateStd = function(data, mean) { | |
conslole.log('here') | |
var sumSquaredDiff = 0; | |
return | |
} | |
months = d3.range(1, 13).map(function(d) { | |
return monthFormat.parse(String(d)); | |
}).filter(Number); | |
var product = { | |
code: d.Code, | |
name: d.Title, | |
values: null, | |
annualTotal: 0, | |
seasonalArray: [] | |
}; | |
for (var i = 1; i <= 12; i++) { | |
product.annualTotal = product.annualTotal + +d['m' + i] | |
} | |
product.mean = product.annualTotal / 12 | |
product.values = months.map(function(m) { | |
var value = Number(d['m' + Number(monthFormat(m))]) | |
var seasonal = value / product.annualTotal | |
//var seasonal = (value / (product.annualTotal / 12)) - 1 | |
product.seasonalArray.push(seasonal) | |
return { | |
product: product, | |
date: m, | |
value: value, | |
valueSeasonal: seasonal | |
} | |
}); | |
product.std = d3.deviation(product.seasonalArray) | |
return product; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment