Skip to content

fix: show integers for values below 1k in trends chart tooltip#2550

Merged
graphieros merged 4 commits intomainfrom
format-download-chart-tooltip-values
Apr 16, 2026
Merged

fix: show integers for values below 1k in trends chart tooltip#2550
graphieros merged 4 commits intomainfrom
format-download-chart-tooltip-values

Conversation

@graphieros
Copy link
Copy Markdown
Contributor

@graphieros graphieros commented Apr 16, 2026

Follow up to #2519

This fixes an edge case for the big charts (downloads modal, compare page) where values displayed in the tooltip have decimals applied when data correction is enabled and the value in the tooltip is < 1k.
Just rounding the number before it is served to the formatter.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 16, 2026 3:03pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 16, 2026 3:03pm
npmx-lunaria Ignored Ignored Apr 16, 2026 3:03pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

📝 Walkthrough

Walkthrough

Rounded tooltip raw values with Math.round(...) before passing to compactNumberFormatter, preserving non-finite coercion to 0 and affecting both single- and multi-series tooltip rows in the trends chart component.

Changes

Cohort / File(s) Summary
Trends chart tooltip
app/components/Package/TrendsChart.vue
Changed tooltip raw derivation from Number(d?.value ?? 0) to Math.round(Number(d?.value ?? 0)), then formatted with compactNumberFormatter; non-finite values still coerced to 0.

Possibly related PRs

Suggested reviewers

  • danielroe
  • 43081j
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: rounding numeric values in the trends chart tooltip to display integers for values below 1k.
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining a bug fix for tooltip value formatting in the trends chart component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch format-download-chart-tooltip-values

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@graphieros graphieros marked this pull request as draft April 16, 2026 10:43
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/TrendsChart.vue 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@graphieros graphieros marked this pull request as ready for review April 16, 2026 10:47
@graphieros graphieros requested a review from a team April 16, 2026 10:48
@graphieros graphieros enabled auto-merge April 16, 2026 10:58
@graphieros graphieros added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit da0897b Apr 16, 2026
24 checks passed
@graphieros graphieros deleted the format-download-chart-tooltip-values branch April 16, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants