Skip to content

Export and document interpolate function#7293

Merged
PavelVanecek merged 3 commits into
mainfrom
interpolate
May 2, 2026
Merged

Export and document interpolate function#7293
PavelVanecek merged 3 commits into
mainfrom
interpolate

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Description

This function is useful for writing custom animations. So let's export it for 3.9

Related Issue

#7215

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

Summary by CodeRabbit

  • New Features

    • Added a public interpolate utility for animation-related numeric interpolation.
  • Documentation

    • Added an "Animation" API category and localized docs (English/Chinese) for the new API.
  • Bug Fixes

    • Improved interpolation behavior for area baseline animations to handle numeric and non-finite baselines more predictably.
  • Tests

    • Expanded tests to cover new interpolate behaviors and export.
  • Chores

    • Updated bundle/treeshaking expectations to include the new utility.

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b64639ad-4af4-461a-8952-0e80c7b6ba80

📥 Commits

Reviewing files that changed from the base of the PR and between 326b29f and ea47775.

📒 Files selected for processing (3)
  • src/cartesian/Area.tsx
  • src/util/DataUtils.ts
  • test/util/DataUtils.spec.ts

Walkthrough

Adds a numeric-only interpolate export (with tightened overloads and JSDoc), re-exports it from the public entrypoint, registers it in docs/locales under a new animation category, updates many treeshaking-group expectations to include it, adjusts one Area animation interpolation call, and updates tests to cover null/undefined cases and exempt the symbol from example-coverage checks.

Changes

Interpolate public API, implementation signatures, docs, bundling, and tests

Layer / File(s) Summary
Type surface & docs
src/util/DataUtils.ts
Added JSDoc for interpolate (@since 3.9) and tightened exported overload signatures to `number
Core implementation (call-site tweak)
src/cartesian/Area.tsx
Adjusted stepBaseLine animation interpolation to derive a numeric-only previousNumberBaseLine from prevBaseLine and use it when interpolating numeric or null/NaN baselines.
Public export (entrypoint)
src/index.ts
Re-exported interpolate from ./util/DataUtils.
Docs categorization
www/src/docs/apiCates.ts
Added new animation category with items: ['interpolate'].
Localization
www/src/locale/en-US.ts, www/src/locale/zh-CN.ts
Added api.animation entries ('Animation' / '动画').
Treeshaking expectations (many groups)
scripts/treeshaking-groups/*.ts (Area, Bar, BarStack, Funnel, Line, Pie, Radar, RadialBar, ReferenceArea, Sankey, Scatter, Tooltip, Treemap, ...)
Added 'interpolate' to expectedInBundle arrays across multiple treeshaking-group scripts.
Treeshaking group mapping
scripts/treeshaking-groups/index.ts
Updated treeshakingGroups entries for Rectangle and Trapezoid to include interpolate.
Tests: unit & docs check
test/util/DataUtils.spec.ts, omnidoc/verifyExamples.spec.ts
Expanded interpolate unit tests to assert behavior when arguments are null/undefined; added interpolate to the list exempted from example-coverage checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exporting and documenting the interpolate function.
Description check ✅ Passed The description covers the key motivation (useful for custom animations), related issue reference, and appropriate change type selection; documentation updates are confirmed as complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch interpolate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/util/DataUtils.ts`:
- Around line 111-122: Update the JSDoc for the interpolation function in
src/util/DataUtils.ts (the function named interpolate or interpolateNumber) to
correct grammar and accurately state the contract: change “between two number”
to “between two numbers,” clarify that if either start or end is not a number
the function returns the end value, and explicitly note that the parameter t is
a numeric interpolation factor that is not clamped by the function (it accepts
values outside 0–1 if caller provides them). Mention callers should clamp t if
they need it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d7a0258d-1826-4340-83d1-ea65ed7032f1

📥 Commits

Reviewing files that changed from the base of the PR and between 79341c3 and c034f20.

📒 Files selected for processing (6)
  • omnidoc/verifyExamples.spec.ts
  • src/index.ts
  • src/util/DataUtils.ts
  • www/src/docs/apiCates.ts
  • www/src/locale/en-US.ts
  • www/src/locale/zh-CN.ts

Comment thread src/util/DataUtils.ts Outdated
@codecov

codecov Bot commented May 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.05%. Comparing base (02a29ec) to head (ea47775).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/cartesian/Area.tsx 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7293   +/-   ##
=======================================
  Coverage   89.05%   89.05%           
=======================================
  Files         541      541           
  Lines       41088    41101   +13     
  Branches     5564     5565    +1     
=======================================
+ Hits        36589    36601   +12     
- Misses       4491     4492    +1     
  Partials        8        8           

☔ 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.

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@PavelVanecek
PavelVanecek merged commit db59b0a into main May 2, 2026
58 of 59 checks passed
@PavelVanecek
PavelVanecek deleted the interpolate branch May 2, 2026 12:12
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.

1 participant