Previous Projects/Goal-Bilby-master/SourceCode&WARfile/WebContent/scripts/main.js
// To update the JSON Object form the tree
To update the JSON Object form the tree
To update the JSON Object form the tree
function createTree() {
	treeData = {
		"roles": document.getElementById("txtBoxActors").value,
		"qualities": document.getElementById("txtBoxQualities").value,
		"hearts": document.getElementById("txtBoxLikes").value,
		"spades": document.getElementById("txtBoxDislikes").value,
		"children": [],
		"name": document.getElementById("txtBoxGoal").value
	};
	var subGoals = document.getElementById("txtBoxSubGoals").value.split(",");
	for (var i = 0; i < subGoals.length; i++) {
		myObj = {
			"roles": "",
			"qualities": "",
			"hearts": "",
			"spades": "",
			"children": [],
			"name": subGoals[i]
		};
		if (myObj.name != "") {
			treeData["children"].push(myObj);
		}
	}
	root = d3.hierarchy(treeData);
	update(root);
}
function createTree ( ) { treeData = { "roles" : document . getElementById ( "txtBoxActors" ) . value , "qualities" : document . getElementById ( "txtBoxQualities" ) . value , "hearts" : document . getElementById ( "txtBoxLikes" ) . value , "spades" : document . getElementById ( "txtBoxDislikes" ) . value , "children" : [ ] , "name" : document . getElementById ( "txtBoxGoal" ) . value } ; var subGoals = document . getElementById ( "txtBoxSubGoals" ) . value . split ( "," ) ; for ( var i = 0 ; i < subGoals . length ; i ++ ) { myObj = { "roles" : "" , "qualities" : "" , "hearts" : "" , "spades" : "" , "children" : [ ] , "name" : subGoals [ i ] } ; if ( myObj . name != "" ) { treeData [ "children" ] . push ( myObj ) ; } } root = d3 . hierarchy ( treeData ) ; update ( root ) ; }
To update the JSON Object form the tree
To update the JSON Object form the tree