From da1808486ae5e18c701a035e46835538c1a1f2ee Mon Sep 17 00:00:00 2001 From: filmaj Date: Wed, 1 May 2024 21:54:33 -0400 Subject: [PATCH 1/2] place tooltip above line of line chart, otherwise fall back to 50% bottom position (default) --- src/components/_tooltips.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/_tooltips.scss b/src/components/_tooltips.scss index c72df83..b504b6a 100644 --- a/src/components/_tooltips.scss +++ b/src/components/_tooltips.scss @@ -7,8 +7,13 @@ // Position position: absolute; z-index: 1; - inset-block-end: 50%; + // if --start / --end exist, then it's a line chart, and we calculate + // the larger of the two to place the tooltip above the line segment; + // if --start and --end don't exist, fallback to 0.5 * 100% = 50%, + // which is the default tooltip position for e.g. bar charts + inset-block-end: calc(max(var(--start, 0.5), var(--end, 0.5)) * 100%); inset-inline-start: 50%; + transform: translateX(-50%); // translateX for both bar & column chart width: max-content; padding: 5px 10px; border-radius: 6px; From 0c494e469f48c817fb0a04ac5e4109fe9aff0819 Mon Sep 17 00:00:00 2001 From: filmaj Date: Mon, 21 Jul 2025 11:53:30 -0400 Subject: [PATCH 2/2] fix merge mistake --- src/components/_tooltips.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/_tooltips.scss b/src/components/_tooltips.scss index b504b6a..621bc95 100644 --- a/src/components/_tooltips.scss +++ b/src/components/_tooltips.scss @@ -13,7 +13,6 @@ // which is the default tooltip position for e.g. bar charts inset-block-end: calc(max(var(--start, 0.5), var(--end, 0.5)) * 100%); inset-inline-start: 50%; - transform: translateX(-50%); // translateX for both bar & column chart width: max-content; padding: 5px 10px; border-radius: 6px;