summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpyrocyon <pyrocyon>2011-08-22 22:23:32 +0000
committerpyrocyon <pyrocyon>2011-08-22 22:23:32 +0000
commit483085bdb3e61f8dc958689c6db1aae67d69eb35 (patch)
treeb7aae868a3ad94598469a5b21975ea5d203b7e36
parentdfb46413a1c562bdcff16d306c0cde1393bdecd7 (diff)
Fixing tooltip support.
-rw-r--r--src/lib/rrdFlot.js30
-rw-r--r--src/lib/rrdFlotMatrix.js31
2 files changed, 42 insertions, 19 deletions
diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js
index 82050c4..5743210 100644
--- a/src/lib/rrdFlot.js
+++ b/src/lib/rrdFlot.js
@@ -438,8 +438,6 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
// Legend
var oSelect=document.getElementById(this.legend_sel_id);
var legend_id=oSelect.options[oSelect.selectedIndex].value;
- var tooltip_enabled=this.graph_options.tooltip; //tooltip status
-
var graph_jq_id="#"+this.graph_id;
var scale_jq_id="#"+this.scale_id;
@@ -453,6 +451,27 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
tooltipOpts: { content: "<h4>%s</h4> Value: %y.3" },
grid: { hoverable: true },
};
+
+ if (this.graph_options!="None") {
+ if (typeof(this.graph_options.tooltip)=='boolean'&&this.graph_options.tooltip==true) {
+ //nothing
+ }
+ else if(typeof(this.graph_options.tooltip)=='boolean'&&this.graph_options.tooltip==false) {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
+ else if(typeof(this.graph_options.tooltip)=='undefined') {
+ //defaults to true
+ }
+ else {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
+ }
+ else {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
if (legend_id=="None") {
// do nothing
@@ -461,13 +480,6 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
graph_options.legend.position=legend_id;
}
- if (tooltip_enabled=="None"||tooltip_enabled==true) {
- //nothing is the default -> tooltips displayed
- } else if (tooltip_enabled==false) {
- graph_options.grid.hoverable=false;
- graph_options.tooltip=false;
- }
-
if (this.selection_range.isSet()) {
var selection_range=this.selection_range.getFlotRanges();
if(this.rrdflot_defaults.use_windows) {
diff --git a/src/lib/rrdFlotMatrix.js b/src/lib/rrdFlotMatrix.js
index 25fa4f3..5711394 100644
--- a/src/lib/rrdFlotMatrix.js
+++ b/src/lib/rrdFlotMatrix.js
@@ -375,8 +375,6 @@ rrdFlotMatrix.prototype.bindFlotGraph = function(flot_obj) {
// Legend
var oSelect=document.getElementById(this.legend_sel_id);
var legend_id=oSelect.options[oSelect.selectedIndex].value;
- var tooltip_enabled=this.graph_options.tooltip; //tooltip status.
-
var graph_jq_id="#"+this.graph_id;
var scale_jq_id="#"+this.scale_id;
@@ -390,7 +388,27 @@ rrdFlotMatrix.prototype.bindFlotGraph = function(flot_obj) {
tooltipOpts: { content: "<h4>%s</h4> Value: %y.3" },
grid: { hoverable: true },
};
-
+
+ if (this.graph_options!="None") {
+ if (typeof(this.graph_options.tooltip)=='boolean'&&this.graph_options.tooltip==true) {
+ //nothing
+ }
+ else if(typeof(this.graph_options.tooltip)=='boolean'&&this.graph_options.tooltip==false) {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
+ else if(typeof(this.graph_options.tooltip)=='undefined') {
+ //defaults to true
+ }
+ else {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
+ }
+ else {
+ graph_options.grid.hoverable=false;
+ graph_options.tooltip=false;
+ }
if (legend_id=="None") {
// do nothing
@@ -399,13 +417,6 @@ rrdFlotMatrix.prototype.bindFlotGraph = function(flot_obj) {
graph_options.legend.position=legend_id;
}
- if (tooltip_enabled=="None"||tooltip_enabled==true) {
- //nothing is the default -> tooltips displayed
- } else if (tooltip_enabled==false) {
- graph_options.grid.hoverable=false;
- graph_options.tooltip=false;
- }
-
if (this.selection_range.isSet()) {
var selection_range=this.selection_range.getFlotRanges();
graph_options.xaxis.min=selection_range.xaxis.from;