Revert "Fixed tooltip labelling on Bar Chart when min is defined (#3618)"#3655
Revert "Fixed tooltip labelling on Bar Chart when min is defined (#3618)"#3655
Conversation
|
@etimberg Yes. I think this fix does not solve the fundamental problem. |
|
@KoyoSE what's the correct way to solve the underlying problem? |
|
@etimberg Good morning. Ah... just revents #3620. I think #3649 is correct way (better way). If it merge both, the corrected tooltip will shift again. :) I think underlying problem is here. (already fixed by #3649.) @Jareechang I am sorry about your efforts. |
|
hi @KoyoSE, your change is essentially the same as mine. Our code basically do the same thing. I've written unit test to cover the issue. The only thing I can see why it won't work is because we're both apply same changes. Either way, I do like how simple your code is. However, Hence, i've add |
|
Hello @Jareechang
I understand what you say. |
|
List-1 is the first code.(code of before) list-1 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]);
}
return me.ticks[index];
},ex) List-2 is the code I changed. = current code list-2 getLabelForIndex: function(index, datasetIndex) {
var me = this;
var data = me.chart.data;
var isHorizontal = me.isHorizontal();
if (data.yLabels && !isHorizontal) { // <<< for xLabels yLabels bug
return me.getRightValue(data.datasets[datasetIndex].data[index]);
}
return me.ticks[index - me.minIndex]; // <<<
},ticks is from min then I added " - me.minIndex". Actually, should we do like this(list-3)? list-3 getLabelForIndex: function(index, datasetIndex) {
var me = this;
var data = me.chart.data;
var isHorizontal = me.isHorizontal();
var labels = me.getLabels(); // <<<
if (data.yLabels && !isHorizontal) {
return me.getRightValue(data.datasets[datasetIndex].data[index]);
}
return labels[index]; // <<<
},I think it is a simple bug. list-2 & list-3 is the same result, but List-3 may be better. By the way, #3620 error occurs in the horizontalBar , Radar-chart. current code is here : |
Reverts #3620 per comments in #3618
@KoyoSE would this fix the issue you found?