Skip to content

feat(charts): render the account histogram on TanStack (S4) (@fehmer) - #8626

Open
fehmer wants to merge 6 commits into
feature/ts-charts-s2-cross-markfrom
feature/ts-charts-s4-account-histogram
Open

fehmer wants to merge 6 commits into
feature/ts-charts-s2-cross-markfrom
feature/ts-charts-s4-account-histogram

Conversation

@fehmer

@fehmer fehmer commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Summary

S4 of docs/specs/tanstack-charts: the account page histogram goes through the dev parity flag, following the S3 pattern.

 <HistogramChart> (src/ts/components/pages/account/HistogramChart.tsx)
   buckets()                            # groupIntoBuckets, now { label, count } rows
+  definition = buildHistogramChartDefinition(buckets(), getTheme)   # pure, spec'd
-  <ChartJs name="Histogram" .../>      # stepping stone; removed in S12
+  <Show when={getUseTanstackCharts()}>
+    <Chart definition ariaLabel height=200 initialWidth=640 />   # the 200 px container, h-50
buildHistogramChartDefinition (defineChart)
  barY(rows, { x: "label", y: "count", fill: theme main })
  x: scaleBand(labels, padding 0.28)   # chart.js barPercentage 0.9 x categoryPercentage 0.8
  y: scaleLinear, nice, label "Tests"  # beginAtZero
  grids: subAlt                       # the host (S1) pins stroke-opacity 1; chart.js paints them solid
  tooltip: use tooltip, tween 250 ms   # the old 250 ms animation
    content: title = bucket label, one row "Tests: N"
  focus: group-x                       # the old mode: "index"

Evidence

  • New spec (__tests__/components/pages/account/HistogramChart.spec.tsx), asserted through createChartScene:
✓ buildHistogramChartDefinition > places every bucket on the x scale and counts on a zero-based y scale
✓ buildHistogramChartDefinition > keeps one bar per bucket painted in the theme main; zero stays zero
✓ buildHistogramChartDefinition > focuses by bucket (group-x) and labels the tooltip with the test count
✓ HistogramChart > renders the Chart.js half by default
✓ HistogramChart > renders the TanStack half when the parity flag is on
  • Full suite: 133 passed (133), 2011 passed (2011) — existing specs unchanged.
  • pnpm oxlint --type-aware --type-check clean; oxfmt / lint-styles clean.
  • Browser parity on the account page, dev flag both ways (signed-in account, 75 completed tests):
    • bars: ratio 0.72 in both (67 px / 93 px slot vs 69 px / 95 px — the 2 px delta is the axis gutter); counts, empty buckets and the Tests y axis match
    • theme change: bars repaint in both halves (measured the live fills, carbon → catppuccin)
    • hover: bucket title + Tests: N in both; the TanStack half adds the library's focus dot (same as S3)
    • resize (container 1280 → 320 px): labels thin 13 → 5, ends kept (flat) vs chart.js's rotate-and-skip — the accepted S3 pattern
  • Production build: vendor-chart 416.49 kB / 137.96 kB gzip — identical to S2/S3 (no new library imports); the component lands in the app chunk.
  • Roadmap S4 row ticked. This chart paints its grids subAlt per the spec; after the S1 post-draft fixes, S3's about histogram does too.

Merge Danger

Door: two-way.

A dev-only flag selects the renderer, default Chart.js; reverting deletes one half of one component plus one spec file.

Blast Radius: the account page histogram behind a dev-only switch — no production change until the S12 move. Stacked on #8624 (S2, on #8623).

@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff docs Related to Markdown files and documentation labels Nov 25, 2026
@fehmer
fehmer added this pull request to stack #8625 November 25, 2026 23:54
@fehmer
fehmer force-pushed the feature/ts-charts-s4-account-histogram branch from b4dad76 to ddca80b Compare November 26, 2026 02:02
@fehmer
fehmer force-pushed the feature/ts-charts-s4-account-histogram branch from ddca80b to 80d8767 Compare November 26, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Related to Markdown files and documentation frontend User interface or web stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants