Last active
March 3, 2016 06:03
-
-
Save JohnDelacour/5571901 to your computer and use it in GitHub Desktop.
d3.csv very simple example
This file contains hidden or 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 hidden or 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