summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpyrocyon <pyrocyon>2011-08-15 22:25:40 +0000
committerpyrocyon <pyrocyon>2011-08-15 22:25:40 +0000
commita979994ca12b19f918953078278dfeab7e2a52b8 (patch)
treeabc5daa62e1f583dfd2b6839f4832bd9c8344837
parent1505ed4985384f2ac32ac2ddc82a4705f4aed7a1 (diff)
Added support for tooltips.
-rw-r--r--src/examples/rrdJFlot.html1
-rw-r--r--src/examples/rrdJFlotDefaults.html1
-rw-r--r--src/examples/rrdJFlotFilter.html1
-rw-r--r--src/examples/rrdJFlotFilterRRA.html1
-rw-r--r--src/examples/rrdJFlotTwo.html1
-rw-r--r--src/examples/rrdMatrixFlot.html1
-rw-r--r--src/lib/rrdFlot.js11
-rw-r--r--src/lib/rrdFlotMatrix.js11
8 files changed, 28 insertions, 0 deletions
diff --git a/src/examples/rrdJFlot.html b/src/examples/rrdJFlot.html
index 1e240db..4f8e87c 100644
--- a/src/examples/rrdJFlot.html
+++ b/src/examples/rrdJFlot.html
@@ -31,6 +31,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>RRD Graphs with Flot</title>
</head>
diff --git a/src/examples/rrdJFlotDefaults.html b/src/examples/rrdJFlotDefaults.html
index bb26cc9..6f81419 100644
--- a/src/examples/rrdJFlotDefaults.html
+++ b/src/examples/rrdJFlotDefaults.html
@@ -31,6 +31,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>RRD Graphs with Flot</title>
</head>
diff --git a/src/examples/rrdJFlotFilter.html b/src/examples/rrdJFlotFilter.html
index 9c904c2..07d8b13 100644
--- a/src/examples/rrdJFlotFilter.html
+++ b/src/examples/rrdJFlotFilter.html
@@ -35,6 +35,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>RRD Graphs with Flot</title>
</head>
diff --git a/src/examples/rrdJFlotFilterRRA.html b/src/examples/rrdJFlotFilterRRA.html
index 2519e53..66e0216 100644
--- a/src/examples/rrdJFlotFilterRRA.html
+++ b/src/examples/rrdJFlotFilterRRA.html
@@ -35,6 +35,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>RRD Graphs with Flot</title>
</head>
diff --git a/src/examples/rrdJFlotTwo.html b/src/examples/rrdJFlotTwo.html
index bd2a04b..135bf15 100644
--- a/src/examples/rrdJFlotTwo.html
+++ b/src/examples/rrdJFlotTwo.html
@@ -32,6 +32,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>RRD Graphs with Flot</title>
</head>
diff --git a/src/examples/rrdMatrixFlot.html b/src/examples/rrdMatrixFlot.html
index f0d59c0..d428f58 100644
--- a/src/examples/rrdMatrixFlot.html
+++ b/src/examples/rrdMatrixFlot.html
@@ -31,6 +31,7 @@
<script type="text/javascript" src="../../flot/jquery.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.js"></script>
<script type="text/javascript" src="../../flot/jquery.flot.selection.js"></script>
+ <script type="text/javascript" src="../../flot/jquery.flot.tooltip_0.4.2.js"></script>
<head>
<title>Graph multiple RRDs with Flot</title>
</head>
diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js
index 9743d41..82050c4 100644
--- a/src/lib/rrdFlot.js
+++ b/src/lib/rrdFlot.js
@@ -438,6 +438,7 @@ 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;
@@ -448,6 +449,9 @@ rrdFlot.prototype.bindFlotGraph = function(flot_obj) {
xaxis: { mode: "time" },
yaxis: { autoscaleMargin: 0.20},
selection: { mode: "x" },
+ tooltip: true,
+ tooltipOpts: { content: "<h4>%s</h4> Value: %y.3" },
+ grid: { hoverable: true },
};
if (legend_id=="None") {
@@ -457,6 +461,13 @@ 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 08c3239..25fa4f3 100644
--- a/src/lib/rrdFlotMatrix.js
+++ b/src/lib/rrdFlotMatrix.js
@@ -375,6 +375,7 @@ 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;
@@ -385,6 +386,9 @@ rrdFlotMatrix.prototype.bindFlotGraph = function(flot_obj) {
xaxis: { mode: "time" },
yaxis: { autoscaleMargin: 0.20},
selection: { mode: "x" },
+ tooltip: true,
+ tooltipOpts: { content: "<h4>%s</h4> Value: %y.3" },
+ grid: { hoverable: true },
};
@@ -395,6 +399,13 @@ 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;