Skip to content

Only use the YAxis width oscillation detection if the difference is > 1 pixel#6450

Merged
ckifer merged 1 commit intomainfrom
yaxis-width-auto
Oct 14, 2025
Merged

Only use the YAxis width oscillation detection if the difference is > 1 pixel#6450
ckifer merged 1 commit intomainfrom
yaxis-width-auto

Conversation

@PavelVanecek
Copy link
Collaborator

Description

The oscillation detector is there for sub-pixel rendering difference but here it was interfering with actual data changes.

Related Issue

Fixes #6424

@PavelVanecek PavelVanecek changed the title Only use the YAxis width oscillation detection if the difference is <= 1 pixel Only use the YAxis width oscillation detection if the difference is > 1 pixel Oct 14, 2025
@PavelVanecek PavelVanecek requested a review from Copilot October 14, 2025 07:54
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 PR modifies the YAxis width oscillation detection to only prevent updates when the width difference is 1 pixel or less, allowing legitimate data changes with larger differences to proceed normally.

  • Updates oscillation detection logic to include a 1-pixel threshold check
  • Adds comprehensive test coverage for both small oscillations (≤1px) and larger intentional changes (>1px)
  • Removes unrelated state management code from AreaChart story

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/state/cartesianAxisSlice.ts Added 1-pixel threshold condition to oscillation detection logic
test/state/selectors/cartesianAxisSlice.spec.ts Added new test case and updated existing test to verify oscillation behavior with pixel thresholds
storybook/stories/API/chart/AreaChart.stories.tsx Removed unused state management code from story component

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.83%. Comparing base (0da6676) to head (0be5b36).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6450   +/-   ##
=======================================
  Coverage   93.83%   93.83%           
=======================================
  Files         417      417           
  Lines       38423    38429    +6     
  Branches     4502     4506    +4     
=======================================
+ Hits        36053    36059    +6     
  Misses       2353     2353           
  Partials       17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Bundle Report

Changes will increase total bundle size by 177 bytes (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.08MB 78 bytes (0.01%) ⬆️
recharts/bundle-es6 929.37kB 78 bytes (0.01%) ⬆️
recharts/bundle-umd 497.8kB 21 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
state/cartesianAxisSlice.js 78 bytes 4.83kB 1.64%
view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js 21 bytes 497.8kB 0.0%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
state/cartesianAxisSlice.js 78 bytes 4.16kB 1.91%

@ckifer ckifer merged commit 57e89b0 into main Oct 14, 2025
28 checks passed
@PavelVanecek PavelVanecek deleted the yaxis-width-auto branch October 14, 2025 12:08
@cusxio
Copy link

cusxio commented Oct 17, 2025

I was wondering, when will a new version 3 be release that includes this fix? Thank you.

@ckifer
Copy link
Member

ckifer commented Oct 17, 2025

I was out for the past two weeks, I will release soon

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.

yAxis with auto width does not resize correctly when data changes

4 participants