You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For all that come across this issue - the following workaround fixed the issue in our case:
import * as Highcharts from 'highcharts'
/**
* This module contains a fix for the tooltip issues stated in https://github.com/highcharts/highcharts/issues/20969
* TODO: Remove this module once the issue is fixed in highcharts
* @param {Highcharts} H Highcharts
* @constructor
* @remarks this module hides the tooltip when the mouse leaves the chart
*/
export function HideTooltipOnLeave(H: typeof Highcharts) {
const timeoutIds: Record<string, ReturnType<typeof setTimeout>> = {}
H.addEvent(H.Chart, 'load', function (e) {
const chart = e?.target
const chartId = chart.container.id
if (!chart) return
// Delay for hiding the tooltip - the default is 500ms - we add 200ms to give highcharts time to handle itself
const delay = (chart.tooltip?.options?.hideDelay ?? 500) + 200
/**
* Event-Handler for mouseleave event on chart-container
*/
H.addEvent(chart.container, 'mouseleave', function () {
// Clear any existing timeout for this chart
if (timeoutIds[chartId]) {
clearTimeout(timeoutIds[chartId])
delete timeoutIds[chartId] // remove the entry
}
timeoutIds[chartId] = setTimeout(() => {
const tooltip = chart.tooltip
//Hide the tooltip (#20969)
if (!chart.tooltip?.label || tooltip?.label?.visibility === 'hidden') return
chart.tooltip.label.hide()
// Clear the container for outside tooltip (#18490)
if (chart.tooltip.container) {
chart.tooltip.container.remove()
}
}, delay)
})
/**
* Event-Handler for mouseenter event on chart-container
*/
H.addEvent(chart.container, 'mouseenter', function () {
// Clear the timeout when re-entering the chart
if (timeoutIds[chartId]) {
clearTimeout(timeoutIds[chartId])
delete timeoutIds[chartId] // remove the entry
}
})
})
}
The charts in the fiddle seem to overlap in area. When I add some space between the charts plot areas (I used the margin css property) I am not able to reproduce the bug anymore.
The charts in the fiddle seem to overlap in area. When I add some space between the charts plot areas (I used the margin css property) I am not able to reproduce the bug anymore.
Could this be the culprit?
Hi there, thanks for the feedback. Maybe it’s a workaround, but the behavior changed with the versions, so this is an undocumented breaking change with no real reason IMHO (and unfortunately that doesn’t seem to be the only case). An official fix/documented solution would be really appreciated.
Activity
hubertkozik commentedon Apr 9, 2024
Hi @markoberholzer-es!
Indeed, I would treat it as a bug, because the tooltip should be destroyed after the delay time.
Internal note:
I tried to bisect, but there are too many issues in compiling between version 11.1.0 and 11.2.0.
markoberholzer-es commentedon Apr 9, 2024
@hubertkozik - thx for your feedback and digging into that topic!
markoberholzer-es commentedon Apr 16, 2024
For all that come across this issue - the following workaround fixed the issue in our case:
MarkusBarstad commentedon May 22, 2024
Just a note on the example fiddle, @markoberholzer-es ;
The charts in the fiddle seem to overlap in area. When I add some space between the charts plot areas (I used the
margincss property) I am not able to reproduce the bug anymore.Could this be the culprit?
h3mpti commentedon May 22, 2024
Hi there, thanks for the feedback. Maybe it’s a workaround, but the behavior changed with the versions, so this is an undocumented breaking change with no real reason IMHO (and unfortunately that doesn’t seem to be the only case). An official fix/documented solution would be really appreciated.