Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation for ErrorBar #4311

Merged

Conversation

ForestLinSen
Copy link
Contributor

@ForestLinSen ForestLinSen commented Mar 18, 2024

Description

Added animation for ErrorBar component

Related Issue

ErrorBar does not animate

Motivation and Context

Previously the ErrorBar didn't have animation, now animation has been introduced to make it have a smoother visual effect

How Has This Been Tested?

It was tested locally with Storybook and validated through unit tests

Screenshots (if appropriate):

rechart-animation2.mp4

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or extended an existing story to show my changes

Copy link
Member

@ckifer ckifer left a comment

Choose a reason for hiding this comment

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

Looking for a few more tests here if possible.

I'd like to play with this a little before we release it to get the best possible default. From the video the appearance seems maybe not fast enough or maybe that the animation should follow the direction of the error bar? I'm not sure

Either way thanks for doing this

src/cartesian/ErrorBar.tsx Show resolved Hide resolved
src/cartesian/ErrorBar.tsx Show resolved Hide resolved
@ForestLinSen
Copy link
Contributor Author

Looking for a few more tests here if possible.

I'd like to play with this a little before we release it to get the best possible default. From the video the appearance seems maybe not fast enough or maybe that the animation should follow the direction of the error bar? I'm not sure

Either way thanks for doing this

Thanks! I've updated the PR with more tests and also updated the default animation duration

@PavelVanecek
Copy link
Collaborator

I wish the animation expanded from the dot up and down <3 that would be amazing.

Copy link
Collaborator

@PavelVanecek PavelVanecek left a comment

Choose a reason for hiding this comment

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

Looks good to me except the setTimeout in test - please switch it to fake timers

src/cartesian/ErrorBar.tsx Show resolved Hide resolved
src/cartesian/ErrorBar.tsx Show resolved Hide resolved
test/cartesian/ErrorBar.spec.tsx Outdated Show resolved Hide resolved
test/cartesian/ErrorBar.spec.tsx Outdated Show resolved Hide resolved
Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.94%. Comparing base (1f681e7) to head (98d88f8).
Report is 20 commits behind head on 3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.x    #4311      +/-   ##
==========================================
+ Coverage   94.05%   94.94%   +0.88%     
==========================================
  Files          92       92              
  Lines       20113    20163      +50     
  Branches     2769     2823      +54     
==========================================
+ Hits        18918    19144     +226     
+ Misses       1187     1013     -174     
+ Partials        8        6       -2     

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

@ForestLinSen
Copy link
Contributor Author

I wish the animation expanded from the dot up and down <3 that would be amazing.

Did try that initially but couldn't find a way to implement that without using css @Keyframe (I guess we shouldn't add extra css files in this project?)

@ckifer
Copy link
Member

ckifer commented Mar 20, 2024

@ForestLinSen looks like tests are failing

@ForestLinSen
Copy link
Contributor Author

@ForestLinSen looks like tests are failing

Hi @ckifer , I've updated the unit tests, could you approve the workflow again? Thx

Copy link
Member

@ckifer ckifer left a comment

Choose a reason for hiding this comment

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

Change LGTM

Copy link
Member

@ckifer ckifer left a comment

Choose a reason for hiding this comment

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

LGTM - going to merge it. If we want to adjust how the animation happens we probably can before 3.x is released

@ckifer ckifer merged commit e7338c4 into recharts:3.x Mar 21, 2024
5 checks passed
@ckifer
Copy link
Member

ckifer commented Mar 21, 2024

@ForestLinSen these tests failed after merge, could you take a look?

ckifer pushed a commit that referenced this pull request Apr 15, 2024
## Description

The current `ErrorBar` animation transitions from left to right.
According to the discussions in the previous
[PR](#4311), it has now been
changed to expand centrally towards both the top and bottom

## Related Issue

[ErrorBar does not
animate](#4055)

## Motivation and Context

## How Has This Been Tested?

It was tested locally with Storybook and validated through unit tests

## Screenshots (if appropriate):


https://github.com/recharts/recharts/assets/41566276/2fe5908b-4d83-4664-821d-761cd20e847e

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [ ] I have added a storybook story or extended an existing story to
show my changes
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.

None yet

3 participants