Skip to content

Add compare mode with shared Y-axis scaling for processing charts - #95

Merged
RetroHazard merged 2 commits into
mainfrom
cc/nice-lamport-e7m17o
Sep 29, 2026
Merged

RetroHazard merged 2 commits into
mainfrom
cc/nice-lamport-e7m17o

Conversation

@RetroHazard

Copy link
Copy Markdown
Owner

Summary

Implements compare mode for processing charts, allowing side-by-side visualization of two bureaus with synchronized Y-axis scaling. Policy events are now rendered once at full width in compare mode rather than duplicated per pane. Data tables also adapt to show one per bureau in a two-column layout on medium screens and up.

Key Changes

  • Shared Y-axis scaling: Added yMax prop to ImmigrationChartData interface and implemented axisMax functions (intakeAxisMax, typesAxisMax) to calculate the maximum value across both bureaus in compare mode, ensuring bar heights and line positions are directly comparable
  • Media query hook: Created useMediaQuery hook using useSyncExternalStore to detect when side-by-side layout is available (768px+), enabling responsive compare mode behavior
  • Policy event consolidation: Modified IntakeProcessingBarChart to accept hidePolicyList prop; the shell now renders PolicyEventList once at full width in compare mode instead of per pane, since events are national and identical for all bureaus
  • Dual data tables: Updated ChartDataTable to support optional label prop for accessibility; tables now render in a two-column grid layout in compare mode with separate CSV downloads per bureau
  • Chart component updates:
    • CategorySubmissionsLineChart and IntakeProcessingBarChart now accept and apply yMax via yAxisDomains to pin the count axis
    • Added niceYDomain utility to round shared max values consistently with chart's own axis calculations
    • Extracted buildTypeRows helper in CategorySubmissionsLineChart for reuse in typesAxisMax calculation
  • Chart definitions: Added axisMax and policyEvents metadata to processing chart definitions to identify which charts support compare mode scaling and event annotations
  • LineChart enhancement: Propagated yAxisDomains prop through chart component hierarchy to support fixed axis domains

Notable Implementation Details

  • Compare mode only activates on medium screens (768px+) via useMediaQuery, keeping single-pane layout on mobile
  • Axis max calculations ignore hidden series in the legend toggle, ensuring the shared scale remains stable when toggling visibility
  • Policy event filtering uses the chart's date range to show only relevant events in the consolidated list
  • Accessibility labels on table controls include bureau names when in compare mode for screen reader clarity

https://claude.ai/code/session_01GMkeFLsMCFSSWQxqCdG8Gr

Compare mode now pins both panes' count axis to the larger bureau's max
(Intake & Processing, Application Types) so bar heights and lines are
directly comparable; only applied when both panes are on screen (md+).
The national policy-event list renders once, full width. The data table
is duplicated per bureau so each keeps its own CSV download.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMkeFLsMCFSSWQxqCdG8Gr

Copy link
Copy Markdown
Owner Author

Policy event check (this PR doesn't touch policyEvents.ts, but routine review of the catalogue flagged a gap worth raising here before it's forgotten)

The Immigration Services Agency has finalized the fee amounts for the statutory-cap raise that policy.act2026 (period 2026-06) already tracks. That entry's own comment says it "claims the cap, not a figure" — the figures are now public, with commencement 2026-10-01, so per this file's own rule ("Where enactment and commencement are both worth seeing, they are two entries, not one") this looks like a second entry, on POLICY_EVENTS (Application Processing) only — I didn't find a Resident Population equivalent; fee changes don't move the stock counts the way feeRevision2025 isn't in RESIDENT_EVENTS either.

Official source: https://www.moj.go.jp/isa/01_00644.html ("令和8年10月1日付け在留許可手数料の額の改定等について", 出入国在留管理庁) — extension/change-of-status fees move from a flat 6,000 yen to a range of 10,000–75,000 yen by permitted period, and permanent residence rises to 200,000 yen (against the 300,000 yen statutory ceiling act2026 set). Applications filed by 2026-09-30 keep the old fee even if granted after.

Suggested addition to src/constants/policyEvents.ts, appended after the act2026 entry (line 198):

  {
    // Cabinet Order under the 2026 Act's raised cap, in force 2026-10-01.
    // act2026 (2026-06) claimed the statutory ceiling; this is the figure.
    period: '2026-10',
    category: 'fees',
    titleKey: 'policy.feeRevision2026.title',
    descriptionKey: 'policy.feeRevision2026.description',
    href: 'https://www.moj.go.jp/isa/01_00644.html',
  },

With catalogue strings (own wording, not a rendition of the ISA page), e.g. in src/i18n/locales/en.ts near policy.act2026:

  'policy.feeRevision2026.title': 'Application fees raised again',
  'policy.feeRevision2026.description': 'Extension and status-change fees now scale 10,000–75,000 yen by period; permanent residence rose to 200,000 yen.',

...and the matching keys in the other eleven locale files per docs/design-system / CLAUDE.md's "every visible string comes from the catalogue" rule — I haven't drafted those eleven translations here.

Not flagging anything else from this year's changes (JESTA, the second Basic Plan, the March-2026 student filing window) — those are either not yet in force or read as procedural/publication news rather than a dated change, per this file's own filing rule.


Generated by Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMkeFLsMCFSSWQxqCdG8Gr
@RetroHazard
RetroHazard merged commit ae3acd2 into main Sep 29, 2026
1 check passed
@RetroHazard
RetroHazard deleted the cc/nice-lamport-e7m17o branch September 29, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants