From 02e7b51ac77933e60a4d6f3a55bce052e39ce679 Mon Sep 17 00:00:00 2001 From: sacha <23283108+sacha-l@users.noreply.github.com> Date: Thu, 25 Jun 2026 20:12:54 +0100 Subject: [PATCH] fix(results-panel): replace Recharts bars with CSS bars so full label text is always visible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recharts horizontal bar chart clips long Y-axis labels at the container edge regardless of the computed width — sentence-length options like 'Agent bought and paid on its own, running in about an hour' were showing as 'gent bought and paid on its...' with the leading characters cut off. Replace the Recharts BarChart/ResponsiveContainer stack with a plain CSS implementation: full label text on one line, 2px bar scaled to max value, count on the right. No truncation, no Canvas 0-width bug, no Recharts import in this component. --- .../admin/ProgramResultsSummarySection.tsx | 74 +++++-------------- 1 file changed, 19 insertions(+), 55 deletions(-) diff --git a/client/src/components/admin/ProgramResultsSummarySection.tsx b/client/src/components/admin/ProgramResultsSummarySection.tsx index 2be410a..6da4b0f 100644 --- a/client/src/components/admin/ProgramResultsSummarySection.tsx +++ b/client/src/components/admin/ProgramResultsSummarySection.tsx @@ -1,13 +1,5 @@ import { useEffect, useState } from "react"; import { ExternalLink, Github, Loader2 } from "lucide-react"; -import { - BarChart, - Bar, - XAxis, - YAxis, - Tooltip, - ResponsiveContainer, -} from "recharts"; import { api, USE_MOCK_DATA, @@ -156,55 +148,27 @@ function FeedbackChart({ }) { const entries = Object.entries(counts).sort((a, b) => b[1] - a[1]); if (entries.length === 0) return null; - const data = entries.map(([name, value]) => ({ name, value })); - const maxVal = Math.max(...data.map((d) => d.value)); - - // min-w-[1px] + debounce prevents Recharts creating a 0-dim canvas pattern - // when the admin panel first opens (layout still in flight). - // Y-axis width is computed from the longest label so long option strings - // don't overflow; tickFormatter truncates anything that still doesn't fit. - const longestLabel = Math.max(...entries.map(([k]) => k.length)); - const yAxisWidth = Math.min(160, Math.max(80, Math.ceil(longestLabel * 5.4))); - const maxChars = Math.floor(yAxisWidth / 5.4); + const maxVal = Math.max(...entries.map(([, v]) => v)); return ( -