diff --git a/Resources/public/heatmap.css b/Resources/public/heatmap.css index be4a1ce..fecfe49 100644 --- a/Resources/public/heatmap.css +++ b/Resources/public/heatmap.css @@ -44,7 +44,6 @@ .heatmap-wrapper .heatmap-svg-area { flex: 1; min-width: 0; - overflow-x: auto; } .heatmap-wrapper .heatmap-filter { diff --git a/Resources/public/heatmap.js b/Resources/public/heatmap.js index f40be03..794bf94 100644 --- a/Resources/public/heatmap.js +++ b/Resources/public/heatmap.js @@ -2188,9 +2188,10 @@ var KimaiHeatmap = (() => { }); svg.selectAll(".month-label").data(months).join("text").attr("class", "heatmap-label month-label").attr("x", (d) => marginLeft + d.week * step).attr("y", marginTop - 6).text((d) => MONTH_FORMAT(d.date)); svg.selectAll(".day-label").data(DAY_LABELS).join("text").attr("class", "heatmap-label day-label").attr("x", marginLeft - 6).attr("y", (_d, i) => marginTop + i * step + cellSize - 2).attr("text-anchor", "end").text((d) => d); + document.querySelectorAll(".heatmap-tooltip").forEach((el) => el.remove()); const tooltip = createTooltip(); - wrapper.style.position = "relative"; - wrapper.appendChild(tooltip); + tooltip.style.position = "fixed"; + document.body.appendChild(tooltip); svg.selectAll(".heatmap-cell").data(cells).join("rect").attr( "class", (d) => d.entry ? "heatmap-cell" : "heatmap-cell heatmap-empty" @@ -2200,9 +2201,8 @@ var KimaiHeatmap = (() => { tooltip.innerHTML = `${DISPLAY_FORMAT(d.date)}
${hours}h (${count} entries)`; tooltip.style.display = "block"; const rect = event.target.getBoundingClientRect(); - const wrapperRect = wrapper.getBoundingClientRect(); - tooltip.style.left = `${rect.left - wrapperRect.left + cellSize / 2}px`; - tooltip.style.top = `${rect.top - wrapperRect.top - 40}px`; + tooltip.style.left = `${rect.left + cellSize / 2}px`; + tooltip.style.top = `${rect.top - tooltip.offsetHeight - 8}px`; }).on("mouseleave", function() { tooltip.style.display = "none"; }).on("click", function(_event, d) { diff --git a/Resources/views/widget/heatmap.html.twig b/Resources/views/widget/heatmap.html.twig index 1a5ea2c..bf09a89 100644 --- a/Resources/views/widget/heatmap.html.twig +++ b/Resources/views/widget/heatmap.html.twig @@ -8,7 +8,7 @@ data-url="{{ path('heatmap_data') }}" data-projects="{{ data.projects|json_encode }}" data-timesheet-url="{{ path('timesheet') }}" - style="min-height: 150px; overflow-x: auto;"> + style="min-height: 150px;">