Skip to content

Instantly share code, notes, and snippets.

@danaoira
Last active June 29, 2017 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danaoira/f907fff78f2c7fca00c86a9e2e5cd80e to your computer and use it in GitHub Desktop.
Save danaoira/f907fff78f2c7fca00c86a9e2e5cd80e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<title>Barley Data</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
</style>
</head>
<body>
<script>
var callback = function(error, data) {
if (error) throw error;
console.log(data);
}
var convertCSV = function(row) {
var result = {};
for (var i in row) {
result[i] = +row[i];
if (isNaN(result[i])) {
result[i] = row[i];
}
}
return result;
}
// -----------------------------------------------------
var margin = { top: 20, right: 20, bottom: 20, left: 20 };
var width = 960 - margin.left - margin.right;
var height = 500 - margin.top - margin.bottom;
var url = "barleyfull.csv";
d3.csv(url, convertCSV, callback);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment