]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Target src files from #142 982/head
authorNick Downie <hello@nickdownie.com>
Mon, 9 Mar 2015 17:14:09 +0000 (17:14 +0000)
committerNick Downie <hello@nickdownie.com>
Mon, 9 Mar 2015 17:14:09 +0000 (17:14 +0000)
src/Chart.Core.js

index f5af352d43e1ffc67983a35d9a7293ce4deb8fa0..69491892b2a2eaf2c8b6736852d839407ee6f4db 100755 (executable)
                this.ctx = context;
 
                //Variables global to the chart
+               var computeDimension = function(element,dimension)
+               {
+                       if (element['offset'+dimension])
+                       {
+                               return element['offset'+dimension];
+                       }
+                       else
+                       {
+                               return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
+                       }
+               }
+
+               var width = this.width = computeDimension(context.canvas,'Width');
+               var height = this.height = computeDimension(context.canvas,'Height');
+
+               // Firefox requires this to work correctly
+               context.canvas.width  = width;
+               context.canvas.height = height;
+
                var width = this.width = context.canvas.width;
                var height = this.height = context.canvas.height;
                this.aspectRatio = this.width / this.height;