]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Bring linear axis labels closer to the tick marks when in a horizontal configuration...
authorEvert Timberg <evert.timberg@gmail.com>
Sat, 6 Jun 2015 12:21:16 +0000 (08:21 -0400)
committerEvert Timberg <evert.timberg@gmail.com>
Sat, 6 Jun 2015 12:21:16 +0000 (08:21 -0400)
src/Chart.Scale.js

index 86885c3cfb9f7fb1be6e70032d78e39bc1a392ec..9a99e912713b207660d73682d8f91d44f3292236 100644 (file)
@@ -11,8 +11,8 @@
     Chart.scaleService = {
         // The interesting function
         fitScalesForChart: function(chartInstance, width, height) {
-            var xPadding = 10;
-            var yPadding = 10;
+            var xPadding = 5;
+            var yPadding = 5;
 
             if (chartInstance) {
                 var leftScales = helpers.where(chartInstance.scales, function(scaleInstance) {
                         var labelStartY;
 
                         if (this.options.position == "top") {
-                            labelStartY = this.top;
+                            labelStartY = this.bottom - 10;
+                            this.ctx.textBaseline = "bottom";
                         } else {
                             // bottom side
-                            labelStartY = this.top + 20;
+                            labelStartY = this.top + 10;
+                            this.ctx.textBaseline = "top";
                         }
 
                         this.ctx.textAlign = "center";
-                        this.ctx.textBaseline = "top";
                         this.ctx.font = helpers.fontString(this.options.labels.fontSize, this.options.labels.fontStyle, this.options.labels.fontFamily);
 
                         helpers.each(this.labels, function(label, index) {
                         // Draw the labels
 
                         var labelStartX;
-                        
+
                         if (this.options.position == "left") {
                             labelStartX = this.right - 10;
                             this.ctx.textAlign = "right";