Skip to content

Conversation

@TylonHH
Copy link
Owner

@TylonHH TylonHH commented Jan 2, 2026

Motivation

  • Improve visual contrast by scaling tariff/price bars to the actual observed minimum and maximum instead of always from zero to max.
  • Avoid misleading tall bars when values are tightly clustered or all above zero.
  • Provide a sensible, neutral fallback for empty or constant data ranges.

Description

  • Compute valueInfo from observed slot values using Number.NEGATIVE_INFINITY/Number.POSITIVE_INFINITY and return { min: 0, range: 0 } when no values are present.
  • Update valueStyle to return a neutral 50% height when the computed range is 0 or when the input is undefined/NaN.
  • Normalize bar heights with (val - min) / range, clamp them to 0..1, and return the percentage height as ${clamped * 100}%.

Testing

  • Started the dev server with npm run dev, which launched and served the app successfully.
  • Ran a Playwright script to load the page and capture a screenshot, producing artifacts/tariff-chart-updated.png.
  • No unit or integration test suites were executed as part of this change.

Codex Task

@TylonHH TylonHH merged commit 322880f into master Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants