0👍
✅
If you modify prototypes the changes are always global since you have only one copy of Highcharts.
To have stuff working normally for some charts you can wrap the modified function and process inside it according to some flag/function/etc. which is set in the chart’s options.
For example:
Highcharts.wrap(Highcharts.Pointer.prototype, 'reset', function(p, allowMove, delay) {
if (this.chart.options.chart.resetPointer === false) {
console.log('modified')
return undefined
}
return p.call(this, allowMove, delay)
})
Function is called normally if in the chart’s options you did not set resetPointer prop to false explicitly, like this:
chart: {
resetPointer: false
},
live example: https://jsfiddle.net/e2bo3L4r/
Source:stackexchange.com