From: Robert Konigsberg Date: Thu, 2 Aug 2012 19:40:17 +0000 (-0400) Subject: Allow labelsDivWidth updates to be reflected in already-drawn graphs. X-Git-Tag: v1.0.0~205^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=de9ecc405c89626f6e3a01aec2458909d3ca2f81;hp=42b3b41f9df17ebdef993224863cbc0d3464acb1;p=dygraphs.git Allow labelsDivWidth updates to be reflected in already-drawn graphs. --- diff --git a/plugins/legend.js b/plugins/legend.js index c124c38..f16e632 100644 --- a/plugins/legend.js +++ b/plugins/legend.js @@ -151,8 +151,10 @@ legend.prototype.predraw = function(e) { // TODO(danvk): only use real APIs for this. e.dygraph.graphDiv.appendChild(this.legend_div_); var area = e.dygraph.plotter_.area; - this.legend_div_.style.left = area.x + area.w - e.dygraph.getOption("labelsDivWidth") - 1 + "px"; + var labelsDivWidth = e.dygraph.getOption("labelsDivWidth"); + this.legend_div_.style.left = area.x + area.w - labelsDivWidth - 1 + "px"; this.legend_div_.style.top = area.y + "px"; + this.legend_div_.style.width = labelsDivWidth + "px"; }; /**