Create a gist now

Instantly share code, notes, and snippets.

This statistic depicts the amount of chocolate consumed per person in 2011, by country. In that year, each citizen of the United States consumed about 4.6 kilograms of chocolate.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Week1 homework chocolate data</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
</head>
<body>
<h1>Amount of chocolate consumed per person in 2011 by country in kilograms</h1>
<p>This statistic depicts the amount of chocolate consumed per person in 2011, by country.
In that year, each citizen of the United States consumed about 4.6 kilograms of chocolate.</p>
<p class="csvdata"></p>
<script>
d3.csv("data/week1.csv", function(data1) {
console.log("The first file is csv...")
console.log(data1);
$("p.csvdata").text(JSON.stringify(data1));
});
</script>
</body>
</html>
Country Kilograms per person
United Kindom 11
Ireland 9.6
Swizerland 9.5
Austria 7.5
Germany 7.5
Norway 6.9
Denmark 6.7
Sweden 5.6
Finland 5.5
Belgium 5.3
The Netherlands 5.2
Russian Federation 5
Australia 4.8
Poland 4.7
United States 4.6
New Zealand 4.3
France 4.2
Czech Republic 3.9
Canada 3.5
Chile 2.8
Italy 2.7
Spain 2.1
Turkey 1.6
Portugal 1.5
Brazil 1.5
Japan 1
Mexico 0.7
China 0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment