I'm trying to integrate this tooltip-based-on-mouse-position customization into a react-js-2 bar chart. I see where to put the new options:
options: {
tooltips: {
mode: 'index',
position: 'cursor',
intersect: false
}
}
in my existing options block declaration. But I don't understand how/where in the app do I integrate the related function?
Chart.Tooltip.positioners.cursor = function(chartElements, coordinates) {
return coordinates;
};
I've tried simply declaring it as Chart.Tooltip.positioners.cursor = ...
or ChartJS.Tooltip.positioners.cursor = ...
or Tooltip.positioners.cursor = ...
in a few different places but it either causes an error or has no effect. I'm on ChartJS v3.8.0 and react-js-2 v4.1.0. Thank you.