diff --git a/templates/servers/detail.twig b/templates/servers/detail.twig index 6ee6f85..cfa8828 100755 --- a/templates/servers/detail.twig +++ b/templates/servers/detail.twig @@ -518,21 +518,15 @@ new Chart(ctx{{ metricName|replace({'-': '_', '.': '_'}) }}, { tooltipEl.style.fontSize = '12px'; tooltipEl.style.pointerEvents = 'none'; document.body.appendChild(tooltipEl); - } - var dataIndex = context.tooltip && context.tooltip.dataPoints && context.tooltip.dataPoints[0] ? context.tooltip.dataPoints[0].dataIndex : null; - if (dataIndex === null) { - tooltipEl.style.opacity = 0; - window.lastTooltipIndex = null; - return; - } - // Проверяем что курсор всё ещё над той же точкой - if (window.lastTooltipIndex && window.lastTooltipIndex !== dataIndex) { + // Прячем если курсор ушел с графика + if (!context.tooltip._active || context.tooltip._active.length === 0) { tooltipEl.style.opacity = 0; return; } - window.lastTooltipIndex = dataIndex; + + var dataIndex = context.tooltip._active[0].index; var time = labels{{ metricName }}[dataIndex]; // Fetch processes