Skip to content

feat: Add zoom to cartesian chart - #288

Open
srungta08 wants to merge 3 commits into
mainfrom
dev-v3-srungta-zoom-api
Open

srungta08 wants to merge 3 commits into
mainfrom
dev-v3-srungta-zoom-api

Conversation

@srungta08

@srungta08 srungta08 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Description

Makes zoom public on the cartesian chart. This is the last step towards built-in zoom, and the first one that changes the public API. The zoom properties added in #275, #278 and #286 move out of the internal interfaces into CartesianChartProps and CoreChartProps.

  • Properties: zoom, zoomRange and onZoomRangeChange.
  • Ref methods: enterZoomMode, exitZoomMode and resetZoom, for consumers who hide the built-in controls.
  • Zoom labels in i18nStrings.
  • Test utils: findZoomButton, findExitZoomButton, findResetZoomButton and findZoomCursor.

Related links, issue #, if available: n/a

How has this been tested?

  • Unit tests
  • Documenter snapshot updated
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Make zoom public on CartesianChart and the core chart: the zoom,
zoomRange and onZoomRangeChange properties, the enterZoomMode,
exitZoomMode and resetZoom ref methods, the zoom labels in
i18nStrings, and zoom finders in the test utils.
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.27586% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.04%. Comparing base (d4db05d) to head (5893ab0).

Files with missing lines Patch % Lines
src/core/chart-api/chart-extra-zoom.ts 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
+ Coverage   93.99%   94.04%   +0.05%     
==========================================
  Files          64       64              
  Lines        3529     3578      +49     
  Branches     1131     1139       +8     
==========================================
+ Hits         3317     3365      +48     
- Misses        212      213       +1     

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The public zoom method can lock chart interaction after zoom is disabled, and completing or cancelling keyboard selection with hidden zoom controls fails to restore focus to a usable element.

2 open issues
What changed in this PR

Makes the existing Cartesian chart zoom functionality public, completing the work introduced in #275, #278, and #286.

Changes:

  • Exposes zoom configuration, controlled ranges, change events, and imperative methods through chart APIs.
  • Adds customizable zoom labels and test utilities for zoom controls and the cursor.
  • Updates tests, API snapshots, and development pages to use the public interfaces.
File Description
test/​functional/​cartesian-chart.test.ts Uses the public reset-button selector.
src/​test-utils/​dom/​internal/​core.ts Adds core zoom-control and cursor finders.
src/​test-utils/​dom/​cartesian-chart/​index.ts Adds Cartesian zoom-control and cursor finders.
src/​core/​internal-interfaces.ts Removes the internal-only zoom interfaces.
src/​core/​interfaces.ts Exposes zoom properties, methods, types, and labels.
src/​core/​i18n-utils.tsx Connects consumer-provided zoom labels and announcements.
src/​core/​components/​core-zoom-controls.tsx Limits the reset-button selector to its visible state.
src/​core/​chart-core.tsx Uses the promoted core zoom types.
src/​core/​chart-api/​index.tsx Exposes imperative zoom methods.
src/​core/​chart-api/​chart-extra-zoom.ts Uses the public zoom-range type.
src/​core/​chart-api/​chart-extra-context.tsx Uses public zoom event and range types.
src/​core/​__tests__/​common.tsx Replaces internal zoom casts and custom finders.
src/​core/​__tests__/​chart-core-zoom.test.tsx Uses the public zoom-range type.
src/​core/​__tests__/​chart-core-rendering.test.tsx Checks the exposed zoom methods.
src/​cartesian-chart/​interfaces.ts Documents and exposes the Cartesian zoom API.
src/​cartesian-chart/​chart-cartesian-internal.tsx Forwards ref methods to the core zoom API.
src/​cartesian-chart/​__tests__/​cartesian-chart-zoom.test.tsx Tests ref methods and custom labels.
src/​__tests__/​__snapshots__/​documenter.test.ts.snap Records the expanded API documentation.
pages/​common/​page-settings.tsx Removes internal zoom type intersections.
pages/​03-core/​simple-zooming.page.tsx Uses the core component without a zoom-specific cast.

Review effort: Balanced

Comment thread src/core/chart-api/index.tsx Resolved
enterZoomMode now does nothing while zoom is disabled. Turning zoom
off kept the cursor stops, so the call still entered zoom mode and
locked the pointer.

When the built-in zoom controls are hidden, the focus goes back to the
element that entered zoom mode once a range is selected or zoom mode
is cancelled, instead of dropping to the page body.
@srungta08
srungta08 requested a balanced review from Copilot November 18, 2026 13:27
@srungta08
srungta08 marked this pull request as ready for review November 18, 2026 13:30
@srungta08
srungta08 requested a review from a team as a code owner November 18, 2026 13:30
@srungta08
srungta08 requested review from amanabiy and pan-kot and removed request for a team and amanabiy November 18, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the changes exposing zoom functionality through the public chart APIs.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

The zoomRange docs now say up front that the property is optional,
and that the chart keeps track of the zoomed range when it isn't set.

This branch was successfully deployed

1 active deployment
dev-pages — 5893ab0c Deployed Nov 18, 2026 by srungta08 via deploy / deploy #1387
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.

2 participants