From: Nick Downie Date: Mon, 9 Mar 2015 17:14:09 +0000 (+0000) Subject: Target src files from #142 X-Git-Tag: v1.0.2~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F982%2Fhead;p=thirdparty%2FChart.js.git Target src files from #142 --- diff --git a/src/Chart.Core.js b/src/Chart.Core.js index f5af352d4..69491892b 100755 --- a/src/Chart.Core.js +++ b/src/Chart.Core.js @@ -25,6 +25,25 @@ 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;