Skip to content

Instantly share code, notes, and snippets.

@mariceratti
Created April 2, 2015 01:39
Show Gist options
  • Save mariceratti/ec7c4393e7181a942d49 to your computer and use it in GitHub Desktop.
Save mariceratti/ec7c4393e7181a942d49 to your computer and use it in GitHub Desktop.
Mari's first SVG
<!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>Mari's first SVG</p>
<svg width="500" height="200">
<circle cx="90" cy="90" r="80" fill="blue" />
<rect x="80" y="80" width="100" height="100" fill="yellow" />
<text x="208" y="100" fill="orange" font-size="42" font-weight="bold" font-family="verdana">Mari's SVG</text>
</svg>
<script type="text/javascript">
//Load in contents of CSV file
d3.csv("tabelaMDGflorestasoceanosLAC.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>
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Goal 7: Ensure environmental sustainability;1990;1995;2000;2005;2010;2013
Forest area (% of land area);53.5;52.2;50.9;49.4;48.3;48.2
Marine protected areas (% of territorial waters);6;8;12;13;14;14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment