diff --git a/src/components/_tooltips.scss b/src/components/_tooltips.scss index c72df83..621bc95 100644 --- a/src/components/_tooltips.scss +++ b/src/components/_tooltips.scss @@ -7,7 +7,11 @@ // 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%; width: max-content; padding: 5px 10px;