From 91adac7a0d328454df1043d146c8e608db6a8ba2 Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Sun, 16 Dec 2018 21:12:22 +0200 Subject: [PATCH] Return correct label for value type axis --- src/scales/scale.category.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scales/scale.category.js b/src/scales/scale.category.js index 33a91f3a2c6..a994e3a1912 100644 --- a/src/scales/scale.category.js +++ b/src/scales/scale.category.js @@ -53,10 +53,15 @@ module.exports = function() { getLabelForIndex: function(index, datasetIndex) { var me = this; - var data = me.chart.data; + var chart = me.chart; + var data = chart.data; var isHorizontal = me.isHorizontal(); + var ds = typeof chart.getDatasetMeta === 'function' && chart.getDatasetMeta(datasetIndex).controller; + var isValue = typeof ds.getValueScaleId === 'function' + ? ds.getValueScaleId() === me.id + : null; - if (data.yLabels && !isHorizontal) { + if (isValue || (isValue === null && !isHorizontal)) { return me.getRightValue(data.datasets[datasetIndex].data[index]); } return me.ticks[index - me.minIndex];