I am implementing some point charts with chart.js. No problems there, but what I want to do is have a tooltip that is not just attached to a given data point. Right now you can create a tooltip and it will display a popup near a given data point on the chart. For instance if I have the data points [1,5], [2,6], and [3,7] it will happily show those three data points.
But what I want is when I'm between 1,5 and 2,6 to see exactly where on the x axis I am. 1.5, 1.6, etc.
Inside the tooltips options for the chart.js call I can do something like this:
tooltips: {
mode: 'index',
intersect: false,
callbacks: {
footer: function(tooltipItems, data) {
return 'x:' + this._eventPosition.x + ' y:' + this._eventPosition.y;
},
},
footerFontStyle: 'normal'
}
But that is the position of x and y on the canvas and has nothing to do with the actual x and y graph coordinates. I can't seem to find any data available within chart.js that can get me the actual chart x,y coordinates of the current position of the mouse.
Also note I'm not needing it in the tooltip footer, I was just using that as a handy way to test output. What I would like is for an always visible tooltip in a fixed position to display the current actual chart x position that the mouse is hovering over regardless of the closest data point.