]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Use the correct font for the ticks. Ensure that scale labels fill in the correct... 1539/head 1540/head
authoretimberg <evert.timberg@gmail.com>
Sat, 17 Oct 2015 02:00:43 +0000 (22:00 -0400)
committeretimberg <evert.timberg@gmail.com>
Sat, 17 Oct 2015 02:00:43 +0000 (22:00 -0400)
src/core/core.scale.js

index 3fa0e15b230bea5bd424cb05e70bd870fe96ca9a..23b5a9b70d2cdc659f9e89a4bdf48d61c0e008ec 100644 (file)
                                var scaleLabelX;
                                var scaleLabelY;
 
-                               // Make sure we draw text in the correct color
+                               // Make sure we draw text in the correct color and font
                                this.ctx.fillStyle = this.options.ticks.fontColor;
+                               var labelFont = helpers.fontString(this.options.ticks.fontSize, this.options.ticks.fontStyle, this.options.ticks.fontFamily);
 
                                if (this.isHorizontal()) {
                                        setContextLineSettings = true;
                                                        this.ctx.save();
                                                        this.ctx.translate(xLabelValue, (isRotated) ? this.top + 12 : this.options.position === "top" ? this.bottom - 10 : this.top + 10);
                                                        this.ctx.rotate(helpers.toRadians(this.labelRotation) * -1);
-                                                       this.ctx.font = this.font;
+                                                       this.ctx.font = labelFont;
                                                        this.ctx.textAlign = (isRotated) ? "right" : "center";
                                                        this.ctx.textBaseline = (isRotated) ? "middle" : this.options.position === "top" ? "bottom" : "top";
                                                        this.ctx.fillText(label, 0, 0);
                                                // Draw the scale label
                                                this.ctx.textAlign = "center";
                                                this.ctx.textBaseline = 'middle';
+                                               this.ctx.fillStyle = this.options.scaleLabel.fontColor; // render in correct colour
                                                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
                                                        
                                                        this.ctx.translate(xLabelValue, yLabelValue);
                                                        this.ctx.rotate(helpers.toRadians(this.labelRotation) * -1);
-                                                       this.ctx.font = this.font;
+                                                       this.ctx.font = labelFont;
                                                        this.ctx.textBaseline = "middle";
                                                        this.ctx.fillText(label, 0, 0);
                                                        this.ctx.restore();
                                                this.ctx.translate(scaleLabelX, scaleLabelY);
                                                this.ctx.rotate(rotation);
                                                this.ctx.textAlign = "center";
+                                               this.ctx.fillStyle = this.options.scaleLabel.fontColor; // render in correct colour
                                                this.ctx.font = helpers.fontString(this.options.scaleLabel.fontSize, this.options.scaleLabel.fontStyle, this.options.scaleLabel.fontFamily);
                                                this.ctx.textBaseline = 'middle';
                                                this.ctx.fillText(this.options.scaleLabel.labelString, 0, 0);