Skip to content

Instantly share code, notes, and snippets.

@seyna
Last active December 19, 2015 04:09
Show Gist options
  • Save seyna/5895177 to your computer and use it in GitHub Desktop.
Save seyna/5895177 to your computer and use it in GitHub Desktop.
D3.js - 單純讀取 csv
<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>
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