Enhancement [DEV-12685] Add colors to chart tooltips#2705
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional, legend-consistent color/shape markers to chart tooltips so users can visually map tooltip rows back to series.
Changes:
- Introduces a typed tooltip-row model (with optional marker metadata) and marker-eligibility logic in a shared helper.
- Updates core tooltip rendering (LinearChart/PieChart via
useTooltip, plus Bar/Scatter HTML-tooltips) to render aligned marker swatches when appropriate. - Adds supporting tooltip marker styles plus Storybook smoke stories/tests to exercise marker/no-marker scenarios (including small multiples).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/components/ui/tooltip.scss | Adds layout + swatch styles for tooltip marker column. |
| packages/chart/src/types/ChartConfig.ts | Extends legend config with tooltipLegendVisible? to preserve “source legend visible” semantics for small multiples. |
| packages/chart/src/hooks/useTooltip.tsx | Converts tooltip payload to typed rows and renders optional marker column in React tooltip list items. |
| packages/chart/src/helpers/tooltipHelpers.ts | Adds shared marker eligibility/color resolution + HTML tooltip builders for series tooltips. |
| packages/chart/src/helpers/tests/tooltipHelpers.test.ts | Adds Vitest coverage for marker eligibility, uniqueness suppression, and HTML rendering. |
| packages/chart/src/components/SmallMultiples/SmallMultipleTile.tsx | Propagates “source legend visible” state into hidden tile legends to enable markers when appropriate. |
| packages/chart/src/components/ScatterPlot/ScatterPlot.jsx | Switches tooltip HTML generation to shared builder that can include markers. |
| packages/chart/src/components/PieChart/PieChart.tsx | Adapts tooltip data handling to new row-array format and passes marker-column flag to row renderer. |
| packages/chart/src/components/LinearChart.tsx | Adapts tooltip data handling to new row-array format and passes marker-column flag to row renderer. |
| packages/chart/src/components/BarChart/components/BarChart.Vertical.tsx | Uses shared HTML tooltip builder for consistent markup + optional markers. |
| packages/chart/src/components/BarChart/components/BarChart.StackedVertical.tsx | Uses shared HTML tooltip builder for consistent markup + optional markers. |
| packages/chart/src/components/BarChart/components/BarChart.StackedHorizontal.tsx | Uses shared HTML tooltip builder for consistent markup + optional markers. |
| packages/chart/src/components/BarChart/components/BarChart.Horizontal.tsx | Uses shared HTML tooltip builder for consistent markup + optional markers. |
| packages/chart/src/_stories/Chart.tooltip.smoke.stories.tsx | Adds stories covering marker rendering and “no markers” cases (legend hidden/gradient/patterns). |
| packages/chart/src/_stories/Chart.SmallMultiples.smoke.stories.tsx | Adds assertions around presence/absence of marker markup in small-multiple tooltip HTML. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Mgetz10
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds colored shapes to chart tooltip indicating which series the items in the tooltip belong to.
Testing Steps
Look at as many charts as possible and see if the colors shown in tooltips make sense.