Skip to content

Commit 99bdcb8

Browse files
committed
FlotTooltip: Expose a function to hide tooltips (https://rbcommons.com/s/pepperdata/r/2369)
Add a function to the plot object that calls hideTooltip
1 parent 36c5dec commit 99bdcb8

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

examples/many_series.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ <h1>flot.tooltip plugin example page</h1>
2525

2626
<div id="placeholder" style="width: 825px; height: 150px;"></div>
2727
<a href="javascript:void(0);" class="button" id="replot">Plot</a>
28+
<a href="javascript:void(0);" class="button" id="hidesticky">hidesticky</a>
2829

2930
<script type="text/javascript">
3031
$(document).ready(function(){
@@ -80,6 +81,11 @@ <h1>flot.tooltip plugin example page</h1>
8081
var plotObj = $.plot( $("#placeholder"),
8182
[ { data: sin, label: "sin(x)"}, { data: cos, label: "cos(x)" } ],
8283
options );
84+
85+
function unsticky() {
86+
plotObj.plotTooltip.hideTooltip();
87+
}
88+
$("#hidesticky").click(unsticky)
8389
}
8490
});
8591
</script>

js/jquery.flot.tooltip.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* author: Krzysztof Urbas @krzysu [myviews.pl]
77
* website: https://github.com/krzysu/flot.tooltip
88
*
9-
* build on 2013-12-20
9+
* build on 2014-01-02
1010
* released under MIT License, 2012
1111
*/
1212
(function ($) {
@@ -151,6 +151,9 @@
151151
that.stickyItem = null;
152152
}
153153
}
154+
155+
// add public functions
156+
that.plot.plotTooltip = { hideTooltip: hideTooltip};
154157
};
155158

156159
/**

js/jquery.flot.tooltip.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.flot.tooltip.source.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@
140140
that.stickyItem = null;
141141
}
142142
}
143+
144+
// add public functions
145+
that.plot.plotTooltip = { hideTooltip: hideTooltip};
143146
};
144147

145148
/**

0 commit comments

Comments
 (0)