Skip to content

BarChart floors every bar height at 2%, making a negative value visually indistinguishable from a near-zero positive one #206

Closed

Description

@chonilius

src/components/ui/BarChart.tsx computes each bar's height as:

const max = Math.max(...data.map((d) => d.value), 1);
...
const pct = Math.max((d.value / max) * 100, 2);

For any d.value <= 0, pct is forced up to a minimum of 2 so the bar stays visually
present rather than collapsing to nothing. This is reasonable for a genuine zero, but it
means a negative value — e.g. a net-negative weekly spend after a large refund, or a
negative delta in a future "change vs last period" chart — renders as an identical
small, positive-looking bar, with no visual distinction from a value of exactly 0 or a
tiny positive value. The sign of the underlying number is completely lost in the chart.

BarChart currently only receives non-negative mock data (contributorEarningsHistory,
sponsorSpendHistory), so this isn't visible today, but the component itself has no
guard, type constraint, or documented assumption that value >= 0, and
formatValue/title (the hover tooltip) would still show the correct negative number
while the bar itself visually contradicts it.

Suggested fix: either document that BarChart requires non-negative input and validate
it, or handle negative values explicitly — e.g. render them below a zero baseline, or in
a visually distinct color — so a negative figure can't be silently displayed as if it
were a small positive one.

Activity

  1. added
    bug
    very hard
    help wanted
    enhancement
    on Aug 21, 2026
  2. added
    Stellar Wave
    on Aug 24, 2026
  3. datagerl commented on Aug 24, 2026

    @datagerl

    @datagerl has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi maintainer can I please work on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @datagerl to this issue.

  4. theophilus2530 commented on Aug 24, 2026

    @theophilus2530

    @theophilus2530 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hello Maintainer, I’ve gone through the issue and have a clear understanding of what needs to be done. I’m ready to take ownership and deliver a reliable solution.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @theophilus2530 to this issue.

  5. posimideveloper commented on Aug 24, 2026

    @posimideveloper
    Contributor

    @posimideveloper has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    I'm ready to tackle this immediately.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @posimideveloper to this issue.

  6. drips-wave commented on Aug 24, 2026

    @drips-wave

    Congratulations, @posimideveloper! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @posimideveloper: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  7. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @posimideveloper as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @posimideveloper: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  8. removed
    Stellar Wave
    on Oct 15, 2026
  9. added
    Stellar Wave
    on Oct 15, 2026
  10. removed
    Stellar Wave
    on Oct 15, 2026
  11. added
    Stellar Wave
    on Oct 15, 2026
  12. removed
    Stellar Wave
    on Oct 15, 2026
  13. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar Wavebugenhancementhelp wantedvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions