Skip to content

Instantly share code, notes, and snippets.

@clairepapu
Created March 27, 2015 19:43
Show Gist options
  • Save clairepapu/baab4647d0cfabc09770 to your computer and use it in GitHub Desktop.
Save clairepapu/baab4647d0cfabc09770 to your computer and use it in GitHub Desktop.
Apples, bananas, grapes, oranges... what's your favorite?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Claire's SVG Example</title>
<style type="text/css">
body {
background-color: white;
font-family: Helvetica, Arial, sans-serif;
background-color: #FFFF99;
padding: 10px;
}
h1 {
font-size: 36px;
font-weight: normal;
}
h2 {
font-size: 24px;
font-weight: normal;
}
text {
font-family: verdana;
}
svg {
background-color: dimgray;}
</style>
</head>
<body>
<h1 align="left"> Apples, bananas, grapes, oranges-- <em>What's your favorite?</em> </h1>
<div align="center">
<svg width="600" height="450">
<circle cx="100" cy="140" r="60" fill="red" />
<text x="40" y="60" fill="white" font-size="22" font-weight="bold" font-family="cambria">Apples</text>
<circle cx="480" cy="178" r="75" fill="orange" stroke-width="6" stroke="purple" />
<text x="400" y="90" fill="white" font-size="22" font-weight="bold" font-family="cambria">Oranges</text>
<rect x="180" y="120" width="70" height="250" fill="yellow" stroke-width="10" stroke="blue"/>
<text x="160" y="100" fill="white" font-size="22" font-weight="bold" font-family="cambria">Bananas</text>
<text x="280" y="300" fill="white" font-size="22" font-weight="bold" font-family="cambria">Grapes</text>
<line x1="320" y1="100" x2="360" y2="80">
</line> stroke="green" stroke-width="15" />
<line x1="300" y1="190" x2="380" y2="12" stroke="green" stroke-width="25" />
<circle cx="300" cy="178" r="20" fill="violet" stroke-width="2" stroke="white" />
<circle cx="330" cy="190" r="20" fill="violet" stroke-width="2" stroke="white" />
<circle cx="310" cy="100" r="25" fill="violet" stroke-width="2" stroke="white" />
<circle cx="340" cy="220" r="28" fill="violet" stroke-width="2" stroke="white" />
<circle cx="340" cy="130" r="29" fill="violet" stroke-width="2" stroke="white" />
<circle cx="330" cy="245" r="24" fill="violet" stroke-width="2" stroke="white" />
text x="45" y="400" fill="white" font-size="60" font-weight="bold" font-family="Helvetica">imagine</text> <text x="300" y="400" fill="red" font-size="72" font-weight="bold">FRUIT</text>
</svg></div>
</body>
</html>
Race and ethnicity Total Fruit Apples Bananas Berries Grapes Melons Oranges Other Citrus Stone Fruit Tropical Fruit
White: All 268.72 42.40 27.17 10.21 18.61 30.67 79.10 24.36 16.98 11.93
White: At home 202.70 29.65 19.98 7.86 14.25 24.47 64.50 15.38 12.97 6.68
White: Away from home 66.02 12.75 7.19 2.34 4.36 6.20 14.60 8.98 4.01 5.25
Black: All 319.31 49.88 22.90 7.38 25.62 20.73 105.62 35.29 9.77 23.43
Black: At home 217.11 34.00 15.68 4.55 18.82 13.28 72.60 21.65 6.90 16.78
Black: Away from home 102.20 15.87 7.23 2.83 6.81 7.43 33.02 13.64 2.87 6.65
Hispanic: All 321.95 56.17 33.00 7.68 12.55 27.72 107.21 22.79 9.40 24.28
Hispanic: At home 236.59 41.16 27.23 5.89 9.02 18.58 81.28 13.83 6.01 16.56
Hispanic: Away from home 85.36 15.01 5.78 1.79 3.54 9.14 25.93 8.95 3.39 7.71
Other racial/ethnic: All 294.62 44.31 35.88 6.32 18.74 18.74 96.61 25.10 12.62 20.28
Other racial/ethnic: At home 211.40 30.58 26.41 3.94 13.97 14.12 70.46 15.11 8.90 14.94
Other racial/ethnic: Away from home 83.22 13.72 9.48 2.38 4.77 4.62 26.15 9.99 3.72 5.36
Retail weight pounds per year
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Loading CSV Data with D3</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
</head>
<body>
<p>Not much to see here; try looking in the console!</p>
<script type="text/javascript">
//Load in contents of CSV file
d3.csv("fruits-by-race-uploaded-to-gist-FINAL.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