Skip to content

Instantly share code, notes, and snippets.

@JohnDelacour
Last active March 3, 2016 06:03
Show Gist options
  • Select an option

  • Save JohnDelacour/5571901 to your computer and use it in GitHub Desktop.

Select an option

Save JohnDelacour/5571901 to your computer and use it in GitHub Desktop.
d3.csv very simple example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<h1 id="output">
</h1>
<script>
var f = "test.csv"
d3.csv(f, function(d) {
return {
Name: d.Name, Surname: d.Surname, Age: d.Age,
};
}, function(error, rows) {
d3.select("#output")
.text(
rows[0].Name + " " +
rows[0].Surname + " " +
"is " + rows[0].Age + " years old")
});
</script>
</html>
Name Surname Age
Joe Smith 42
Alice Jones 29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment