Skip to content

Commit 9a7047c

Browse files
committed
place tooltip above line of line chart, otherwise fall back to 50% bottom position (default)
1 parent 3cbc5a2 commit 9a7047c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/_tooltips.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
// Position
88
position: absolute;
99
z-index: 1;
10-
bottom: 50%;
10+
// if --start / --end exist, then it's a line chart, and we calculate
11+
// the larger of the two to place the tooltip above the line segment;
12+
// if --start and --end don't exist, fallback to 0.5 * 100% = 50%,
13+
// which is the default tooltip position for e.g. bar charts
14+
bottom: calc(max(var(--start, 0.5), var(--end, 0.5)) * 100%);
1115
left: 50%;
1216
transform: translateX(-50%); // translateX for both bar & column chart
1317
width: max-content;

0 commit comments

Comments
 (0)