Skip to content

feat: allow reversing waffle fill directions - #274

Open
tannerlinsley wants to merge 1 commit into
mainfrom
codex/waffle-reverse-273
Open

tannerlinsley wants to merge 1 commit into
mainfrom
codex/waffle-reverse-273

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Add independent reverseX and reverseY options to waffleX and waffleY. Both default to false, so existing charts keep their current fill directions. Reversal includes partial cells and preserves source order, keys, values and interaction anchors. Thanks @dantman for the report.

Fixes #273.

AI review notes:
The change mirrors renderer-neutral fragment coordinates around the centered grid, rather than changing data order or renderer transforms.
Four new geometry cases fail on the baseline and pass with the fix, covering both orientations with responsive and fixed packing, fractional boundaries, legend-adjusted bounds and source interaction identity.
Independently verified: 36 waffle/selection/decorative tests, root types, docs contract, explicit bundle policy (--check), and the complete twelve-package/Native/Expo/seven-adapter/unified artifact gate pass. Eight real Chromium direction combinations and their rendered output pass inside credential-free outer isolation.
Canonical root docs and generated package copies are updated. A minor Changeset is included. No dependencies, workflows, default behavior, bundle limits or locked records changed. Normal public CI and review remain required.

Summary by CodeRabbit

  • New Features
    • Added independent horizontal and vertical reversal options for waffle charts, allowing cells—including partial cells—to be mirrored along either or both axes. Both options are off by default, and reversing cells preserves their associated data and colors.
  • Documentation
    • Added descriptions, defaults, and usage examples for the new options.

@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 318880d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@tanstack/charts Minor
@tanstack/alpine-charts Minor
@tanstack/angular-charts Minor
@tanstack/lit-charts Minor
@tanstack/octane-charts Minor
@tanstack/preact-charts Minor
@tanstack/react-charts Minor
@tanstack/react-native-charts Minor
@tanstack/solid-charts Minor
@tanstack/svelte-charts Minor
@tanstack/vue-charts Minor
@tanstack/charts-scales Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The waffle layout adds independent reverseX and reverseY options. Both default to false. The layout mirrors cell positions, including partial cells, and tests cover both waffle orientations and packing modes.

Changes: Waffle Direction Reversal

Layer / File(s) Summary
Add and validate axis reversal
packages/charts-core/src/waffle.ts, packages/charts-core/src/waffle.test.ts, docs/reference/marks/waffle.md, packages/charts-core/docs/reference/marks/waffle.md, .changeset/reverse-waffle-directions.md
WaffleOptions adds reverseX and reverseY, and the layout mirrors cell positions on the enabled axes. Tests check coordinates, tile identity, colors, dimensions, radii, and source associations. Both documentation pages describe the options and defaults. The changeset declares a minor release.

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

Change: Feature

Merge Risk: Minimal · up to 31888

This adds optional reverseX and reverseY settings for waffle charts. Defaults keep current behavior, so existing charts should be unaffected. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat: allow reversing waffle fill directions" matches the main change. The PR adds independent reverseX and reverseY options to waffleX and waffleY, both defaulting to false, so fill direct…
Linked Issues check Passed Issue #273 requires reverse options for waffleY (bottom-to-top fill) and waffleX (left-to-right then bottom-to-top fill). At the reviewed head, packages/charts-core/src/waffle.ts adds optional `revers…
Out of Scope Changes check Passed Changed areas are limited to the waffle mark implementation (packages/charts-core/src/waffle.ts), its tests (waffle.test.ts), documentation for the new options (root and charts-core waffle.md), and a …
Full details: Title check

Explanation

The title "feat: allow reversing waffle fill directions" matches the main change. The PR adds independent reverseX and reverseY options to waffleX and waffleY, both defaulting to false, so fill direction can be reversed. The title is short, specific, and states the primary change. It does not cover the tests, docs, or changeset, which is expected.

Full details: Linked Issues check

Explanation

Issue #273 requires reverse options for waffleY (bottom-to-top fill) and waffleX (left-to-right then bottom-to-top fill). At the reviewed head, packages/charts-core/src/waffle.ts adds optional reverseX and reverseY to WaffleOptions, both defaulting to false via options.reverseX ?? false and options.reverseY ?? false. Both waffleY and waffleX pass these flags through the shared waffle() function into layoutWaffle(). In layoutWaffle(), after each fragment's position is computed (including partial cells), reverseX sets fragment.x = 2 * gridX + gridWidth - fragment.x - fragment.width, and reverseY applies the same mirror to fragment.y around the centered grid. Source order, keys (fragment index keys), values, and the anchor (middle fragment center) still come from the same segments, so data identity is preserved. The waffle.test.ts additions cover both orientations, fixed and responsive packing, and combined reversal. I did not execute the tests; this verdict rests on source inspection of the mirror logic and the reported test results. The linked issue has no non-coding requirements.

Full details: Out of Scope Changes check

Explanation

Changed areas are limited to the waffle mark implementation (packages/charts-core/src/waffle.ts), its tests (waffle.test.ts), documentation for the new options (root and charts-core waffle.md), and a minor Changeset. Documentation and the Changeset directly describe the new options. The layout change is confined to the fragment mirror and option plumbing. The PR description reports that dependencies, workflows, default behavior, bundle limits, and locked records are unchanged; the raw summary does not contradict this. Generated package doc copies and bundle-policy checks are release-support artifacts for the same feature and are not unrelated changes. No unrelated change was found in the evidence reviewed.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fc713486-e303-4e55-bc31-aa5fc82cc4e1
Commits

Reviewing files that changed from the base of the PR and between b236dae and 318880d.

Files selected for processing: 5

  • .changeset/reverse-waffle-directions.md
  • docs/reference/marks/waffle.md
  • packages/charts-core/docs/reference/marks/waffle.md
  • packages/charts-core/src/waffle.test.ts
  • packages/charts-core/src/waffle.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@nx-cloud

nx-cloud Bot commented Nov 20, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 318880d

Command Status Duration Result
nx run charts-workspace:benchmark-check ❌ Failed 56s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-20 02:13:38 UTC

This branch has not been deployed

No deployments
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.

Add reverse options to waffleY and waffleX

1 participant