Skip to content

Stop expanded Crime charts from stretching - #46

Open
raederhans wants to merge 1 commit into
mainfrom
codex/chart-drawer-sizing
Open

Stop expanded Crime charts from stretching#46
raederhans wants to merge 1 commit into
mainfrom
codex/chart-drawer-sizing

Conversation

@raederhans

Copy link
Copy Markdown
Owner

Root cause

The three responsive Chart.js canvases used maintainAspectRatio=false inside auto-height parents. Expanding the details disclosure caused the parent height and canvas height to feed each other through responsive resize observation, growing every chart and its axes indefinitely.

Fix

  • give every canvas a dedicated bounded sizing frame
  • keep responsive width and reserve extra height for the dense Top-N chart
  • add a static shell contract and a packaged-browser regression that proves dimensions remain unchanged after expansion

Verification

  • VITE_FEATURE_DIARY=1 VITE_TRACT_CRIME_SNAPSHOT=1 npm run validate
  • VITE_FEATURE_DIARY=1 VITE_TRACT_CRIME_SNAPSHOT=1 npm run test:browser-smoke
  • live browser sampling: 220/300/220 px remained unchanged across 5.5 seconds
  • npm audit --audit-level=high

Boundaries

Responsive Chart.js canvases used maintainAspectRatio=false inside auto-height containers. Opening the details disclosure created a parent-child resize feedback loop that stretched every chart and its axes indefinitely. Give each canvas a dedicated bounded sizing frame while retaining responsive width and extra height for the dense Top-N chart.

Constraint: Preserve chart data, progressive disclosure, and mobile scrolling behavior.

Rejected: Re-enable automatic aspect ratios | It would compress the dense horizontal Top-N chart and couple chart height to drawer width.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Responsive charts with maintainAspectRatio=false require an independently bounded parent.

Tested: VITE_FEATURE_DIARY=1 VITE_TRACT_CRIME_SNAPSHOT=1 npm run validate; browser smoke; live 5.5-second size sampling; npm audit --audit-level=high
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.

1 participant