Skip to content

Some questions have wrong padding on distribution charts in embeds / images#4986

Merged
ncarazon merged 1 commit into
mainfrom
fix/some-questions-have-wrong-padding-on-distribution-charts-in
Jul 6, 2026
Merged

Some questions have wrong padding on distribution charts in embeds / images#4986
ncarazon merged 1 commit into
mainfrom
fix/some-questions-have-wrong-padding-on-distribution-charts-in

Conversation

@ncarazon

@ncarazon ncarazon commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Resolves #4983

Summary

Fixes squeezed distribution charts in resolved discrete embeds/images.

Implemented changes:

  • Adjusted discrete mini chart padding so hidden labels no longer reserve extra horizontal space.
  • Passed resolved state into the resolution chip chart data for correct resolved styling.
  • Checked other embed chart types/statuses and didn’t find the same padding issue
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved resolved-state handling in continuous resolution charts so they correctly reflect when a question is resolved.
    • Refined continuous chart spacing for discrete questions to improve readability of labels and tabs.
    • Updated chart layout calculations so padding adjusts immediately when label visibility settings change.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2c1ead40-89ea-4500-8623-3e0883e0adf1

📥 Commits

Reviewing files that changed from the base of the PR and between 9e46550 and facec41.

📒 Files selected for processing (2)
  • front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_continuous_resolution_chip.tsx
  • front_end/src/components/charts/minified_continuous_area_chart.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_continuous_resolution_chip.tsx
  • front_end/src/components/charts/minified_continuous_area_chart.tsx

📝 Walkthrough

Walkthrough

This PR sets isResolved on continuous area chart data from question status and updates discrete chart padding in MinifiedContinuousAreaChart to account for label visibility and recompute when those settings change.

Changes

Chart resolution and padding fixes

Layer / File(s) Summary
Resolution chip passes isResolved to chart data
front_end/src/app/(main)/questions/[id]/components/question_view/forecaster_question_view/question_header/question_header_continuous_resolution_chip.tsx
getContinuousAreaChartData now receives isResolved computed from question.status === QuestionStatus.RESOLVED.
Discrete label padding calculation fix
front_end/src/components/charts/minified_continuous_area_chart.tsx
horizontalPadding now uses needsDiscreteLabelPadding with !hideLabels and !minMaxLabelsOnly, and the memo dependency list includes those props.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Metaculus/metaculus#4233: Both PRs modify MinifiedContinuousAreaChart rendering for discrete questions.
  • Metaculus/metaculus#4388: Both PRs wire isResolved derived from question.status === QuestionStatus.RESOLVED into continuous area chart data.

Suggested reviewers: elisescu, lsabor, cemreinanc

Poem

A rabbit hopped by, with charting delight,
Resolved bits now glow just right.
Discrete labels breathe, no squeeze in sight,
Padding and status both feel light.
Hoppity hop — the chart’s all right 🐇

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: fixing incorrect distribution chart padding in embeds/images.
Linked Issues check ✅ Passed [#4983] The padding fix for discrete embed/image charts and the resolved-state chart data both align with the issue.
Out of Scope Changes check ✅ Passed No unrelated code paths or extra features are introduced beyond the chart padding and resolved-state fixes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/some-questions-have-wrong-padding-on-distribution-charts-in

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Cleanup: Preview Environment Removed

The preview environment for this PR has been destroyed.

Resource Status
🌐 Preview App Deleted
🗄️ PostgreSQL Branch Deleted
⚡ Redis Database Deleted
🔧 GitHub Deployments Removed
📦 Docker Image Retained (auto-cleanup via GHCR policies)

Cleanup triggered by PR close at 2026-07-06T07:54:04Z

@ncarazon ncarazon force-pushed the fix/some-questions-have-wrong-padding-on-distribution-charts-in branch from 9e46550 to facec41 Compare July 6, 2026 07:27
@ncarazon ncarazon merged commit 561fe19 into main Jul 6, 2026
15 checks passed
@ncarazon ncarazon deleted the fix/some-questions-have-wrong-padding-on-distribution-charts-in branch July 6, 2026 07:54
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.

Some questions have wrong padding on distribution charts in embeds / images

2 participants