JSFiddle - React, Tailwind, and code Playground
by Black Label
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
JavaScript
(function(H) {
H.wrap(H.Pointer.prototype, 'getHoverData', function(proceed, existingHoverPoint, existingHoverSeries, series, isDirectTouch, shared, e) {
var hoverData = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
var RADIUS = 20;
var point = hoverData.hoverPoint;
var chart = this.chart;
var plotX;
var plotY;
if (point) {
plotX = point.plotX + chart.plotLeft;
plotY = point.plotY + chart.plotTop;
if (
plotX + RADIUS > e.chartX && plotX - RADIUS < e.chartX &&
plotY + RADIUS > e.chartY && plotY - RADIUS < e.chartY
) {
return hoverData;
} else if (chart.hoverPoint) {
chart.hoverPoint.setState('');
chart.tooltip.hide();
}
}
return {
hoverPoint: null,
hoverPoints: [],
hoverSeries: null
};
});
}(Highcharts));
Highcharts.chart('container', {
title: {
text: 'Scatter chart'
},
chart: {
type: 'scatter',
events: {
load: function() {
console.log(this.series);
}
}
},
series: [{
point: {
events: {
mouseOver: function() {
console.log(this);
return false;
}
}
},
enableMouseTracking: true,
stickyTracking: true,
dashStyle: 'Solid',
name: 'Example',
data: [{
x: 16.96,
y: 1.52
},
{
x: 14.63,
y: 1.56
},
{
x: 15.47,
y: 1.49
},
{
x: 14.64,
y: 1.47
},
{
x: 17.6,
y: 1.47
},
{
x: 16.33,
y: 1.42
},
{
x: 18.26,
y: 1.51
},
{
x: 21.07,
y: 1.44
},
{
x: 22.19,
y: 1.47
},
{
x: 19.9,
y: 1.34
},
{
x: 20.97,
y: 1.31
},
{
...