From: Dan Vanderkam Date: Sun, 10 Apr 2011 19:01:40 +0000 (-0400) Subject: only show visible series on the legend X-Git-Tag: v1.0.0~524^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=352c831093ca06e57f3ffb9dbd4e6fe4649034a6;hp=bafe040e9908bc7ab46bab27a7323cf52c4c3dd8;p=dygraphs.git only show visible series on the legend --- diff --git a/dygraph.js b/dygraph.js index f2bcaec..4227652 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1699,8 +1699,9 @@ Dygraph.prototype.generateLegendHTML_ = function(x, sel_points) { var labels = this.attr_('labels'); var html = ''; for (var i = 1; i < labels.length; i++) { + if (!this.visibility()[i - 1]) continue; var c = this.plotter_.colors[labels[i]]; - if (i > 1) html += (sepLines ? '
' : ' '); + if (html != '') html += (sepLines ? '
' : ' '); html += "—" + labels[i] + ""; }