]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Some improvements to the linear scale. Made the tick marks smaller (5px vs 10px)...
authorEvert Timberg <evert.timberg@gmail.com>
Sat, 6 Jun 2015 12:12:13 +0000 (08:12 -0400)
committerEvert Timberg <evert.timberg@gmail.com>
Sat, 6 Jun 2015 12:12:13 +0000 (08:12 -0400)
src/Chart.Scale.js

index d87f80e57ee2b97010f3ebe1ab469df708c23be8..86885c3cfb9f7fb1be6e70032d78e39bc1a392ec 100644 (file)
                 //             -----------------------------------------------------
                 //                     |                       |                       |                       |                       |
                 //
-                minSize.height = this.options.gridLines.show ? 25 : 0;
+                minSize.height = this.options.gridLines.show ? 10 : 0;
             } else {
                 minSize.height = maxHeight; // fill all the height
 
                 //         |
                 //             |
                 //        -|
-                minSize.width = this.options.gridLines.show ? 25 : 0;
+                minSize.width = this.options.gridLines.show ? 10 : 0;
             }
 
             if (this.options.labels.show) {
                         hasZero = helpers.findNextWhere(this.ticks, function(tick) {
                             return tick === 0;
                         }) !== undefined;
-                        var yTickStart = this.options.position == "bottom" ? this.top : this.bottom - 10;
-                        var yTickEnd = this.options.position == "bottom" ? this.top + 10 : this.bottom;
+                        var yTickStart = this.options.position == "bottom" ? this.top : this.bottom - 5;
+                        var yTickEnd = this.options.position == "bottom" ? this.top + 5 : this.bottom;
 
                         helpers.each(this.ticks, function(tick, index) {
                             // Grid lines are vertical
                         hasZero = helpers.findNextWhere(this.ticks, function(tick) {
                             return tick === 0;
                         }) !== undefined;
-                        var xTickStart = this.options.position == "right" ? this.left : this.right - 10;
-                        var xTickEnd = this.options.position == "right" ? this.left + 10 : this.right;
+                        var xTickStart = this.options.position == "right" ? this.left : this.right - 5;
+                        var xTickEnd = this.options.position == "right" ? this.left + 5 : this.right;
 
                         helpers.each(this.ticks, function(tick, index) {
                             // Grid lines are horizontal
                         // Draw the labels
 
                         var labelStartX;
-                        var maxLabelWidth = this.width - 25;
-
+                        
                         if (this.options.position == "left") {
-                            labelStartX = this.left;
+                            labelStartX = this.right - 10;
+                            this.ctx.textAlign = "right";
                         } else {
                             // right side
-                            labelStartX = this.left + 20;
+                            labelStartX = this.left + 5;
+                            this.ctx.textAlign = "left"
                         }
 
-                        this.ctx.textAlign = "left";
                         this.ctx.textBaseline = "middle";
                         this.ctx.font = helpers.fontString(this.options.labels.fontSize, this.options.labels.fontStyle, this.options.labels.fontFamily);
 
                         helpers.each(this.labels, function(label, index) {
                             var yValue = this.getPixelForValue(this.ticks[index]);
-                            this.ctx.fillText(label, labelStartX, yValue, maxLabelWidth);
+                            this.ctx.fillText(label, labelStartX, yValue);
                         }, this);
                     }
                 }