Skip to content

Add useXAxisDomain and useYAxisDomain hooks#6201

Merged
ckifer merged 4 commits intomainfrom
new-hooks
Aug 12, 2025
Merged

Add useXAxisDomain and useYAxisDomain hooks#6201
ckifer merged 4 commits intomainfrom
new-hooks

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Aug 12, 2025

Description

Includes documentation

Related Issue

#6021

Screenshots (if appropriate):

image

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 VR test, or extended an existing story or VR test to show my changes

Copilot AI review requested due to automatic review settings August 12, 2025 10:28
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 adds two new hooks, useXAxisDomain and useYAxisDomain, that allow developers to access the calculated domain values of X and Y axes in Recharts. These hooks provide access to both numerical domains (min/max ranges) and categorical domains (arrays of category values), supporting different axis types and configurations including brush interactions.

  • Adds comprehensive domain selection functionality for both X and Y axes
  • Includes extensive test coverage for various axis configurations and edge cases
  • Provides Storybook integration and documentation for the new hooks

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/hooks/useAxisDomain.spec.tsx Comprehensive test suite covering various axis configurations, domain types, and edge cases
storybook/storybook-addon-recharts/inspectors/YAxisDomainInspector.tsx Storybook inspector component for Y-axis domain visualization
storybook/storybook-addon-recharts/inspectors/XAxisDomainInspector.tsx Storybook inspector component for X-axis domain visualization
storybook/storybook-addon-recharts/inspectors/CartesianChartInspector.tsx Integration of new domain inspectors into Storybook
storybook/stories/API/hooks/useAxisDomain.mdx Documentation for the new hooks with usage examples
src/util/ReactUtils.ts Minor comment correction for deprecated function
src/state/cartesianAxisSlice.ts Export of default axis ID constant
src/hooks.ts Implementation of the new useXAxisDomain and useYAxisDomain hooks

@codecov
Copy link

codecov bot commented Aug 12, 2025

Bundle Report

Changes will increase total bundle size by 4.8kB (0.2%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.03MB 2.52kB (0.25%) ⬆️
recharts/bundle-es6 883.87kB 2.01kB (0.23%) ⬆️
recharts/bundle-umd 484.04kB 278 bytes (0.06%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
util/ReactUtils.js 6 bytes 6.26kB 0.1%
hooks.js 1.94kB 4.74kB 69.43% ⚠️
state/cartesianAxisSlice.js 30 bytes 3.18kB 0.95%
index.js 32 bytes 3.16kB 1.02%
view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js 278 bytes 484.04kB 0.06%
view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
index.js 274 bytes 11.16kB 2.52%
util/ReactUtils.js 6 bytes 6.94kB 0.09%
hooks.js 2.16kB 5.58kB 63.28% ⚠️
state/cartesianAxisSlice.js 72 bytes 3.79kB 1.94%

@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.70%. Comparing base (53dd2bc) to head (66700a8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6201   +/-   ##
=======================================
  Coverage   96.69%   96.70%           
=======================================
  Files         221      221           
  Lines       19870    19880   +10     
  Branches     4098     4102    +4     
=======================================
+ Hits        19214    19224   +10     
  Misses        650      650           
  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.

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.

Nice nice

@ckifer ckifer merged commit c9693bf into main Aug 12, 2025
25 of 27 checks passed
@ckifer ckifer deleted the new-hooks branch August 12, 2025 13:47
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.

3 participants