I recently upgraded my version of Chart.js from v2.3
to v2.7.1
, which broke an existing functionality where the specified segment in a doughnut chart would be active (hover color, tooltip shown) when the user hovered over the corresponding legend item. That code looked like this:
var " + ClientID + @" = new Chart(" + ClientID + @"CTX, {
data: { ... },
options: {
legend: {
onHover: function(evt, legendItem) {
var index = " + ClientID + @".data.labels.indexOf(legendItem.text);
if (" + ClientID + @".data.datasets[0].data[index] > 0) {
var metaData = " + ClientID + @".getDatasetMeta(0);
var activeSegment = metaData.data[index];
" + ClientID + @".tooltipActive = [activeSegment];
" + ClientID + @".active = [activeSegment];
}
},
}
}
});
Looking through the Chart.js file and documentation, it looks like the tooltipActive
property has been completely removed, thus breaking the legend hover functionality. I looked through the release notes and PRs on the Chart.js git but couldn't find where this was noted as a breaking change, or any mention of it whatsoever. I have to upgrade versions of Chart.js for a separate change I'm making, so reverting back to v2.3
is not an option. Has anyone else run into this?