From 51a88b90b30870b3629bb38ea25036d796039249 Mon Sep 17 00:00:00 2001 From: alisonjm Date: Thu, 21 Apr 2011 16:47:50 +0000 Subject: Added default object to rrdFlot function to allow default legend setting to be 'None'. --- src/lib/rrdFlot.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/lib/rrdFlot.js') diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js index 05b0813..42d5631 100644 --- a/src/lib/rrdFlot.js +++ b/src/lib/rrdFlot.js @@ -48,10 +48,15 @@ * } */ -function rrdFlot(html_id, rrd_file, graph_options, ds_graph_options) { +function rrdFlot(html_id, rrd_file, graph_options, ds_graph_options, rrdflot_defaults) { this.html_id=html_id; this.rrd_file=rrd_file; this.graph_options=graph_options; + if (rrdflot_defaults==null) { + this.rrdflot_defaults=new Object(); // empty object, just not to be null + } else { + this.rrdflot_defaults=rrdflot_defaults; + } if (ds_graph_options==null) { this.ds_graph_options=new Object(); // empty object, just not to be null } else { @@ -110,6 +115,8 @@ rrdFlot.prototype.createHTML = function() { cellGraph.appendChild(elGraph); var cellDScb=rowGraph.insertCell(-1); + + cellDScb.vAlign="top"; var formDScb=document.createElement("Form"); formDScb.id=this.ds_cb_id; @@ -125,11 +132,11 @@ rrdFlot.prototype.createHTML = function() { cellScaleLegend.appendChild(document.createElement('br')); var forScaleLegend=document.createElement("Select"); forScaleLegend.id=this.legend_sel_id; - forScaleLegend.appendChild(new Option("Top","nw")); - forScaleLegend.appendChild(new Option("Bottom","sw")); - forScaleLegend.appendChild(new Option("TopRight","ne")); - forScaleLegend.appendChild(new Option("BottomRight","se")); - forScaleLegend.appendChild(new Option("None","None")); + forScaleLegend.appendChild(new Option("Top","nw",this.rrdflot_defaults.legend=="Top")); + forScaleLegend.appendChild(new Option("Bottom","sw",this.rrdflot_defaults.legend=="Bottom")); + forScaleLegend.appendChild(new Option("TopRight","ne",this.rrdflot_defaults.legend=="TopRight")); + forScaleLegend.appendChild(new Option("BottomRight","se",this.rrdflot_defaults.legend=="BottomRight")); + forScaleLegend.appendChild(new Option("None","None",this.rrdflot_defaults.legend=="None")); forScaleLegend.onchange= function () {rf_this.callback_legend_changed();}; cellScaleLegend.appendChild(forScaleLegend); @@ -166,6 +173,7 @@ rrdFlot.prototype.populateRes = function() { // now populate with RRA info var nrRRAs=this.rrd_file.getNrRRAs(); for (var i=0; i