Skip to content

Comments

fix: adjust chart temperature boundaries to avoid label overflow#24

Merged
troinine merged 5 commits intomainfrom
bugfix/chart-low-temp-overflow-issue
Dec 17, 2025
Merged

fix: adjust chart temperature boundaries to avoid label overflow#24
troinine merged 5 commits intomainfrom
bugfix/chart-low-temp-overflow-issue

Conversation

@troinine
Copy link
Owner

This change fixes #14 where low temperature line graph caused labels to overflow over x-axis.

Additionally, it harmonizes and improves chart CSS variables for better custom styling of the graph.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes issue #14 where temperature labels in chart mode would overflow over the x-axis when displaying low temperatures, particularly negative values. The fix enhances the algorithm that computes Y-axis boundaries to provide more bottom padding for low-temperature labels.

Key Changes:

  • Improved the computeScaleLimits() algorithm with better padding calculations (35% bottom vs 20% top) and a minimum 5° buffer for low temperatures
  • Harmonized and renamed CSS variables to follow a consistent --wfc-chart-* naming pattern for better customization
  • Added comprehensive test data with problematic negative temperature values to prevent regression

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/mocks/test-data.ts New test data file with two datasets (ISSUE_14_DAILY_FORECAST and ISSUE_14_DAILY_FORECAST_2) containing negative temperature values that reproduce the label overflow bug
test/mocks/hass.ts Enhanced mock with proper TypeScript types, public forecast properties for test data injection, and improved type safety for forecast subscriptions
test/app/index.html Added two new test cards (test-card-bug-14 and test-card-bug-14-2) that use the regression test data to verify the fix
src/weather-forecast-card.css Renamed CSS variables to follow consistent --wfc-chart-* naming pattern and added separate label color variables for high temps, low temps, and precipitation
src/components/wfc-forecast-chart.ts Updated chart configuration to use new CSS variable names, improved computeScaleLimits() algorithm with asymmetric padding (35% bottom, 20% top) and higher minimum buffers, and enhanced documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

troinine and others added 4 commits December 17, 2025 19:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
@troinine troinine added the fix Fix or improvement label Dec 17, 2025
@troinine troinine merged commit 09f08ae into main Dec 17, 2025
3 checks passed
@troinine troinine deleted the bugfix/chart-low-temp-overflow-issue branch December 17, 2025 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some overlapping issues

1 participant