Repository navigation
fix(Bar): tooltip shows the color the bar renders with, entry id and styles stay off the background - #8000
Conversation
…styles stay off the background - The tooltip item color follows the bar: the entry fill, or the Bar fill, then the stroke. An entry `color` key no longer changes it, and with a theme an entry with its own colors ignores the theme colors, as the bar does. Bar reports this through an optional `getEntryColor` on its tooltip configuration; the other items keep reading the datum colors. - The entry `id` is no longer spread on the bar rectangle. The raw entry stays in `payload`. - The background rectangle no longer takes SVG properties from the entry. Custom background shapes still get the other entry keys and `payload`. Refs recharts#7972 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughBar tooltip entries now use an entry-aware color resolver with style and settings fallbacks. Bar rectangles filter selected data-entry properties from rendered SVG props while retaining the original entry as payload. ChangesBar entry behavior
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Bundle ReportChanges will increase total bundle size by 8.28kB (0.13%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-umdAssets Changed:
view changes for bundle: recharts/bundle-treeshaking-polarAssets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
view changes for bundle: recharts/bundle-treeshaking-cartesianAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8000 +/- ##
==========================================
+ Coverage 89.10% 89.12% +0.01%
==========================================
Files 652 652
Lines 16042 16062 +20
Branches 4239 4246 +7
==========================================
+ Hits 14295 14315 +20
Misses 1556 1556
Partials 191 191 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Test Results SummaryThis comment shows the latest test results for this pull request.
ℹ️ About Flakiness.io in GitHubYour team has set up Flakiness.io pull request comments. This comment is updated when
Flakiness.io rewrites the comment in place, so it always reflects the most recently tested commit. |
|
No visual diff? The tests we have now didn't cover this scenario? |
…d styles stay off the background (#8078) ## Description The RadialBar gaps from #7973, following the Bar fix in #8000: - **Tooltip color.** The tooltip item shows the color the sector renders with: the entry `fill`, else the `<RadialBar>` fill, then the stroke. `<Cell>` colors are included. `<RadialBar fill="#123456">` + `{ stroke: 'lime' }` gives `#123456` (was lime), and `{ color: 'blue' }` with a theme gives the theme fill (was blue). RadialBar passes `getEntryColor` in its tooltip configuration, same as Bar. - **Legend color.** Each legend item uses the resolved color of its own entry, `<Cell>` included. With a theme, a stroke-only entry `{ stroke: 'lime' }` now gets a lime icon instead of the theme fill; with `<RadialBar fill>`, it gets that fill. `selectRadialBarLegendPayload` no longer sets `color`. - **`id`.** The entry `id` is no longer rendered on the sector or the background sector. The raw entry stays in `payload`. - **Background.** The background sector no longer takes SVG properties from the entry (`stroke`, `opacity`, `style`, `data-*`, `id`, ...). Bar's private helpers moved to `src/theme/dataEntryStyles.ts` as `getEntryColor` and `omitEntrySvgProps`, so Bar and RadialBar share them. Bar behavior and screenshots are unchanged. The stroke-only open question from the issue is unchanged: with a theme and no `<RadialBar>` colors, `{ stroke: 'lime' }` still renders a black sector. Its legend icon now shows the stroke. ## Related Issue Fixes #7973 (part of #7968) ## Known gap A custom `background` function or element is never called on RadialBar: it renders the computed geometry as the shape option instead of the prop. This is #2535 and is not fixed here; there is a `test.fails` for it in `RadialBar.theme.spec.tsx` so that it shows up once fixed. ## How Has This Been Tested? - 9 new tests in `test/polar/RadialBar/RadialBar.theme.spec.tsx` (tooltip color with and without a theme, entry `color` key, Cell color in tooltip and legend, per-entry legend colors with a theme, entry `id`, background styles). 7 fail on `main`; the Cell tooltip and RadialBar-fill legend cases already passed and stay as regression guards. - 1 expected-fail test for #2535. - Full unit suite, lint and check-types pass (pre-push hook). - VR: regenerated the `RadialBar fill and stroke variants` screenshots in Docker (legend and tooltip colors). All other RadialBar and Bar VR tests are unchanged. ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have added tests to cover my changes. - [x] I have added a storybook story or VR test, or extended an existing story or VR test to show my changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Radial bar colors now appear consistently across chart segments, tooltips, and legends when colors are set on individual entries, series, themes, or custom cells. * Entry-specific styling no longer unintentionally affects chart backgrounds. * Clicking a chart entry continues to provide its original data, including its ID. * Legend colors now reflect entry-level fill and stroke styling, inline styles, and applicable theme or cell overrides. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Description
The Bar gaps from #7972:
fill, else the<Bar>fill, then the stroke.<Bar fill="#123456">+{ stroke: 'lime' }gives#123456(was lime), and{ color: 'blue' }with a theme gives the theme fill (was blue). With a theme, an entry with its own colors ignores the theme colors, same as the rectangle. To keep this per item, Bar passes a new optionalgetEntryColorin its tooltip configuration (next togetPosition);combineTooltipPayloaduses it when present and keeps reading the datumcolor/fill/strokefor the other items.id.computeBarRectanglesdrops the entryidbefore spreading the entry. The raw entry stays inpayload.stroke,opacity,style,data-*,id, ...). Custom background shapes still receive the other entry keys andpayload.The stroke-only open question is unchanged: with a theme,
{ stroke: 'blue' }still renders without a fill, and the tooltip shows the stroke.Related Issue
Refs #7972 (part of #7968)
Motivation and Context
See #7972.
How Has This Been Tested?
test/cartesian/Bar/Bar.theme.spec.tsx(tooltip color with and without a theme, entrycolorkey, entryid, background styles, custom background props). All 6 fail onmainand pass with this change.Bar.spec.tsxanditemSorter.spec.tsxcompare the whole tooltip configuration, so they now expectgetEntryColoron Bar.npm run lgtm(build, lint, all unit projects, check-types) passed on Windows: 17441 tests.tsc(lib and test) and eslint clean.Types of changes
Checklist:
Summary by CodeRabbit