From: Evert Timberg Date: Sat, 6 Jun 2015 12:21:16 +0000 (-0400) Subject: Bring linear axis labels closer to the tick marks when in a horizontal configuration... X-Git-Tag: 2.0.0-alpha2~35^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a89ede0d72d91f483c0b1f4d119fd8019115471d;p=thirdparty%2FChart.js.git Bring linear axis labels closer to the tick marks when in a horizontal configuration. Reduced excess whitespace. --- diff --git a/src/Chart.Scale.js b/src/Chart.Scale.js index 86885c3cf..9a99e9127 100644 --- a/src/Chart.Scale.js +++ b/src/Chart.Scale.js @@ -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) { @@ -518,14 +518,15 @@ 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) { @@ -584,7 +585,7 @@ // Draw the labels var labelStartX; - + if (this.options.position == "left") { labelStartX = this.right - 10; this.ctx.textAlign = "right";