Skip to content

refactor(charts): centralize typography, dashes, strokes; flip y-axis to right#4722

Draft
aseckin wants to merge 1 commit into
mainfrom
chart-consistency-cleanup
Draft

refactor(charts): centralize typography, dashes, strokes; flip y-axis to right#4722
aseckin wants to merge 1 commit into
mainfrom
chart-consistency-cleanup

Conversation

@aseckin
Copy link
Copy Markdown
Contributor

@aseckin aseckin commented May 13, 2026

Introduce three token modules under front_end/src/constants/:

  • chart_typography (font family, sizes, pre-composed styles with tabular-nums)
  • chart_dash (named dash patterns: grid, cursor, quartile, threshold, timeline)
  • chart_stroke (stroke widths and point sizes for resolution markers)
  • chart_tokens (ChartThemeOverride type + resolveChartTokens helper)

Fix malformed font-family in chart_theme.ts (was using var(--font-inter-variable) var(--font-inter) without commas, silently falling back to system font). Raise base theme fontSize to 10 (was dead code at 9) and add fontVariantNumeric: tabular-nums.

Per-chart axis styles now spread CHART_FONT_STYLE.tick / .axisLabel so tabular-nums and font family land on the rendered SVG (Victory's per-axis style replaces theme tickLabels). Apply CHART_DASH tokens at every strokeDasharray site across chart components and primitives, unifying previously divergent values for cursor/grid/quartile/threshold lines.

Flip y-axis orientation to "right" everywhere (fan_chart, numeric_chart, multiple_choice_chart, group_chart, continuous_area_chart for discrete/CDF). Drop the offsetX = chartWidth + 5 hack and the VictoryLabel x=chartWidth axisLabelComponent overrides. FanChart default variant padding swapped from left-heavy to right-heavy. Discrete y-axis in ContinuousAreaChart now positions at xDomain[1].

Unify FanChart resolution diamond stroke width (2.5) and point size (10) across default and index variants.

Extend STYLE_PROPERTIES in svg_export.ts to preserve font-variant-numeric and a handful of other CSS properties that were being dropped during SVG download.

… to right

Introduce three token modules under front_end/src/constants/:
- chart_typography (font family, sizes, pre-composed styles with tabular-nums)
- chart_dash (named dash patterns: grid, cursor, quartile, threshold, timeline)
- chart_stroke (stroke widths and point sizes for resolution markers)
- chart_tokens (ChartThemeOverride type + resolveChartTokens helper)

Fix malformed font-family in chart_theme.ts (was using `var(--font-inter-variable) var(--font-inter)` without commas, silently falling back to system font). Raise base theme fontSize to 10 (was dead code at 9) and add fontVariantNumeric: tabular-nums.

Per-chart axis styles now spread CHART_FONT_STYLE.tick / .axisLabel so tabular-nums and font family land on the rendered SVG (Victory's per-axis style replaces theme tickLabels). Apply CHART_DASH tokens at every strokeDasharray site across chart components and primitives, unifying previously divergent values for cursor/grid/quartile/threshold lines.

Flip y-axis orientation to "right" everywhere (fan_chart, numeric_chart, multiple_choice_chart, group_chart, continuous_area_chart for discrete/CDF). Drop the offsetX = chartWidth + 5 hack and the VictoryLabel x=chartWidth axisLabelComponent overrides. FanChart default variant padding swapped from left-heavy to right-heavy. Discrete y-axis in ContinuousAreaChart now positions at xDomain[1].

Unify FanChart resolution diamond stroke width (2.5) and point size (10) across default and index variants.

Extend STYLE_PROPERTIES in svg_export.ts to preserve font-variant-numeric and a handful of other CSS properties that were being dropped during SVG download.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aseckin aseckin deployed to testing_env May 13, 2026 14:34 — with GitHub Actions Active
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8de8d3b9-0bab-4885-ad94-6fd1296b2408

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chart-consistency-cleanup

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-4722-chart-consistency-cleanup-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:chart-consistency-cleanup-5719ba7
🗄️ PostgreSQL NeonDB branch preview/pr-4722-chart-consistency-cleanup
Redis Fly Redis mtc-redis-pr-4722-chart-consistency-cleanup

Details

  • Commit: dabd0a611a2ae6c773dc40ef8319ba7c0c5f4ac8
  • Branch: chart-consistency-cleanup
  • Fly App: metaculus-pr-4722-chart-consistency-cleanup

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

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