forked from JohnDelacour's block: d3.csv very simple example
Created
September 13, 2017 09:18
-
-
Save tgsuarez/95ad37ae0d86a463b4fcedf893edd633 to your computer and use it in GitHub Desktop.
d3.csv very simple example
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
license: mit |
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" /> | |
<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> |
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
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