fix(charts): readable labels on colored fills (treemap/sunburst/circle-packing) - #1095
Conversation
…e-packing) Labels rendered directly on colored chart fills used inconsistent strategies (treemap/sunburst color:"inherit", circle-packing hardcoded white with no outline). On the light-tinted cells the palette generates (light-lavender / light-cyan children), white-only labels washed out — unreadable, especially in dark mode. Unifies on a single treatment in chart-utils — FILL_LABEL_COLOR (white) + FILL_LABEL_OUTLINE / _WIDTH (subtle dark outline) — applied to treemap, sunburst and circle-packing labels. Reads on light- and dark-tinted fills alike, in both themes. Also aligns the chart empty-state color to the exact theme --muted-foreground hex. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughIntroduces three exported label-styling constants ( ChangesChart Label Styling Constants and Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Invokes the custom renderItem so the leaf-label text element (white fill + dark outline) executes, lifting new-code coverage above the 80% gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SonarCloud new_coverage counts condition coverage. Adds tests for the previously-uncovered branches: sunburst series/emphasis label treatment and the withinDepth=false (transparent) level label, plus buildEmptyDataOption's dark-mode branch. Lifts new-code coverage above the 80% gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@component/src/charts/__tests__/circle-packing-chart.test.tsx`:
- Line 92: Remove the duplicate const api declaration in the test file. There
are two declarations of the api variable in the same scope, which causes a
compile-time error. Keep only one declaration of the api object that contains
the value and style methods, and delete the redundant duplicate declaration of
api.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5376690f-b427-445d-9cd4-c2a490303107
⛔ Files ignored due to path filters (2)
claude_code_docs/component-review/img/comp-circlepack.pngis excluded by!**/*.pngclaude_code_docs/component-review/img/comp-treemap.pngis excluded by!**/*.png
📒 Files selected for processing (8)
component/src/charts/__tests__/circle-packing-chart.test.tsxcomponent/src/charts/__tests__/empty-data-option.test.tscomponent/src/charts/__tests__/sunburst-chart.test.tsxcomponent/src/charts/__tests__/treemap-chart.test.tsxcomponent/src/charts/chart-utils.tscomponent/src/charts/circle-packing-chart.tsxcomponent/src/charts/sunburst-chart.tsxcomponent/src/charts/treemap-chart.tsx
Replaces the hard text outline (which haloed glyphs and muddied labels on saturated cells) with a cleaner treatment: - treemap / sunburst: white text + a soft blurred drop-shadow — crisp on saturated cells, still readable on the pale child cells the palette makes. - circle-packing: per-cell contrast (contrastTextColor) — black text on the light moss/mint leaves, white on the dark blue parents — no halo. Tests updated to assert the shadow/contrast treatment. tsc clean; chart suite passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|



Summary
Fixes chart label readability on colored fills. Labels drawn on cells/segments/circles used three different strategies (
color: "inherit"on treemap/sunburst, hardcoded white on circle-packing). On the light-tinted cells the palette generates, white-only labels washed out — worst in dark mode.Approach (revised after review)
A first pass used a hard text outline, but a stroke haloes every glyph and muddies the text on the saturated cells where plain white was already crisp. The refined treatment:
contrastTextColor): black text on the light moss/mint leaves, white on the dark blue parents — maximally readable, zero halo.Before / after (old → hard-outline → final)
Treemap

Circle-packing

Tests
tscclean · chart suite passes.Follow-ups (flagged, not here)
DEPTH_COLORSpalette (not citrine) — separate vibrancy fix.Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Tests