Permalink
Browse files

Hide tracker if content null or undefined.

For #207.  If the user returns an empty string, I won't decide not to
show it.
  • Loading branch information...
cesutherland committed Mar 22, 2013
1 parent a7e2f4a commit d43f8566e84de3f3b7aa776dba3173a1246d438b
Showing with 9 additions and 3 deletions.
  1. +9 −3 js/plugins/hit.js
View
@@ -296,7 +296,7 @@ Flotr.addPlugin('hit', {
container = options.mouse.container,
oTop = 0,
oLeft = 0,
- offset, size;
+ offset, size, content;
// Create
if (!mouseTrack) {
@@ -309,15 +309,21 @@ Flotr.addPlugin('hit', {
if (!decimals || decimals < 0) decimals = 0;
if (x && x.toFixed) x = x.toFixed(decimals);
if (y && y.toFixed) y = y.toFixed(decimals);
- mouseTrack.innerHTML = n.mouse.trackFormatter({
+ content = n.mouse.trackFormatter({
x: x,
y: y,
series: n.series,
index: n.index,
nearest: n,
fraction: n.fraction
});
- D.show(mouseTrack);
+ if (_.isNull(content) || _.isUndefined(content)) {
+ D.hide(mouseTrack);
+ return;
+ } else {
+ mouseTrack.innerHTML = content;
+ D.show(mouseTrack);
+ }
// Positioning
size = D.size(mouseTrack);

0 comments on commit d43f856

Please sign in to comment.