Skip to content

Conversation

@JCQuintas
Copy link
Member

@JCQuintas JCQuintas commented Oct 16, 2025

Fixes #13798

Implements:

  • On desktop-mouse: It should pan left/right with a side scroll wheel or during Shift + scroll
  • On desktop-trackpad: It should pan left/right while sliding to the left/right with two fingers
  • Tested on OSX and Windows
  • Allow configuring pan on x/y axes

@JCQuintas JCQuintas self-assigned this Oct 16, 2025
@JCQuintas JCQuintas added type: new feature Expand the scope of the product to solve a new problem. plan: Pro Impact at least one Pro user. scope: charts Changes related to the charts. labels Oct 16, 2025
@JCQuintas JCQuintas marked this pull request as draft October 16, 2025 16:18
@mui-bot
Copy link

mui-bot commented Oct 16, 2025

Deploy preview: https://deploy-preview-19998--material-ui-x.netlify.app/

Updated pages:

Bundle size report

ℹ️ Using snapshot from parent commit 789d239 (fallback from merge base d1c95a3).

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 🔺+60B(+0.02%) 🔺+8B(+0.01%)
@mui/x-charts-pro 🔺+1.55KB(+0.35%) 🔺+338B(+0.25%)
@mui/x-charts-premium 🔺+1.55KB(+0.35%) 🔺+365B(+0.28%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 7fdea1e

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 16, 2025

CodSpeed Performance Report

Merging #19998 will not alter performance

Comparing JCQuintas:side-scroll (05d7f60) with master (178daf2)1

Summary

✅ 13 untouched

Footnotes

  1. No successful run was found on master (63a6716) during the generation of this report, so 178daf2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@JCQuintas JCQuintas marked this pull request as ready for review October 16, 2025 18:32
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 17, 2025
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 17, 2025
@bernardobelchior
Copy link
Member

It's a bit hard to showcase, but scrolling on wheel seems to be too slow. When I scroll the page scroll seems much faster than when scrolling the chart. Especially if you use your trackpad and scroll fast, the page will scroll very fast, but the chart won't.

Screen.Recording.2025-10-17.at.15.07.21.mov

Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

About the default config, would it be possible to have by default

  • the y-wheel manages the zoom
  • the x-wheel manages x-axis pan

That would be nice for people using either track-pad or mouse with a x-wheel

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Nov 3, 2025
@JCQuintas JCQuintas marked this pull request as ready for review November 5, 2025 14:54
if (!zoomInteractionConfig?.pan) {
defaultizedConfig.pan = {
drag: { type: 'drag', requiredKeys: [], mouse: {}, touch: {} },
wheel: { type: 'wheel', requiredKeys: [], mouse: {}, touch: {}, allowedDirection: 'x' },
Copy link
Member

Choose a reason for hiding this comment

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

I suppose we should document this limitation, right? Otherwise developers won't realize until their users complain that pan on wheel isn't working properly.

This makes me thing if we should even enable by default if we know it'll have issues.

return;
}

rafThrottledSetZoomData((prev) => {
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we potentially losing events? rafThrottle will call setZoomData at most once per frame. If we call rafThrottledSetZoomData twice within a frame, the function will be called once per frame with the last arguments.

As a rule of thumb, with rafThrottle we need to accumulate the events and call the throttled function with the accumulated data. If we process the events inside the throttled function we can lose events.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't really seem to affect wheel events a lot, since they don't need to "sync" with the mouse.

I've added the accumulator regardless

@JCQuintas JCQuintas enabled auto-merge (squash) November 13, 2025 15:36
@JCQuintas JCQuintas merged commit 7379063 into mui:master Nov 13, 2025
20 of 21 checks passed
@JCQuintas JCQuintas deleted the side-scroll branch November 13, 2025 15:47
bernardobelchior added a commit to bernardobelchior/mui-x that referenced this pull request Nov 19, 2025
bernardobelchior added a commit to bernardobelchior/mui-x that referenced this pull request Nov 19, 2025
bernardobelchior added a commit to bernardobelchior/mui-x that referenced this pull request Nov 19, 2025
bernardobelchior added a commit to bernardobelchior/mui-x that referenced this pull request Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plan: Pro Impact at least one Pro user. scope: charts Changes related to the charts. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[charts][zoom] Support side scrolling to pan

5 participants