Last active
December 19, 2015 04:09
-
-
Save seyna/5895177 to your computer and use it in GitHub Desktop.
D3.js - 單純讀取 csv
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
<html> | |
<head> | |
<title>Simple Line Graph using SVG and d3.js</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
</head> | |
<body> | |
<script> | |
var dataset = []; | |
d3.csv("tmp.csv", function(data) { | |
dataset = data.map( function(d) { return [ +d["model year"], +d["origin"]]; }); | |
console.log(dataset); | |
}); | |
</script> | |
</body> | |
</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
car name | miles/gallon | cylinders | displacement | horsepower | weight | acceleration | model year | origin | |
---|---|---|---|---|---|---|---|---|---|
chevrolet chevelle malibu | 18 | 8 | 307 | 130 | 3504 | 12 | 70 | 1 | |
buick skylark 320 | 15 | 8 | 350 | 165 | 3693 | 11.5 | 70 | 1 | |
plymouth satellite | 18 | 8 | 318 | 150 | 3436 | 11 | 70 | 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment