Repository navigation
fix(shopping): show the All cards line's dash in the trend chart's legend - #1597
Merged
Merged
Conversation
…gend Recharts' default legend icon is a solid line, so "Your cards" and the dashed "All cards" looked alike. On dark they're only 1.75:1 apart. Both series now use legendType="plainline", which draws each icon with its series' own dash. A follow-up from ansvisor#1585. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
7 of 12 tasks
gkhngyk
approved these changes
Oct 27, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Own change. One commit on 5bbd162:
legendType="plainline"on both series ofShoppingTrendChartView(shopping_charts.tsx:113,:126). It merges clean on main (15b5b5f), and with #1596 and #1603. No other open PR touches the file. - Recharts. With the installed 3.8.0, a
plainlineicon is a<line>drawn with the series'strokeDasharray(DefaultLegendContent), and bothAreaandLinehand their own props to the legend as its payload. So "All cards" gets4 3and "Your cards" none.<Legend>sets noiconType, so nothing overrides it. - Rendered. I rendered
ShoppingTrendChartViewwithwidth={600}in jsdom: at this head the legend has two<line>icons, one withstroke-dasharray="4 3". With main's chart they are two<path>s with no dash. - Before the API deploy. Web only, the legend's look only.
Follow-ups:
- A test can cover this. The view takes a fixed width, so Recharts does draw it in jsdom (only
ResponsiveContainermeasures zero there). A test that renders<ShoppingTrendChartView width={600} data={…} />and expects two.recharts-legend-iconelements, exactly one withstroke-dasharray="4 3", passes here and fails on main. - The series names aren't in
en.json(shopping_charts.tsx:59,:112,:124, unchanged here). "Card rate", "Your cards" and "All cards" are literals, and they show in the legend and the tooltips. Pass them in as props from the page's translations, as its other labels are.
7 of 12 tasks
8 of 12 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Oct 28, 2026
…nd test the trend legend's dash (#1670) Follow-ups from #1597. - "Card rate", "Your cards" and "All cards" were literals in shopping_charts.tsx, shown in the legend and the tooltips. They're now shopping.seriesCardRate / seriesOwnCards / seriesAllCards in en.json, passed in as props from the page's translations like its other labels. - A test draws the trend chart at a fixed width (Recharts renders it in jsdom then) and expects two legend icons, exactly one dashed "4 3", with the names it was given. Without the All cards line's legendType the test fails. Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
A follow-up from #1585's approval. The trend chart's legend now shows the dash of the "All cards" line.
legendType="line") draws the same solid icon for both series and ignoresstrokeDasharray.legendType="plainline". Recharts then draws each icon with its own series' dash: a dashed "All cards" beside a solid "Your cards", the same shape for both.Related issue
Follow-up to #1585.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Open Shopping. Under "Your shopping presence — last 30 days", the legend's "All cards" icon is dashed, and "Your cards" is solid.
Checked in the browser at 1024 px, light and dark, with this branch's web and the dev DB.
<line>s: "All cards" hasstroke-dasharray="4 3", "Your cards" has none.No test renders the chart: Recharts draws nothing at jsdom's zero size, and the change is the legend's look only.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run in
web/:yarn format,yarn lint(0 errors),yarn typecheck;yarn test(4,138 tests);yarn build.🤖 Generated with Claude Code