Skip to content

Commit

Permalink
Hide tracker if content null or undefined.
Browse files Browse the repository at this point in the history
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 d43f856
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions js/plugins/hit.js
Expand Up @@ -296,7 +296,7 @@ Flotr.addPlugin('hit', {
container = options.mouse.container,
oTop = 0,
oLeft = 0,
offset, size;
offset, size, content;

// Create
if (!mouseTrack) {
Expand All @@ -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);
Expand Down

0 comments on commit d43f856

Please sign in to comment.