]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Alias the pixel for nicer drawing 1836/head
authorEvert Timberg <evert.timberg@gmail.com>
Mon, 28 Dec 2015 14:37:31 +0000 (09:37 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Mon, 28 Dec 2015 14:37:31 +0000 (09:37 -0500)
src/core/core.scale.js
test/scale.linear.tests.js

index 8b8d791cfae879a5f981c09f5eca76724b19d4be..532208fefdacbddf93c13bca3fb368796ff3ec81 100644 (file)
 
                                if (this.isHorizontal()) {
                                        y1 = y2 = this.options.position === 'top' ? this.bottom : this.top;
+                                       y1 += helpers.aliasPixel(this.ctx.lineWidth);
+                                       y2 += helpers.aliasPixel(this.ctx.lineWidth);
                                } else {
                                        x1 = x2 = this.options.position === 'left' ? this.right : this.left;
+                                       x1 += helpers.aliasPixel(this.ctx.lineWidth);
+                                       x2 += helpers.aliasPixel(this.ctx.lineWidth);
                                }
 
                                this.ctx.moveTo(x1, y1);
index cc36b7b188f77a7bb666034e7cc291b0faa8992d..5cceb21b708a13958f1b0ea1f8bca3d429c4bb8e 100644 (file)
@@ -986,10 +986,10 @@ describe('Linear Scale', function() {
                        "args": ["rgba(0, 0, 0, 0.1)"]
                }, {
                        "name": "moveTo",
-                       "args": [0, 100]
+                       "args": [0, 100.5]
                }, {
                        "name": "lineTo",
-                       "args": [200, 100]
+                       "args": [200, 100.5]
                }, {
                        "name": "stroke",
                        "args": []
@@ -1059,10 +1059,10 @@ describe('Linear Scale', function() {
                        "args": ["rgba(0, 0, 0, 0.1)"]
                }, {
                        "name": "moveTo",
-                       "args": [0, 100]
+                       "args": [0, 100.5]
                }, {
                        "name": "lineTo",
-                       "args": [200, 100]
+                       "args": [200, 100.5]
                }, {
                        "name": "stroke",
                        "args": []
@@ -1518,10 +1518,10 @@ describe('Linear Scale', function() {
                        "args": ["rgba(0, 0, 0, 0.1)"]
                }, {
                        "name": "moveTo",
-                       "args": [30, 0]
+                       "args": [30.5, 0]
                }, {
                        "name": "lineTo",
-                       "args": [30, 300]
+                       "args": [30.5, 300]
                }, {
                        "name": "stroke",
                        "args": []
@@ -1649,10 +1649,10 @@ describe('Linear Scale', function() {
                        "args": ["rgba(0, 0, 0, 0.1)"]
                }, {
                        "name": "moveTo",
-                       "args": [30, 0]
+                       "args": [30.5, 0]
                }, {
                        "name": "lineTo",
-                       "args": [30, 300]
+                       "args": [30.5, 300]
                }, {
                        "name": "stroke",
                        "args": []
@@ -1906,10 +1906,10 @@ describe('Linear Scale', function() {
                        "args": ["rgba(0, 0, 0, 0.1)"]
                }, {
                        "name": "moveTo",
-                       "args": [30, 0]
+                       "args": [30.5, 0]
                }, {
                        "name": "lineTo",
-                       "args": [30, 300]
+                       "args": [30.5, 300]
                }, {
                        "name": "stroke",
                        "args": []