aboutsummaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2018-02-22 16:21:32 +0000
committerZarino Zappia <mail@zarino.co.uk>2018-03-01 11:48:09 +0000
commit8ed2f5d17ab6c80f977439a7fcf3013545e5433d (patch)
tree862bf479b4bd4fb2601e9d7bff84e07d95edcb2a /web/js
parent4dc7b4a85357168a8018b938d6a79ea5cce336db (diff)
[UK] Properly align Dashboard bar chart value labels
Diffstat (limited to 'web/js')
-rw-r--r--web/js/dashboard.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/web/js/dashboard.js b/web/js/dashboard.js
index 0eb53f964..23c5496e6 100644
--- a/web/js/dashboard.js
+++ b/web/js/dashboard.js
@@ -226,7 +226,6 @@ $(function(){
ctx = chartInstance.ctx;
ctx.font = Chart.helpers.fontString( Chart.defaults.global.defaultFontSize * 0.8, 'bold', Chart.defaults.global.defaultFontFamily);
- ctx.textAlign = 'right';
ctx.textBaseline = 'middle';
this.data.datasets.forEach(function (dataset, i) {
@@ -238,10 +237,12 @@ $(function(){
var gutter = (bar._model.height - (Chart.defaults.global.defaultFontSize * 0.8)) / 2;
var textX;
if (width_text + 2 * gutter > width_bar) {
- textX = bar._model.x + 2 * gutter;
+ textX = bar._model.x + gutter;
+ ctx.textAlign = 'left';
ctx.fillStyle = bar._model.backgroundColor;
} else {
textX = bar._model.x - gutter;
+ ctx.textAlign = 'right';
ctx.fillStyle = '#fff';
}
ctx.fillText( dataValue, textX, bar._model.y );