From 352c831093ca06e57f3ffb9dbd4e6fe4649034a6 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Sun, 10 Apr 2011 15:01:40 -0400 Subject: [PATCH 1/1] only show visible series on the legend --- dygraph.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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] + ""; } -- 2.7.4