Charts: Test and document that bar chart grids follow each axis's numTicks - #52546
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
|
Reviewed at 6d24e24. The mechanism checks out: One consumer is actually affected: No blockers. Five suggestions: 1.
-numTicks={ chartOptions.axis.x.numTicks ?? 4 }
+numTicks={ chartOptions.axis.x.numTicks }2. The new test comment restates one already in the file. L439-L440 Line 41 already says "visx renders bars and grid lines without accessible roles or configurable test IDs", and the file's other two disables point back at it rather than repeating it. Matching them also restores the -// Visx renders grid and tick lines without configurable test IDs or accessible roles.
-// eslint-disable-next-line testing-library/no-node-access
+// eslint-disable-next-line testing-library/no-node-access -- See the visx node constraint above.3. The Jetpack changelog entry is written from the implementation. podcast-bar-chart-grid-tick-count "column-grid lines" and "tick counts" are visx vocabulary, and this line lands in 4. Consider an entry in 5. One screenshot would be worth it. With On the tests themselves: both would fail without the fix — the |
|
Thanks for the review. All five are applied in 3e4ebd2:
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the requested changelog and documentation updates and reconcile the stated Boost scope with the Podcast-focused implementation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates the shared BarChart to align grid lines with configured axis tick counts while preserving the default behavior.
Changes:
- Propagates axis tick counts to corresponding grids.
- Adds explicit and default-count alignment tests.
- Updates documentation and downstream changelogs.
| File | Summary |
|---|---|
projects/plugins/jetpack/changelog/podcast-bar-chart-grid-tick-count |
Adds a Jetpack-facing changelog entry. |
projects/packages/jetpack-mu-wpcom/changelog/podcast-bar-chart-grid-tick-count |
Adds a WordPress.com-facing changelog entry. |
projects/js-packages/charts/src/charts/bar-chart/test/bar-chart.test.tsx |
Tests explicit and default grid tick counts. |
projects/js-packages/charts/src/charts/bar-chart/stories/index.api.mdx |
Documents grid tick behavior. |
projects/js-packages/charts/src/charts/bar-chart/bar-chart.tsx |
Passes configured axis tick counts to grids. |
projects/js-packages/charts/changelog/bar-chart-grid-tick-count |
Records the shared Charts package change. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ``` | ||
|
|
||
| Grid lines follow axis ticks (explicit or derived) from `options.axis.x.tickValues` and `options.axis.y.tickValues`. | ||
| Grid lines use `tickValues` (explicit or derived) from the corresponding `options.axis.x` or `options.axis.y` options. Otherwise, they use that axis's `numTicks`, defaulting to four; the scale determines the actual number of ticks. |
The fix itself landed in #52588 while this PR was open. What is left is the coverage that PR did not add — grid positions asserted equal to the axis tick positions, on both axes and both orientations — and the API doc sentence, which still named only tickValues. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vAVZ6qLAJ7AR2UujogThA
3e4ebd2 to
d762bc9
Compare

BOOST-709 — the fix itself landed in #52588.
Proposed changes
numTicksto itsGridalong the way, which is exactly what this PR opened to do, so thebar-chart.tsxhunk is dropped and the branch is rebased onto that.countColumns( 15 ) > countColumns( 4 )— monotonicity on the band axis, which still passes if the grid and the axis disagree. These assert grid line positions equal axis tick positions, on both axes and both orientations.tickValuesalone and never mentionednumTicks. Charts: Tick a small whole-number value axis only on whole numbers #52588 did not touch it.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
jp test js js-packages/charts— 179 bar-chart tests pass.numTicks={ chartOptions.axis.{x,y}.numTicks }props inbar-chart.tsxtonumTicks={ 4 }: both "aligns an explicit tick count" cases fail, and pass again when restored.numTicksas well astickValues.No screenshots: this PR changes no rendered output. The visual change shipped with #52588.
🤖 Generated with Claude Code
https://claude.ai/code/session_017vAVZ6qLAJ7AR2UujogThA