X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=plugins%2Flegend.js;h=99546821d6ba71d247c8961e4ce59ec28fc5bbea;hb=a22cc80916b6e165451995e1ae3ed4d36dc86eab;hp=3349969b843b9b8430ba00eb200e6e1e99074e8e;hpb=d6eb5c59dcbc22c942a266b57e95d3111db6fcae;p=dygraphs.git diff --git a/plugins/legend.js b/plugins/legend.js index 3349969..9954682 100644 --- a/plugins/legend.js +++ b/plugins/legend.js @@ -128,7 +128,7 @@ legend.prototype.select = function(e) { var xValue = e.selectedX; var points = e.selectedPoints; - if (e.dygraph.getOption("legendFollow")) { + if (e.dygraph.getOption("legend") === "follow") { // create floating legend div var area = e.dygraph.plotter_.area; var labelsDivWidth = e.dygraph.getOption("labelsDivWidth"); @@ -149,6 +149,7 @@ legend.prototype.select = function(e) { e.dygraph.graphDiv.appendChild(this.legend_div_); this.legend_div_.style.left = yAxisLabelWidth + leftLegend + "px"; this.legend_div_.style.top = topLegend + "px"; + this.legend_div_.style.display = "block"; } var html = generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_); @@ -157,9 +158,8 @@ legend.prototype.select = function(e) { legend.prototype.deselect = function(e) { - if(e.dygraph.getOption("legendFollow")) { - // return legend to the default non-floating position - this.predraw(e); + if (e.dygraph.getOption("legend") === "follow") { + this.legend_div_.style.display = "none"; } // Have to do this every time, since styles might have changed.