Add chart tooltip with formatted values (#211) - #264
Merged
arisu6804 merged 1 commit intoJul 22, 2026
Conversation
Contributor
|
LGTM — clean work, merging! 🚀 |
3 tasks
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
Adds an interactive tooltip to the chart component that displays formatted values when hovering over bars. The tooltip shows the numeric value (optionally formatted via a
formatValuecallback) and an optional label for each data point.Changes
src/components/Chart.jsxhoveredIndexstate to track which bar is being hoveredformatValueprop — a function that receives a data item and returns a formatted string for the tooltiponMouseEnter/onMouseLeavehandlers on each<rect>bar#4f46e5) for visual feedbackrole="tooltip"element centered above the hovered bar, with formatted value and optional labelsrc/components/Chart.css.chart-wrapperfor absolute positioning context.chart-barwith pointer cursor and smooth fill transition.chart-tooltippositioned above the bars, styled consistently with the existingTooltip.css.chart-tooltip-value(bold) and.chart-tooltip-label(muted, text-overflow ellipsis) sub-elementsprefers-contrast: moremedia query override matching existing patternssrc/components/Chart.stories.jsx(new)Default,WithFormattedValues, andSingleBarvariantssrc/pages/Transfers.jsxformatValue={(d) => formatAmount(d.value, d.currency)}to format transfer amounts as currencylabel(recipient) andcurrencyfor richer tooltip displaytest/components/Chart.test.jsxCloses #211