Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Remove legend when no label to show
Browse files Browse the repository at this point in the history
  • Loading branch information
Ya-Lin Huang committed Apr 15, 2015
1 parent 67075e2 commit 35e1093
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions firefly/static/js/renderer.js
Expand Up @@ -883,15 +883,18 @@ firefly.Renderer.prototype.legend = function(sources, leftTrim, rightTrim) {
}

var dataServerDesc = that._dsDescFromSourcerer(source[0]);
var li = $("<li>").appendTo(ul);
var div = $("<div>").addClass("color").appendTo(li);

var displayedSourceComponents = source.slice(sliceStart, sliceEnd);
if (multipleDataServers)
displayedSourceComponents.unshift(dataServerDesc);

$(div).css("background-color", that.hsl(i / sources.length));
$("<span>").html(displayedSourceComponents.join(RIGHT_ARROW)).appendTo(li);
if (displayedSourceComponents.length > 0) {
// Present legend only when there is something to display
var li = $("<li>").appendTo(ul);
var div = $("<div>").addClass("color").appendTo(li);

$(div).css("background-color", that.hsl(i / sources.length));
$("<span>").html(displayedSourceComponents.join(RIGHT_ARROW)).appendTo(li);
}
});
$(this.legendEl).empty().append(ul);
this.resize();
Expand Down

0 comments on commit 35e1093

Please sign in to comment.