How to create a custom positioner in vue-chartjs?
I'm trying to do this: https://stackoverflow.com/questions/38072572/position-tooltip-based-on-mouse-position in the vue way
This is my closest guess
this.$data._chart.Tooltip.positioners = {
cursor: function (chartElements, coordinates) {
console.log(chartElements, coordinates);
return coordinates;
},
};
except this still results in a Chart.js?30ef:7874 Uncaught TypeError: Cannot read property 'call' of undefined
Well, if you want it on a global Level you can pretty much copy and paste the stackoverflow stuff.
import Chart from 'chart.js'
import { Bar } from 'vue-chartjs'
Chart.Tooltip.positioners.cursor = function(chartElements, coordinates) {
return coordinates;
};
export default {
// Vue stuff
}
Unfortunately the stack overflow question doesn't fulfill my needs, but your answer solves the issue i had with it, thanks!
Most helpful comment
Well, if you want it on a global Level you can pretty much copy and paste the stackoverflow stuff.