From eb5bca6a4accbf98244cc66870b2b7962f764700 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Fri, 9 Sep 2016 21:03:59 -0400 Subject: [PATCH] When the category scale is used as the non main scale, return the correct data for the tooltip --- src/scales/scale.category.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/scales/scale.category.js b/src/scales/scale.category.js index 7767ef58d..6d9c33b64 100644 --- a/src/scales/scale.category.js +++ b/src/scales/scale.category.js @@ -49,8 +49,16 @@ module.exports = function(Chart) { me.ticks = (me.minIndex === 0 && me.maxIndex === labels.length - 1) ? labels : labels.slice(me.minIndex, me.maxIndex + 1); }, - getLabelForIndex: function(index) { - return this.ticks[index]; + getLabelForIndex: function(index, datasetIndex) { + var me = this; + var data = me.chart.data; + var isHorizontal = me.isHorizontal(); + + if ((data.xLabels && isHorizontal) || (data.yLabels && !isHorizontal)) { + return me.getRightValue(data.datasets[datasetIndex].data[index]); + } else { + return me.ticks[index]; + } }, // Used to get data value locations. Value can either be an index or a numerical value -- 2.47.2