From: Evert Timberg Date: Mon, 31 Aug 2015 01:49:39 +0000 (-0400) Subject: Start testing the linear scale fit code X-Git-Tag: 2.0.0-alpha4~32^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8d585621696797aec1aeef037aa0725eecda9ed;p=thirdparty%2FChart.js.git Start testing the linear scale fit code --- diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index eaab69c6c..94dd0a3ac 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -329,16 +329,6 @@ return this.getPixelForValue(value); } - var offset = 0; - - for (var j = datasetIndex; j < this.data.datasets.length; j++) { - if (j === datasetIndex && value) { - offset += value; - } else { - offset = offset + value; - } - } - return this.getPixelForValue(value); }, diff --git a/test/mockContext.js b/test/mockContext.js index d8b8e41b8..8fa62436e 100644 --- a/test/mockContext.js +++ b/test/mockContext.js @@ -69,6 +69,10 @@ closePath: function() {}, fill: function() {}, lineTo: function(x, y) {}, + measureText: function(text) { + // return the number of characters * fixed size + return text ? { width: text.length * 10 } : {width: 0}; + }, moveTo: function(x, y) {}, quadraticCurveTo: function() {}, restore: function() {}, @@ -82,7 +86,7 @@ var addMethod = function(name, method) { scope[methodName] = function() { scope.record(name, arguments); - method.apply(scope, arguments); + return method.apply(scope, arguments); }; }