Last active
August 29, 2015 14:18
-
-
Save nydame/4ebb274de261150fdf0f to your computer and use it in GitHub Desktop.
Exercise 2 for Data Visualization and Infographics with D3
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
County | Premature death Value | Adult obesity Value | Diabetes Value | Premature age-adjusted mortality Value | Median household income Value | |
---|---|---|---|---|---|---|
California | 5570 | 0.232 | 0.079 | 287.4 | 58322 | |
Alameda County | 5141 | 0.207 | 0.078 | 267.1 | 70209 | |
Amador County | 7504 | 0.23 | 0.098 | 350.3 | 51388 | |
Butte County | 7944 | 0.243 | 0.081 | 403.8 | 40748 | |
Calaveras County | 6938 | 0.258 | 0.091 | 323.2 | 50962 | |
Colusa County | 5945 | 0.226 | 0.078 | 299.8 | 49871 | |
Contra Costa County | 5257 | 0.237 | 0.076 | 263 | 74208 | |
Del Norte County | 9671 | 0.255 | 0.088 | 455.4 | 37305 | |
El Dorado County | 5170 | 0.203 | 0.081 | 259.9 | 68446 | |
Fresno County | 7010 | 0.294 | 0.09 | 351.9 | 41563 | |
Glenn County | 6819 | 0.268 | 0.078 | 353 | 41201 | |
Humboldt County | 8293 | 0.265 | 0.084 | 407.3 | 39837 | |
Imperial County | 5672 | 0.235 | 0.074 | 291.7 | 38185 | |
Inyo County | 7070 | 0.238 | 0.093 | 339.1 | 45748 | |
Kern County | 7631 | 0.278 | 0.078 | 394.4 | 45599 | |
Kings County | 6372 | 0.242 | 0.075 | 349.1 | 45464 | |
Lake County | 9804 | 0.267 | 0.1 | 479.7 | 35437 | |
Lassen County | 6849 | 0.256 | 0.075 | 383.3 | 47480 | |
Los Angeles County | 5464 | 0.213 | 0.077 | 281.4 | 52929 | |
Madera County | 6694 | 0.297 | 0.091 | 333.4 | 42054 | |
Marin County | 3782 | 0.154 | 0.055 | 189.2 | 88654 | |
Mariposa County | 7309 | 0.238 | 0.094 | 349.6 | 43166 | |
Mendocino County | 7975 | 0.248 | 0.077 | 380.1 | 41088 | |
Merced County | 6726 | 0.313 | 0.08 | 342.7 | 42552 | |
Modoc County | 9030 | 0.251 | 0.088 | 402.7 | 36724 | |
Mono County | 3891 | 0.208 | 0.066 | 166.8 | 53067 | |
Monterey County | 5216 | 0.228 | 0.069 | 253 | 56038 | |
Napa County | 5309 | 0.236 | 0.072 | 266.6 | 65698 | |
Nevada County | 5604 | 0.185 | 0.072 | 260 | 54230 | |
Orange County | 4396 | 0.204 | 0.074 | 230 | 71866 | |
Placer County | 4802 | 0.228 | 0.072 | 252.7 | 69521 | |
Plumas County | 7082 | 0.23 | 0.093 | 335.4 | 46450 | |
Riverside County | 5960 | 0.27 | 0.095 | 309.9 | 52416 | |
Sacramento County | 6447 | 0.277 | 0.092 | 337.3 | 52617 | |
San Benito County | 4955 | 0.243 | 0.074 | 267.7 | 60577 | |
San Bernardino County | 6760 | 0.282 | 0.085 | 356.9 | 50603 | |
San Diego County | 5143 | 0.231 | 0.075 | 270.9 | 60235 | |
San Francisco County | 5244 | 0.16 | 0.069 | 270.6 | 72093 | |
San Joaquin County | 7088 | 0.31 | 0.095 | 362.7 | 50431 | |
San Luis Obispo County | 5229 | 0.2 | 0.067 | 265.7 | 58427 | |
San Mateo County | 4135 | 0.2 | 0.072 | 218.3 | 81568 | |
Santa Barbara County | 5245 | 0.192 | 0.066 | 263.5 | 60683 | |
Santa Clara County | 3988 | 0.21 | 0.076 | 215.6 | 91195 | |
Santa Cruz County | 5109 | 0.201 | 0.06 | 257.6 | 65799 | |
Shasta County | 8358 | 0.28 | 0.09 | 419.6 | 44477 | |
Sierra County | 7607 | 0.234 | 0.095 | 374 | 45157 | |
Siskiyou County | 8516 | 0.233 | 0.088 | 389.3 | 36597 | |
Solano County | 6389 | 0.271 | 0.104 | 326.1 | 61976 | |
Sonoma County | 5233 | 0.225 | 0.066 | 273 | 59855 | |
Stanislaus County | 6810 | 0.308 | 0.083 | 359.3 | 46324 | |
Sutter County | 6862 | 0.259 | 0.084 | 348.5 | 46524 | |
Tehama County | 7902 | 0.26 | 0.089 | 378.2 | 38577 | |
Trinity County | 8555 | 0.251 | 0.095 | 410 | 35162 | |
Tulare County | 7367 | 0.295 | 0.074 | 372.1 | 40197 | |
Tuolumne County | 6682 | 0.227 | 0.079 | 321.8 | 46624 | |
Ventura County | 5058 | 0.219 | 0.071 | 253.4 | 71043 | |
Yolo County | 4891 | 0.229 | 0.07 | 275 | 51040 | |
Yuba County | 7940 | 0.305 | 0.077 | 433.5 | 41599 |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Loading CSV Data with D3</title> | |
<style type="text/css"> | |
body { | |
background-color: whitesmoke; | |
} | |
svg { | |
background-color: mistyrose | |
} | |
</style> | |
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> | |
</head> | |
<body> | |
<svg width="600" height="400"> | |
<line x1="10" y1="10" x2="10" y2="390" stroke="gray" stroke-width="3" /> | |
<line x1="50" y1="200" x2="590" y2="200" stroke="gray" stroke-width="3" /> | |
<rect x="200" y="10" width="100" height="100" fill="orange" /> | |
<circle cx="300" cy="120" r="60" fill="violet" /> | |
<circle cx="410" cy="60" r="40" fill="charcoal" /> | |
<circle cx="500" cy="350" r="40" fill="rebeccapurple" /> | |
<polygon points="550,300 525,350 575,350" fill="goldenrod" /> | |
<text x="208" y="100" fill="#ffffff" font-size="42" font-weight="bold" font-family="Impact">Nothing to see here…</text> | |
<text x="20" y="300" fill="#ffffff" font-size="42" font-weight="bold" font-family="Impact">check the console!</text> | |
</svg> | |
<script type="text/javascript"> | |
//Load in contents of CSV file | |
d3.csv("CA-diabetes-data.csv", function(data) { | |
//Now CSV contents have been transformed into | |
//an array of JSON objects. | |
//Log 'data' to the console, for verification. | |
console.log(data); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment