working on hw 5
This commit is contained in:
42
hw5/js/script.js
Normal file
42
hw5/js/script.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// Loads in the table information from fifa-matches.json
|
||||
d3.json('data/fifa-matches.json').then(function(data) {
|
||||
//console.log(data);
|
||||
|
||||
// Loads in the tree information from fifa-tree.csv and calls
|
||||
// createTree(csvData) to render the tree.
|
||||
d3.csv("data/fifa-tree.csv").then(function(csvData) {
|
||||
//console.log(csvData);
|
||||
|
||||
//Create a unique "id" field for each game
|
||||
csvData.forEach(function (d, i) {
|
||||
d.id = d.Team + d.Opponent + i;
|
||||
});
|
||||
|
||||
//Create Tree Object
|
||||
let tree = new Tree();
|
||||
tree.createTree(csvData);
|
||||
|
||||
// Create Table Object and pass in reference to tree object
|
||||
// (for hover linking)
|
||||
let table = new Table(data,tree);
|
||||
|
||||
table.createTable();
|
||||
table.updateTable();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// //************************* HACKER VERSION *****************************
|
||||
// // Loads in fifa-matches.csv file, aggregates the data into the correct
|
||||
// // format, then calls the appropriate functions to create and populate
|
||||
// // the table.
|
||||
// d3.csv("data/fifa-matches.csv", function (error, matchesCSV) {
|
||||
|
||||
// // Loads in the tree information from fifa-tree.csv and calls
|
||||
// // createTree(csvData) to render the tree.
|
||||
// d3.csv("data/fifa-tree.csv", function (error, treeCSV) {
|
||||
// // ******* TODO: PART I *******
|
||||
// });
|
||||
// });
|
||||
// //*********************** END HACKER VERSION ***************************
|
||||
Reference in New Issue
Block a user