]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix up issues in core scale 1756/head
authorEvert Timberg <evert.timberg@gmail.com>
Wed, 9 Dec 2015 01:22:02 +0000 (20:22 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Wed, 9 Dec 2015 01:22:02 +0000 (20:22 -0500)
src/core/core.scale.js

index ed25a369418ddf3afa8f2dd6594383e86e4ea142..aea41ea4982e0d0e102afd10625e99784b812023 100644 (file)
                                var originalLabelWidth = helpers.longestText(this.ctx, labelFont, this.ticks);
                                var cosRotation;
                                var sinRotation;
-                               var firstRotatedWidth;
 
                                this.labelWidth = originalLabelWidth;
 
 
                                if (this.isHorizontal()) {
                                        // A horizontal axis is more constrained by the height.
-                                       var maxLabelHeight = this.maxHeight - this.minSize.height;
                                        var longestLabelWidth = helpers.longestText(this.ctx, labelFont, this.ticks);
 
                                        // TODO - improve this calculation
 
                // Shared Methods
                isHorizontal: function() {
-                       return this.options.position == "top" || this.options.position == "bottom";
+                       return this.options.position === "top" || this.options.position === "bottom";
                },
 
                // Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
                },
 
                // Utility for getting the pixel location of a percentage of scale
-               getPixelForDecimal: function(decimal, includeOffset) {
+               getPixelForDecimal: function(decimal/*, includeOffset*/) {
                        if (this.isHorizontal()) {
                                var innerWidth = this.width - (this.paddingLeft + this.paddingRight);
                                var valueOffset = (innerWidth * decimal) + this.paddingLeft;
 
                                if (this.isHorizontal()) {
                                        setContextLineSettings = true;
-                                       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 - 10;
+                                       var yTickEnd = this.options.position === "bottom" ? this.top + 10 : this.bottom;
                                        skipRatio = false;
 
                                        if ((this.options.ticks.fontSize + 4) * this.ticks.length > (this.width - (this.paddingLeft + this.paddingRight))) {
                                                this.ctx.font = helpers.fontString(this.options.scaleLabel.fontSize, this.options.scaleLabel.fontStyle, this.options.scaleLabel.fontFamily);
 
                                                scaleLabelX = this.left + ((this.right - this.left) / 2); // midpoint of the width
-                                               scaleLabelY = this.options.position == 'bottom' ? this.bottom - (this.options.scaleLabel.fontSize / 2) : this.top + (this.options.scaleLabel.fontSize / 2);
+                                               scaleLabelY = this.options.position === 'bottom' ? this.bottom - (this.options.scaleLabel.fontSize / 2) : this.top + (this.options.scaleLabel.fontSize / 2);
 
                                                this.ctx.fillText(this.options.scaleLabel.labelString, scaleLabelX, scaleLabelY);
                                        }
 
                                } else {
                                        setContextLineSettings = true;
-                                       var xTickStart = this.options.position == "right" ? this.left : this.right - 5;
-                                       var xTickEnd = this.options.position == "right" ? this.left + 5 : 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(label, index) {
                                                // If the callback returned a null or undefined value, do not draw this line
 
                                                        this.ctx.save();
 
-                                                       if (this.options.position == "left") {
+                                                       if (this.options.position === "left") {
                                                                if (this.options.ticks.mirror) {
                                                                        xLabelValue = this.right + this.options.ticks.padding;
                                                                        this.ctx.textAlign = "left";
 
                                        if (this.options.scaleLabel.display) {
                                                // Draw the scale label
-                                               scaleLabelX = this.options.position == 'left' ? this.left + (this.options.scaleLabel.fontSize / 2) : this.right - (this.options.scaleLabel.fontSize / 2);
+                                               scaleLabelX = this.options.position === 'left' ? this.left + (this.options.scaleLabel.fontSize / 2) : this.right - (this.options.scaleLabel.fontSize / 2);
                                                scaleLabelY = this.top + ((this.bottom - this.top) / 2);
-                                               var rotation = this.options.position == 'left' ? -0.5 * Math.PI : 0.5 * Math.PI;
+                                               var rotation = this.options.position === 'left' ? -0.5 * Math.PI : 0.5 * Math.PI;
 
                                                this.ctx.save();
                                                this.ctx.translate(scaleLabelX, scaleLabelY);