Skip to content

Instantly share code, notes, and snippets.

@dnprock
Last active August 29, 2015 14:24
Show Gist options
  • Save dnprock/ce5f3846fabe5efd158f to your computer and use it in GitHub Desktop.
Save dnprock/ce5f3846fabe5efd158f to your computer and use it in GitHub Desktop.
Multiple CSVs
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
position: relative;
}
</style>
<div id="canvas-svg"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
d3.csv("population.csv", function(err, pdata) {
d3.csv("obesity.csv", function(err, odata) {
console.log(pdata);
console.log(odata);
});
});
</script>
state_and_district_of_columbia obese_adults_number obese_adults overweight_incl_obese_adults_number overweight_incl_obese_adults obese_children_and_adolescents_number obese_children_and_adolescents obesity_rank_number
Alabama 30.1 30.10% 65.4 65.40% 16.7 16.70% 3
Alaska 27.3 27.30% 64.5 64.50% 11.1 11.10% 14
Arizona 23.3 23.30% 59.5 59.50% 12.2 12.20% 40
Arkansas 28.1 28.10% 64.7 64.70% 16.4 16.40% 9
California 23.1 23.10% 59.4 59.40% 13.2 13.20% 41
Colorado 21 21.00% 55 55.00% 9.9 9.90% 51
Connecticut 20.8 20.80% 58.7 58.70% 12.3 12.30% 49
District of Columbia 22.1 22.10% 55 55.00% 14.8 14.80% 43
Delaware 25.9 25.90% 63.9 63.90% 22.8 22.80% 22
Florida 23.3 23.30% 60.8 60.80% 14.4 14.40% 39
Georgia 27.5 27.50% 63.3 63.30% 16.4 16.40% 12
Hawaii 20.7 20.70% 55.3 55.30% 13.3 13.30% 50
Idaho 24.6 24.60% 61.4 61.40% 10.1 10.10% 31
Illinois 25.3 25.30% 61.8 61.80% 15.8 15.80% 26
Indiana 27.5 27.50% 62.8 62.80% 15.6 15.60% 11
Iowa 26.3 26.30% 63.4 63.40% 12.5 12.50% 19
Kansas 25.8 25.80% 62.3 62.30% 14 14.00% 23
Kentucky 28.4 28.40% 66.8 66.80% 20.6 20.60% 7
Louisiana 29.5 29.50% 64.2 64.20% 17.2 17.20% 4
Maine 23.7 23.70% 60.8 60.80% 12.7 12.70% 34
Maryland 25.2 25.20% 61.5 61.50% 13.3 13.30% 28
Massachusetts 20.9 20.90% 56.8 56.80% 13.6 13.60% 48
Michigan 27.7 27.70% 63.9 63.90% 14.5 14.50% 10
Minnesota 24.8 24.80% 61.9 61.90% 10.1 10.10% 30
Mississippi 34.4 34.40% 67.4 67.40% 17.8 17.80% 1
Missouri 27.4 27.40% 63.3 63.30% 15.6 15.60% 13
Montana 21.7 21.70% 59.6 59.60% 11.1 11.10% 45
Nebraska 26.5 26.50% 63.9 63.90% 11.9 11.90% 18
Nevada 23.6 23.60% 61.8 61.80% 12.4 12.40% 36
New Hampshire 23.6 23.60% 60.8 60.80% 12.9 12.90% 35
New Jersey 22.9 22.90% 60.5 60.50% 13.7 13.70% 42
New Mexico 23.3 23.30% 60.3 60.30% 16.8 16.80% 38
New York 23.5 23.50% 60 60.00% 15.3 15.30% 37
North Carolina 27.1 27.10% 63.4 63.40% 19.3 19.30% 16
North Dakota 25.9 25.90% 64.5 64.50% 12.1 12.10% 21
Ohio 26.9 26.90% 63.3 63.30% 14.2 14.20% 17
Oklahoma 28.1 28.10% 64.2 64.20% 15.4 15.40% 8
Oregon 25 25.00% 60.8 60.80% 14.1 14.10% 29
Pennsylvania 25.7 25.70% 61.9 61.90% 13.3 13.30% 24
Rhode Island 21.4 21.40% 60.4 60.40% 11.9 11.90% 46
South Carolina 29.2 29.20% 65.1 65.10% 18.9 18.90% 5
South Dakota 26.1 26.10% 64.2 64.20% 12.1 12.10% 20
Tennessee 29 29.00% 65 65.00% 20 20.00% 6
Texas 27.2 27.20% 64.1 64.10% 19.1 19.10% 15
Utah 21.8 21.80% 56.4 56.40% 8.5 8.50% 44
Vermont 21.1 21.10% 56.9 56.90% 11.3 11.30% 47
Virginia 25.2 25.20% 61.6 61.60% 13.8 13.80% 27
Washington 24.5 24.50% 60.7 60.70% 10.8 10.80% 32
West Virginia 30.6 30.60% 66.8 66.80% 20.9 20.90% 2
Wisconsin 25.5 25.50% 62.4 62.40% 13.5 13.50% 25
Wyoming 24 24.00% 61.7 61.70% 8.7 8.70% 33
state_or_territory population_estimate_for_july_1_2013_number census_population_april_1_2010_number census_population_april_1_2000_number
California 38332521 37253956 33871648
Texas 26448193 25145561 20851820
New York 19651127 19378102 18976457
Florida 19552860 18801310 15982378
Illinois 12882135 12830632 12419293
Pennsylvania 12773801 12702379 12281054
Ohio 11570808 11536504 11353140
Georgia 9992167 9687653 8186453
Michigan 9895622 9883640 9938444
North Carolina 9848060 9535483 8049313
New Jersey 8899339 8791894 8414350
Virginia 8260405 8001024 7078515
Washington 6971406 6724540 5894121
Massachusetts 6692824 6547629 6349097
Arizona 6626624 6392017 5130632
Indiana 6570902 6483802 6080485
Tennessee 6495978 6346105 5689283
Missouri 6044171 5988927 5595211
Maryland 5928814 5773552 5296486
Wisconsin 5742713 5686986 5363675
Minnesota 5420380 5303925 4919479
Colorado 5268367 5029196 4301261
Alabama 4833722 4779736 4447100
South Carolina 4774839 4625364 4012012
Louisiana 4625470 4533372 4468976
Kentucky 4395295 4339367 4041769
Oregon 3930065 3831074 3421399
Oklahoma 3850568 3751351 3450654
Puerto Rico 3615086 3725789 3808610
Connecticut 3596080 3574097 3405565
Iowa 3090416 3046355 2926324
Mississippi 2991207 2967297 2844658
Arkansas 2959373 2915918 2673400
Utah 2900872 2763885 2233169
Kansas 2893957 2853118 2688418
Nevada 2790136 2700551 1998257
New Mexico 2085287 2059179 1819046
Nebraska 1868516 1826341 1711263
West Virginia 1854304 1852994 1808344
Idaho 1612136 1567582 1293953
Hawaii 1404054 1360301 1211537
Maine 1328302 1328361 1274923
New Hampshire 1323459 1316470 1235786
Rhode Island 1051511 1052567 1048319
Montana 1015165 989415 902195
Delaware 925749 897934 783600
South Dakota 844877 814180 754844
Alaska 735132 710231 626932
North Dakota 723393 672591 642200
District of Columbia 646449 601723 572059
Vermont 626630 625741 608827
Wyoming 582658 563626 493782
Guam 159358; 1 154805
U.S. Virgin Islands 106405; 2 108612
American Samoa 55519; 3 57291
Northern Mariana Islands 53883; 4 69221
The Fifty States 315482390 308143815 280849847
50 States + D.C. 316128839 308745538 281421906
Total U.S. territory 312913872 285620445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment