summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralisonjm <alisonjm>2011-04-21 19:53:18 +0000
committeralisonjm <alisonjm>2011-04-21 19:53:18 +0000
commitc7544a25aa1b328c433c43b4f1a90a5127b2eb64 (patch)
treeb694dd17317474af49d50653b10f2890cd03a16d
parent51a88b90b30870b3629bb38ea25036d796039249 (diff)
Added option to split checkboxes into columns.
-rw-r--r--src/lib/rrdFlot.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js
index 42d5631..6fbdc14 100644
--- a/src/lib/rrdFlot.js
+++ b/src/lib/rrdFlot.js
@@ -185,16 +185,21 @@ rrdFlot.prototype.populateRes = function() {
rrdFlot.prototype.populateDScb = function() {
var form_el=document.getElementById(this.ds_cb_id);
-
+
+ //Create a table within a table to arrange
+ // checkbuttons into two or more columns
var table_el=document.createElement("Table");
var row_el=table_el.insertRow(-1);
row_el.vAlign="top";
var cell_el=null; // will define later
+ if (this.rrdflot_defaults.num_legend_rows==null) {
+ this.rrdflot_defaults.num_legend_rows=8;
+ }
// now populate with DS info
var nrDSs=this.rrd_file.getNrDSs();
for (var i=0; i<nrDSs; i++) {
- if ((i%7)==0) { // one column every 15 elements
+ if ((i%this.rrdflot_defaults.num_legend_rows)==0) { // one column every x DSs
cell_el=row_el.insertCell(-1);
}
var ds=this.rrd_file.getDS(i);
@@ -221,15 +226,13 @@ rrdFlot.prototype.populateDScb = function() {
cb_el.name = "ds";
cb_el.value = name;
cb_el.checked = cb_el.defaultChecked = checked;
- //table_el.type = "checkbox";
- //table_el.name = "ds";
- //table_el.value = name;
- //table_el.checked = table_el.defaultChecked = checked;
- form_el.appendChild(cb_el);
- //form_el.appendChild(table_el);
- form_el.appendChild(document.createTextNode(title));
- form_el.appendChild(document.createElement('br'));
+ cell_el.appendChild(cb_el);
+ cell_el.appendChild(document.createTextNode(title));
+ cell_el.appendChild(document.createElement('br'));
+
+
}
+ form_el.appendChild(table_el);
};
// ======================================