Skip to content

Commit

Permalink
major code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit Gupta committed Apr 17, 2016
1 parent bd2514b commit 95a19fe
Showing 1 changed file with 92 additions and 65 deletions.
157 changes: 92 additions & 65 deletions model/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ <h1 class="Heading">OVERVIEW</h1>
}
}

myDataRef.on('value', function(snapshot) {

current_graph = $(".iron-selected").attr("href")
function update_graphs() {
current_graph = $(".iron-selected").attr("href")
current_graph = current_graph.substring(1, current_graph.length);
console.log(current_graph)
//console.log($(".iron-selected").value);
Expand All @@ -222,6 +221,33 @@ <h1 class="Heading">OVERVIEW</h1>
var averages = get_score(firebasepath, "nyuad")
d3.selectAll("#OverallVisualization > *").remove();
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
}

myDataRef.on('value', function(snapshot) {
update_graphs()
// current_graph = $(".iron-selected").attr("href")
// current_graph = current_graph.substring(1, current_graph.length);
// console.log(current_graph)
// //console.log($(".iron-selected").value);
// console.log("Change found.")
// //get_feature(firebasepath, "electricity")
// console.log(d3.select("svg"))
// //d3.select('svg').remove();
// //d3.select('svg').remove();
// console.log(d3.select("svg"))

// var x1 = get_org(firebasepath, "nyuad")
// console.log(x1)
// data = x1[current_graph]

// console.log(data)
// if (data) {
// d3.selectAll("#InputVisualization > *").remove();
// add_series_to_svg(data, parseDate, "#InputVisualization");
// }
// var averages = get_score(firebasepath, "nyuad")
// d3.selectAll("#OverallVisualization > *").remove();
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")

});
$('#submitButton').on('click', function () {
Expand Down Expand Up @@ -350,74 +376,75 @@ <h1 class="Heading">OVERVIEW</h1>
console.log("Tab was clicked!");

for (i in fields) {
console.log($("#" + fields[i]))
//console.log($("#" + fields[i]))
$("#" + fields[i]).val('');
}
update_graphs()



});
$('paper-tab[href="#water"]').on('click', function() {
d3.select("svg").remove();
d3.select("svg").remove();
d3.select("svg").remove();
var x1 = get_org(firebasepath, "nyuad")
data = x1["water"]
if (data) {
add_series_to_svg(data, parseDate, "#InputVisualization")
}
var averages = get_score(firebasepath, "nyuad")
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
});

$('paper-tab[href="#electricity"]').on('click', function() {
d3.select("svg").remove();
d3.select("svg").remove();
d3.select("svg").remove();
var x1 = get_org(firebasepath, "nyuad")
data = x1["electricity"]
if (data) {
add_series_to_svg(data, parseDate, "#InputVisualization")
}
var averages = get_score(firebasepath, "nyuad")
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
});
$('paper-tab[href="#waste"]').on('click', function() {
d3.select("svg").remove();
d3.select("svg").remove();
d3.select("svg").remove();
var x1 = get_org(firebasepath, "nyuad")
data = x1["oil"]
if (data) {
add_series_to_svg(data, parseDate, "#InputVisualization")
}
var averages = get_score(firebasepath, "nyuad")
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
});
$('paper-tab[href="#fuel"]').on('click', function() {
d3.select("svg").remove();
d3.select("svg").remove();
d3.select("svg").remove();
var x1 = get_org(firebasepath, "nyuad")
data = x1["fuel"]
if (data) {
add_series_to_svg(data, parseDate, "#InputVisualization")
}
var averages = get_score(firebasepath, "nyuad")
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
});
$('paper-tab[href="#food"]').on('click', function() {
d3.select("svg").remove();
d3.select("svg").remove();
d3.select("svg").remove();
var x1 = get_org(firebasepath, "nyuad")
data = x1["food"]
if (data) {
add_series_to_svg(data, parseDate, "#InputVisualization")
}
var averages = get_score(firebasepath, "nyuad")
add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
});
// $('paper-tab[href="#water"]').on('click', function() {
// d3.select("svg").remove();
// d3.select("svg").remove();
// d3.select("svg").remove();
// var x1 = get_org(firebasepath, "nyuad")
// data = x1["water"]
// if (data) {
// add_series_to_svg(data, parseDate, "#InputVisualization")
// }
// var averages = get_score(firebasepath, "nyuad")
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
// });

// $('paper-tab[href="#electricity"]').on('click', function() {
// d3.select("svg").remove();
// d3.select("svg").remove();
// d3.select("svg").remove();
// var x1 = get_org(firebasepath, "nyuad")
// data = x1["electricity"]
// if (data) {
// add_series_to_svg(data, parseDate, "#InputVisualization")
// }
// var averages = get_score(firebasepath, "nyuad")
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
// });
// $('paper-tab[href="#waste"]').on('click', function() {
// d3.select("svg").remove();
// d3.select("svg").remove();
// d3.select("svg").remove();
// var x1 = get_org(firebasepath, "nyuad")
// data = x1["oil"]
// if (data) {
// add_series_to_svg(data, parseDate, "#InputVisualization")
// }
// var averages = get_score(firebasepath, "nyuad")
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
// });
// $('paper-tab[href="#fuel"]').on('click', function() {
// d3.select("svg").remove();
// d3.select("svg").remove();
// d3.select("svg").remove();
// var x1 = get_org(firebasepath, "nyuad")
// data = x1["fuel"]
// if (data) {
// add_series_to_svg(data, parseDate, "#InputVisualization")
// }
// var averages = get_score(firebasepath, "nyuad")
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
// });
// $('paper-tab[href="#food"]').on('click', function() {
// d3.select("svg").remove();
// d3.select("svg").remove();
// d3.select("svg").remove();
// var x1 = get_org(firebasepath, "nyuad")
// data = x1["food"]
// if (data) {
// add_series_to_svg(data, parseDate, "#InputVisualization")
// }
// var averages = get_score(firebasepath, "nyuad")
// add_many_series_to_svg(averages, parseDate, "#OverallVisualization")
// });


function displayChatMessage(name, text) {
Expand Down

0 comments on commit 95a19fe

Please sign in to comment.