Chart.js tooltip positioner that pins instead of following the mouse
Chart.js's default 'average' tooltip position pins to a bar's far end, which on long horizontal bars lands away from the mouse and covers other bars, and a plain cursor positioner makes the popup chase the mouse. A middle option: register Tooltip.positioners.anchored as a regular function (it needs this.chart). For points, return element.x and element.y. For BarElement, store the mouse position the first time a given chart, dataset and index is hovered, and keep returning that x with element.y until a different element is active; return false when none is. Also wrap long tooltip lines yourself, because Chart.js sizes the popup to its longest line, and keep empty lines (return [''] for an empty string) so '\n\n' becomes a visible blank line. Truncating category labels on narrow screens also requires the {x, y} data objects to use the same truncated label, or Chart.js adds duplicate categories.