Repository navigation
Conversation
fehmer
force-pushed
the
feature/ts-charts-s5-daily-activity
branch
from
November 26, 2026 15:32
449c0f4 to
2b22832
Compare
Base automatically changed from
feature/ts-charts-s4-account-histogram
to
integration/charts
November 30, 2026 10:07
… activity chart (@fehmer)
…c scale (@fehmer) The utc scale derives its tick interval from a *preferred* count rather than a hard max, so the previous 55px spacing over-packed the axis to monthly ticks. A preferred count of 8 resolves to the same ~3-month interval chart.js produces with maxTicksLimit: 20 on a dense multi-month history.
fehmer
force-pushed
the
feature/ts-charts-s5-daily-activity
branch
from
November 30, 2026 10:07
f78961c to
e751959
Compare
…ale (@fehmer) The built-in barY infers width from 80% of the smallest data gap only, so on the daily activity's utc day axis the bars ran into empty days (and the edge bars sat centred on the plot border, unlike chart.js' offset: true). Add a continuous-scale bar mark (components/charts/continuous-bar-y) that sizes each bar to chart.js' rule - 72% (categoryPercentage 0.8 x barPercentage 0.9) of the smallest adjacent-bar or adjacent-tick distance, resolved per render from the resolved scale - and centre it on its x value. Pad the utc x domain half a day each end to match the old offset: true so the edge bars sit inside the plot. Generic for any continuous (non-band) x scale, not daily-specific. Filename avoids 'chartjs' because vitest 4 / vite 8 drops the exports of a source module whose name contains it (the import reads as undefined).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The account daily activity chart (per-day minutes bars + average-speed line + trendline) now also renders through TanStack Charts, switched by the dev-only parity flag. The legacy Chart.js half is kept as the
Showfallback until S12.The TanStack definition mirrors the Chart.js datasets:
continuousBarYis a new shared mark (components/charts/continuous-bar-y.ts): the built-inbarYsizes bars from 80% of the smallest data gap, which on a continuous (utc) x scale runs bars into empty days and centres the edge bars on the plot border. The mark replicates Chart.js' continuous-scale layout instead — bar width = 72% (categoryPercentage 0.8 × barPercentage 0.9) of the smallest adjacent-bar or adjacent-tick distance, resolved per render from the resolved scale — and the x domain is padded ±½ day (the oldoffset: true) so the edge bars sit inside the plot. Generic for any continuous (non-band) x scale, so future time-scale bar charts can reuse it.Parity fixes folded in:
beginAtZeroviaviewport: { domain: [0, max] }, skipped when the data is all-zero — a[0, 0]viewport throws in the library, so an all-zero history must fall back to the fitted scale.count: Math.min(8, daySpan); the utc scale snaps to nice day/month steps from that target, matching the oldautoSkipdensity per filter window.strokeDasharray: "3 3"at 2 px) — a visual match for the Chart.js trendline plugin'sdottedstyle (the plugin literally usedsetLineDash([2, 2])at 3 px).Evidence
pnpm vitest run __tests__/components/pages/account/DailyActivityChart.spec.tsx→ 9 passed (±½-day domain padding, scale bindings, bar width/centre from the smallest bar-or-tick gap,beginAtZeroviewport, all-zero guard, dotted trendline with no band, per-day group-x tooltip, flag switch both ways).pnpm oxlint --type-aware --type-check: 0 errors in the PR's files (5 pre-existingno-unused-varsinCharts.tsxlive on the integration branch — the file is byte-identical there and untouched here)./account(dev flag on vs Chart.js): minutes bars (width + edge inset), average-speed line/dots, trendline, and x-tick density all match across filter windows; tooltip and theme reactivity verified.Merge Danger
Door: two-way. The whole TanStack path sits behind the dev-only parity flag (
getUseTanstackCharts), which is alwaysfalsein production — production keeps the existing Chart.js chart. Reverting the commit (or flipping the flag off) restores the status quo.Blast Radius: contained — dev-only; the production default (Chart.js) is untouched.