=default_num_curves) {
+ unchecked_label.push(data[i][0]);
+ }
to_plot.push({ data: curr_data, label: data[i][0]});
if ( i < (data.length/2))
- table_today.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("today", data[i][0])+" |
")
+ table_today.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("today", data[i][0], i |
")
else
- table_today2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("today", data[i][0])+" |
")
+ table_today2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("today", data[i][0], i |
")
}
plot_today = $.plot($("#graph-today"), to_plot, graph_options);
+ hide_unchecked_curves(plot_today, unchecked_label);
$("#graph-today").bind("plothover", function (event, pos, item) {
if (item) {
var date = new Date(item.datapoint[0]);
@@ -367,18 +373,23 @@ promises.push($.getJSON("{{ url_for('terms_plot_top_data') }}", { set: set_week,
var table = $("#table-week")
var table2 = $("#table-week2")
var to_plot = [];
+ var unchecked_label = [];
for(i=0; i=default_num_curves) {
+ unchecked_label.push(data[i][0]);
+ }
to_plot.push({ data: curr_data, label: data[i][0]});
if ( i < (data.length/2))
- table.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("week", data[i][0])+" |
")
+ table.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("week", data[i][0], i |
")
else
- table2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("week", data[i][0])+" |
")
+ table2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("week", data[i][0], i |
")
}
plot_week = $.plot($("#graph-week"), to_plot, graph_options);
+ hide_unchecked_curves(plot_week, unchecked_label);
$("#graph-week").bind("plothover", function (event, pos, item) {
if (item) {
var date = new Date(item.datapoint[0]);
@@ -400,18 +411,23 @@ promises.push($.getJSON("{{ url_for('terms_plot_top_data') }}", { set: set_month
var table = $("#table-month")
var table2 = $("#table-month2")
var to_plot = [];
+ var unchecked_label = [];
for(i=0; i=default_num_curves) {
+ unchecked_label.push(data[i][0]);
+ }
to_plot.push({ data: curr_data, label: data[i][0]});
if ( i < (data.length/2))
- table.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("month", data[i][0])+" |
")
+ table.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("month", data[i][0], i |
")
else
- table2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("month", data[i][0])+" |
")
+ table2.append(""+data[i][0]+" | "+data[i][2]+" | "+addbuttons(data[i][0])+" | "+addcheckbox("month", data[i][0], i |
")
}
plot_month = $.plot($("#graph-month"), to_plot, graph_options);
+ hide_unchecked_curves(plot_month, unchecked_label);
$("#graph-month").bind("plothover", function (event, pos, item) {
if (item) {
var date = new Date(item.datapoint[0]);
@@ -445,8 +461,9 @@ function addbuttons(term) {
"data-section=\"blacklistTerm\" data-term=\""+term+"\">";
}
-function addcheckbox(graph, term) {
- return "";
+function addcheckbox(graph, term, checked) {
+ var checked_text = checked ? "checked" : "";
+ return "";
}
function perform_operation(){
@@ -462,6 +479,20 @@ function perform_operation(){
});
}
+
+function hide_unchecked_curves(plot, unchecked_label) {
+ var graphData = plot.getData();
+ var index;
+ for(i=0; i