Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: give labels more space and show full Yaxis label on hover (#11989)

Thorsten Spiekerc016ddda003c
diff --git a/web/src/features/widgets/chart-library/HorizontalBarChart.tsx b/web/src/features/widgets/chart-library/HorizontalBarChart.tsx
index 62a6996cd6..a47759e3ff 100644
--- a/web/src/features/widgets/chart-library/HorizontalBarChart.tsx
+++ b/web/src/features/widgets/chart-library/HorizontalBarChart.tsx
@@ -35,7 +35,12 @@ export const HorizontalBarChart: React.FC<ChartProps> = ({
accessibilityLayer={accessibilityLayer}
data={data}
layout="vertical"
- margin={{ top: 4, right: 8, bottom: 4, left: 0 }}
+ margin={{
+ top: 4,
+ right: showValueLabels ? 68 : 8,
+ bottom: 4,
+ left: 0,
+ }}
barCategoryGap="12%"
barGap={4}
>
@@ -53,8 +58,28 @@ export const HorizontalBarChart: React.FC<ChartProps> = ({
fontSize={12}
tickLine={false}
axisLine={false}
- tickFormatter={formatAxisLabel}
- width={100}
+ width={120}
+ tick={({ x, y, payload }) => {
+ const fullLabel =
+ typeof payload === "string"
+ ? payload
+ : ((payload as { value?: string })?.value ?? String(payload));
+ return (
+ <g transform={`translate(${x},${y})`}>
+ <title>{fullLabel}</title>
+ <text
+ textAnchor="end"
+ x={0}
+ y={0}
+ dy={4}
+ fill="hsl(var(--muted-foreground))"
+ fontSize={12}
+ >
+ {formatAxisLabel(fullLabel)}
+ </text>
+ </g>
+ );
+ }}
/>
<Bar
dataKey="metric"