From c6f45033360faf6265be6532e3045bfcf2abcb8e Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Fri, 23 Apr 2010 15:26:16 -0700 Subject: [PATCH] some tweaks for divs with % sizes --- dygraph.js | 4 ++-- tests/resize.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dygraph.js b/dygraph.js index 5f344ba..6e72efe 100644 --- a/dygraph.js +++ b/dygraph.js @@ -187,10 +187,10 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { // convert that to an appropriate number of pixels. if (div.style.width.indexOf("%") == div.style.width.length - 1) { // Minus ten pixels keeps scrollbars from showing up for a 100% width div. - this.width_ = (this.width_ * self.innerWidth / 100) - 10; + this.width_ = div.offsetWidth; } if (div.style.height.indexOf("%") == div.style.height.length - 1) { - this.height_ = (this.height_ * self.innerHeight / 100) - 10; + this.height_ = div.offsetHeight; } // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_. diff --git a/tests/resize.html b/tests/resize.html index ab51fd2..13a9e3b 100644 --- a/tests/resize.html +++ b/tests/resize.html @@ -11,7 +11,7 @@ -
+