Skip to content

Choose implicit Scatter ErrorBar direction based on chart layout#6159

Merged
ckifer merged 1 commit intomainfrom
errorbar-implicit-direction
Jul 30, 2025
Merged

Choose implicit Scatter ErrorBar direction based on chart layout#6159
ckifer merged 1 commit intomainfrom
errorbar-implicit-direction

Conversation

@PavelVanecek
Copy link
Copy Markdown
Collaborator

Description

Bar and Line already did that, Scatter we forgot.

There is some visual diff with numerical XAxis. Technically this is a breaking change if we think of it as a feature. If we think of it as a bugfix then it's a patch ¯_(ツ)_/¯

Related Issue

Fixes #6152

@PavelVanecek PavelVanecek requested review from ckifer and Copilot July 30, 2025 10:30
Copy link
Copy Markdown
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 refactors the ErrorBar direction logic to use chart layout context instead of prop drilling. The change removes the SetErrorBarPreferredDirection wrapper component and moves the direction determination logic directly into the useErrorBarDirection hook using the chart layout context.

  • Removes the SetErrorBarPreferredDirection context provider and related prop drilling
  • Updates useErrorBarDirection hook to use chart layout context for determining direction
  • Simplifies Bar and Line components by removing ErrorBar direction wrapper usage

Reviewed Changes

Copilot reviewed 4 out of 25 changed files in this pull request and generated 1 comment.

File Description
src/cartesian/ErrorBar.tsx Replaces context-based direction setting with direct chart layout usage
src/cartesian/Line.tsx Removes SetErrorBarPreferredDirection wrapper and layout prop usage
src/cartesian/Bar.tsx Removes SetErrorBarPreferredDirection wrapper and layout prop usage
DEVELOPING.md Adds clarification about VR test report viewing

*/
import * as React from 'react';
import { Component, createContext, SVGProps, useContext } from 'react';
import { Component, SVGProps } from 'react';
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

The useContext import was removed but createContext is still being removed from the same import statement. Consider cleaning up the import to only include what's actually used.

Suggested change
import { Component, SVGProps } from 'react';
import { SVGProps } from 'react';

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is still used, irrelevant comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think the new variant makes more sense - it follows the numerical axis. Same as the Scatter points.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.50%. Comparing base (15ffbde) to head (bc99d1b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6159      +/-   ##
==========================================
- Coverage   96.51%   96.50%   -0.01%     
==========================================
  Files         217      217              
  Lines       19839    19825      -14     
  Branches     4083     4081       -2     
==========================================
- Hits        19147    19133      -14     
  Misses        686      686              
  Partials        6        6              

☔ 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
Copy Markdown

codecov bot commented Jul 30, 2025

Bundle Report

Changes will decrease total bundle size by 1.65kB (-0.07%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.02MB -698 bytes (-0.07%) ⬇️
recharts/bundle-es6 878.7kB -688 bytes (-0.08%) ⬇️
recharts/bundle-umd 486.49kB -260 bytes (-0.05%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Line.js -190 bytes 24.01kB -0.78%
cartesian/Bar.js -190 bytes 23.44kB -0.8%
cartesian/ErrorBar.js -318 bytes 9.04kB -3.4%
view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js -260 bytes 486.49kB -0.05%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Line.js -201 bytes 22.53kB -0.88%
cartesian/Bar.js -201 bytes 21.94kB -0.91%
cartesian/ErrorBar.js -286 bytes 8.13kB -3.4%

@ckifer
Copy link
Copy Markdown
Member

ckifer commented Jul 30, 2025

Yeah we'll call this a bug fix

@ckifer ckifer merged commit b6230b5 into main Jul 30, 2025
25 of 27 checks passed
@ckifer ckifer deleted the errorbar-implicit-direction branch July 30, 2025 14:05
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.

Breaking behaviour when not setting direction property on ErrorBar

3 participants