summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sfiligoi <isfiligoi@ucsd.edu>2012-09-10 19:35:54 +0000
committerIgor Sfiligoi <isfiligoi@ucsd.edu>2012-09-10 19:35:54 +0000
commit969e56cd3a8143f325320873c9a332116c3a6f96 (patch)
tree7e6287e75bcee73c803b629dae7dfe371f017c66
parentbacc6a25b93c5fa76e873c9c2c2cddf6526dfe2e (diff)
Add the rrdflot_defaults.graph_only option to strip off any non-essential element
-rw-r--r--src/lib/rrdFlot.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js
index e607e6e..4379c03 100644
--- a/src/lib/rrdFlot.js
+++ b/src/lib/rrdFlot.js
@@ -50,6 +50,7 @@
* //overwrites other defaults; mostly used for linking via the URL
* rrdflot_defaults defaults (see Flot docs for details)
* {
+ * graph_only: false // If true, limit the display to the graph only
* legend: "Top" //Starting location of legend. Options are:
* // "Top","Bottom","TopRight","BottomRight","None".
* num_cb_rows: 12 //How many rows of DS checkboxes per column.
@@ -104,7 +105,11 @@ function rrdFlot(html_id, rrd_file, graph_options, ds_graph_options, rrdflot_def
this.createHTML();
this.populateRes();
this.populateDScb();
- this.drawFlotGraph()
+ this.drawFlotGraph();
+
+ if (this.rrdflot_defaults.graph_only==true) {
+ this.cleanHTMLCruft();
+ }
}
@@ -128,6 +133,7 @@ rrdFlot.prototype.createHTML = function() {
// Now create the layout
var external_table=document.createElement("Table");
+ this.external_table=external_table;
// Header two: resulution select and DS selection title
var rowHeader=external_table.insertRow(-1);
@@ -139,7 +145,7 @@ rrdFlot.prototype.createHTML = function() {
//forRes.onChange= this.callback_res_changed;
forRes.onchange= function () {rf_this.callback_res_changed();};
cellRes.appendChild(forRes);
-
+
var cellDSTitle=rowHeader.insertCell(-1);
cellDSTitle.appendChild(document.createTextNode("Select elements to plot:"));
@@ -242,6 +248,19 @@ rrdFlot.prototype.createHTML = function() {
base_el.appendChild(external_table);
};
+// ===============================================
+// Remove all HTMl elements but the graph
+rrdFlot.prototype.cleanHTMLCruft = function() {
+ var rf_this=this; // use obj inside other functions
+
+ // delete top and bottom rows... graph is in the middle
+ this.external_table.deleteRow(-1);
+ this.external_table.deleteRow(0);
+
+ var ds_el=document.getElementById(this.ds_cb_id);
+ ds_el.removeChild(ds_el.lastChild);
+}
+
// ======================================
// Populate RRA and RD info
rrdFlot.prototype.populateRes = function() {