Compare commits

...

1 Commits

Author SHA1 Message Date
Abhi Kumar
67aa8d16dd fix(charts): stop tooltip labels breaking mid-word
`overflow-wrap: anywhere` dropped the label's min-content width to one
character, so it was the only row item that could give way to a wide
value. Charts whose legend names are short also got the narrowest
tooltip, which is where it showed worst.

Assisted-by: Claude Opus 5
2026-09-17 22:00:19 +05:30
3 changed files with 16 additions and 4 deletions

View File

@@ -25,6 +25,7 @@
.uplotTooltipItemContent {
width: 100%;
min-width: 0;
display: flex;
align-items: center;
gap: var(--spacing-2);
@@ -40,16 +41,24 @@
}
.uplotTooltipItemLabel {
min-width: 0;
// Not `anywhere`, which drops min-content to one character and lets a wide
// value squeeze the label into a mid-word break.
white-space: normal;
overflow-wrap: anywhere;
overflow-wrap: break-word;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.uplotTooltipItemValue {
white-space: nowrap;
flex: 0 0 auto;
}
.uplotTooltipItemContentSeparator {
flex: 1;
flex: 1 1 24px;
border-width: 0.5px;
border-style: dashed;
min-width: 24px;

View File

@@ -34,7 +34,9 @@ export default function TooltipItem({
style={{ color: item.color }}
data-testid={contentTestId}
>
<span className={Styles.uplotTooltipItemLabel}>{item.label}</span>
<span className={Styles.uplotTooltipItemLabel} title={item.label}>
{item.label}
</span>
<span
className={Styles.uplotTooltipItemContentSeparator}
style={{ borderColor: item.color }}

View File

@@ -17,7 +17,8 @@ import { ChartWrapperProps } from 'lib/visualization/charts/types';
import { useChartStacking } from 'lib/visualization/charts/ChartWrapper/useChartStacking';
const TOOLTIP_WIDTH_PADDING = 120;
const TOOLTIP_MIN_WIDTH = 300;
// Holds a tooltip row's value column next to a legend-length label.
const TOOLTIP_MIN_WIDTH = 360;
export default function ChartWrapper({
legendConfig = { position: LegendPosition.BOTTOM },